pro mini to sn75441 back emf?

Can 5v pro mini handle being hooked up to 12v on the raw pin? I keep wrecking minis maybe its back emf?

The sne. I have two ics bridged and stacked. which should output enough amps. I have a 7812 connected to my 3d printer power supply but its going to have Alkaline batteries in the end.

All grounds are tied together with solder

I have 5v pin to vcc on mini

Enable pins are tied together

Motor out

Left and right to respective arduino pins

https://www.google.com/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwjLhbvJxqfUAhXBOSYKHZiFBZ4QjRwIBw&url=https%3A%2F%2Fwww.raspberrypi.org%2Fforums%2Fviewtopic.php%3Ff%3D45%26t%3D45857&psig=AFQjCNE0kFnJUKK1XDen5RtYDwLAsbpZaA&ust=1496781188214100

In the code below I know feather outputs 3.3 and pro mini wants 5 for HIGH but i read somewhere not 0 is equal to 1 in coding? Is that true for this code as well?

Can you suggest a cleaner way of writing my if statements I think theres a way of simplifying it.

Should I just tie all of the Enable pins all HIGH?

// This code is intended to go into a pro mini
const int enablePin = 2; //to sne75441 enable
const int motorPin1 = 4; // to sne 75441 left motor
const int motorPin2 = 6; // to sne 75441 right motor


int analogPin1 = A0;// pin from feather to pro mini
int analogPin2 = A1; //up
int analogPin3 = A2; //down

int ledState = LOW;  // int to store state of radio pin read.

/*would love to create a delay function in between state changes to reduce back emf but i dont know how.*/
unsigned long previousMillis = 0;
unsigned long interval = 3000;

void setup() {
 
  pinMode( enablePin, OUTPUT); // to both enable pins on 7544
  pinMode( motorPin1, OUTPUT); // to left motor pin on 7544
  pinMode( motorPin2, OUTPUT);// to right motor pin on 7544
  pinMode( analogPin1, INPUT); // from feather to pro mini A0
  pinMode( analogPin2, INPUT);// from 5v to nc switch to A01 (pulldown resistor)
  pinMode( analogPin3, INPUT);// from 5v to nc switch to A02 (pulldown resistor)

  
  Serial.begin(9600);
}

void loop() {

  ledState = digitalRead(analogPin1); // read feather pin 3.3
   
  int buttonVal1 = (ledState);
  int buttonVal2 = digitalRead(analogPin2);
  int buttonVal3 = digitalRead(analogPin3);




  if (buttonVal1 == 1 && buttonVal3 == 1) { //all the way in. Go out
forwards();

  }
  
  if (buttonVal1 == 1 && buttonVal2 == 0) { // moving out not at the end. Go out
forwards();

  }

 if (buttonVal1 == 1 && buttonVal3 == 0) { // moving out not at the end. Go out
forwards();

  }

if (buttonVal1 == 1 && buttonVal2 == 1) { // All the way out. Stop
Stop();

  }
  
  if (buttonVal1 == 0 && buttonVal2 == 1) { // no signal endstop hit. Go in
 Backwards();
  }

if (buttonVal1 == 0 && buttonVal2 == 0) {// no signal no endstop hit. Go in
 Backwards();
  }
  
if (buttonVal1 == 0 && buttonVal3 == 1) {// all the way in. Stop
   Stop();
  }

if (buttonVal1 == 1 && buttonVal3 == 1) {// Shtf. Stop
   Stop();
  }

  



  //////////
  // print the analog value:
  Serial.print(buttonVal1);
  Serial.print(buttonVal2);
  Serial.println(buttonVal3);
  delay(1);        // delay in between reads for stability
}





//////////////////////////////////////
void forwards()
{
  digitalWrite(enablePin, HIGH);
  digitalWrite(motorPin1, HIGH);
  digitalWrite(motorPin2, LOW);
}

void Backwards()
{
  digitalWrite(enablePin, HIGH);
  digitalWrite(motorPin1, LOW);
  digitalWrite(motorPin2, HIGH);
}

void Stop()
{
  digitalWrite(enablePin, LOW);
  digitalWrite(motorPin1, LOW);
  digitalWrite(motorPin2, LOW);
}
void delaytime()
{
  //bring the pins low for one half second between changes to keep back emf down
}

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

Motors inject a lot of noise into the power supply and can destroy Arduinos if you try to power both from the same supply.

Avoid that situation if possible, or put a good decoupling filter between the motor power and the Arduino power.

Hope this helps. Looking into decoupling circuits. Any direct examples you can offer in links? Thanks for the help.

Hi,
Link doesn't work.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html

It will also tell you how to attach and post an image.

Thanks. Tom.. :slight_smile: