RoboticsGeneral

DC Motor Driver 2x15A Lite with Raspberry Pi

userHead Account cancelled 2017-03-05 07:52:22 4379 Views2 Replies
I purchased the DC Motor Driver 2x15A Lite with the intent of controlling it with a Raspberry Pi. Having some difficulty following the example in the Wiki page regarding PWM control. If I want both motors to go forward, I set the M1 & M2 pins to a digital High, and the E1 & E2 to the PWM speed I want the motors run at correct? If want the motors to run at the same speed in reverse set both M1 & M2 to low? I've tried that and the motors do not reverse direction. When I set the M1 & M2 pins digital low the motors stop turning.
What am I missing? Any help would be greatly appreciated.
Thanks
Brian
2017-08-11 20:52:13 you should try motor driver IC L293D to drive two DC motors. It is very easy to run DC motors with Raspberry pi like see the below code:
Code: Select all
   GPIO.output(m11 , 0)
   GPIO.output(m12 , 1)
   GPIO.output(m21 , 0)
   GPIO.output(m22 , 1)
Here you can assign m11, m12... to any GPIO pin of RPI where you have connected DC motors.
HEre is the dfrobot demo of two DC motors rolling with Raspberry pi and L293D: Raspberry Pi surveillance robot.
userHeadPic jaysharma5
2017-03-08 18:32:13 Hi Brian,

Yes, if you want both motors to go forward, you can refer to this code:
void advance(char a,char b) //Move forward
{
analogWrite (E1,255); //PWM Speed Control
digitalWrite(M1,HIGH);
analogWrite (E2,255);
digitalWrite(M2,HIGH);

The above code the motor will move forward at same speed(0-255), 0 is stop, 255 is max speed. If set to low, both motors will move backward.
userHeadPic Wendy.Hu