Preator
Posts: 21
Joined: Sat Jun 21, 2014 11:48 am

Controlling DC motor Using H-bridge

Tue Sep 02, 2014 12:00 pm

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?

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 12:23 pm

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?
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

Preator
Posts: 21
Joined: Sat Jun 21, 2014 11:48 am

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 12:25 pm

I'm intend to use the motors of the magician chassis

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 12:36 pm

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
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

Preator
Posts: 21
Joined: Sat Jun 21, 2014 11:48 am

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 12:39 pm

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?

Preator
Posts: 21
Joined: Sat Jun 21, 2014 11:48 am

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 12:55 pm

And with 4 AA batteries, will I be able to power the 2 motors?

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: Korea

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 1:08 pm

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.

Preator
Posts: 21
Joined: Sat Jun 21, 2014 11:48 am

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 1:15 pm

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?

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: Korea

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 1:33 pm

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.

Preator
Posts: 21
Joined: Sat Jun 21, 2014 11:48 am

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 2:30 pm

Should I take a 4xAA batteries pack (for 6V) or a 9V battery, to power the motors?

User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

Re: Controlling DC motor Using H-bridge

Tue Sep 02, 2014 3:26 pm

The spec. for the Magician motors say maximum voltage 6V, so 4 AA's not 1 9V.
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

Return to “Beginners”