system
March 25, 2009, 10:58pm
1
I have tried to connect the arduino with the h-bridge connected to the dc motor. Using the connections defined by the program below, but its not running the dc motor.
My sketch
#define motorpin1 2
#define motorpin2 3
#define motorpin3 4
#define motorpin4 5
#define enablepin 8
void setup() {
pinMode(motorpin1, OUTPUT);
pinMode(motorpin2, OUTPUT);
pinMode(motorpin3, OUTPUT);
pinMode(motorpin4, OUTPUT);
// set speedPin high so that motor can turn on:
digitalWrite(enablepin, HIGH);
}
void loop() {
digitalWrite(motorpin1, LOW);
digitalWrite(motorpin2, HIGH);
digitalWrite(motorpin3, LOW);
digitalWrite(motorpin4, HIGH);
delay(500);
digitalWrite(motorpin1, LOW);
digitalWrite(motorpin2, LOW);
digitalWrite(motorpin3, LOW);
digitalWrite(motorpin4, LOW);
}
system
March 26, 2009, 9:53am
2
What type of H-bridge are you using?
system
March 26, 2009, 12:07pm
3
Hi Anachrocomputer,
Am using a pololu MD03A 12 volt dc h-bridge. Am not sure of the grd connection from the h-bridge. Am sure that the hardware are okey!
Don't cross post it's not nice.
system
March 26, 2009, 4:20pm
5
did you remember to connect Arduinos ground to the H bridge ground ?
system
March 27, 2009, 12:25pm
6
Hi MikMo,
I have grounded the h-bridge at the arduino power pin and at the same time tappes a +5 from the arduino. Or should i ground it on the digital pin of the arduino?
system
March 27, 2009, 1:40pm
7
Connect the Ground pin of the Arduino to the Ground (or 0V) pin of the H-bridge.
You might also want to follow the advice of another poster (in the other thread) and add another 500ms delay at the end of "loop()".
system
March 28, 2009, 7:19am
8
I have managed to move my dc motor!! The peroblem was simply that i had missed to connect the pwm from the h-bridge to the pwm of the arduino.