Page 1 of 1

Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 12:00 pm
by Preator
Hello,

I'm trying to use a h-bridge to control a DC motor with my raspberry pi. I don't want to use an external power supply, so I would like to power the motor with my pi directly, but in this case I don't know where to connect the Vcc2 (I've got the SN754410 H bridge). Should I connect it directly on the 5V?

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 12:23 pm
by Hove
VCC2 connects to the power required to drive the motors

The Raspberry Pi almost certainly cannot supply your H-bridge + motors with enough current unless the motors are extremely low power, at which point, you probably don't need an H-bridge.

If you connect VCC2 to the Raspberry Pi 5V pin, you'll probably blow the fuse, or the power supply or the Raspberry Pi or all three.

What kind of motors do you intend to use?

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 12:25 pm
by Preator
I'm intend to use the motors of the magician chassis

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 12:36 pm
by Hove
Assuming you mean these: https://www.sparkfun.com/products/10825

Connect VCC2 to the batteries directly, NOT via the Raspberry Pi - the current needed by the motors, although not high, is still enough to blow the fuse / fuse the RPi.

VCC1 is the voltage used to manage the H-Bridge
VCC2 is the voltage switched by the H-Bridge to power the motors

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 12:39 pm
by Preator
Yes, I mean these.

But the battery pack is for an arduino. Do you think it is possible to denude the cables of the battery pack so I can connect it directly on my breadboard?

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 12:55 pm
by Preator
And with 4 AA batteries, will I be able to power the 2 motors?

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 1:08 pm
by ame
Preator wrote:And with 4 AA batteries, will I be able to power the 2 motors?
Yup. I used to teach robotics with Arduino and the Magician chassis. I used two of these packs (4 x AA) per robot. One pack powered the Arduino. The second pack powered the motors. You can get about 4 or 5 hours of roboty goodness from a fresh set of motor batteries.

Using two supplies in this way is important. If there was only one pack then after a while the Arduino would brown-out and reset when the motors started. With a separate pack powering the Arduino, it can keep running even when the motor batteries are low. The advantage of this is that the Arduino can detect this condition and flash an LED or something to show the motor batteries should be replaced.

It's even more important for a Pi. You do not want your Pi browning-out and corrupting its SD card when the motors are turned on.

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 1:15 pm
by Preator
Ok so I will power the raspberry pi with an external battery (like this one) and a battery pack.

I want to connect other sensor too (like an ultrasonic sensor). Can I power the 2 motors and other sensors with a 4 AA battery pack?

And can I in some way use the battery pack given with the magician chassis?

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 1:33 pm
by ame
If you power the ultrasonic sensor from the motor power supply you will run into the same problem. When the motor batteries are low the sensor will stop working. Also, electrical noise from the motors might affect the sensor. You could stop the motor and then take a sensor reading, but that is tedious.

Luckily, a typical ultrasonic sensor uses little power, so you can power it from the Pi 5V output.

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 2:30 pm
by Preator
Should I take a 4xAA batteries pack (for 6V) or a 9V battery, to power the motors?

Re: Controlling DC motor Using H-bridge

Posted: Tue Sep 02, 2014 3:26 pm
by Hove
The spec. for the Magician motors say maximum voltage 6V, so 4 AA's not 1 9V.