Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: codeblue on April 10, 2010, 06:13:16 PM

Title: Designing simple h-bridge but question on changing current direction
Post by: codeblue on April 10, 2010, 06:13:16 PM
ok so here is what im trying to do basically i want to use a transistor to build and h-bridge... but i want to be able to switch the direction the motor is running too... so my question is there a way to change current with out having to use two digital outputs on microcontroller, and having two use two different transistors going to the power source per motor
Title: Re: Designing simple h-bridge but question on changing current direction
Post by: corrado33 on April 12, 2010, 07:30:58 AM
For an H-Bridge, four transistors are needed.  Hence the "H".  The motor is in the middle, and the four transistors are at the corners of the H.  You need two outputs on your microcontroller to control it correctly, unless there is some kind of magic H bridge that works using less parts and if there was, I'm pretty sure everybody would know about it.  Check the H-bridge tutorial on this site, it's really useful.  http://www.societyofrobots.com/schematics_h-bridgedes.shtml (http://www.societyofrobots.com/schematics_h-bridgedes.shtml)
Title: Re: Designing simple h-bridge but question on changing current direction
Post by: chelmi on April 12, 2010, 08:12:09 AM
http://www.societyofrobots.com/member_tutorials/node/161 (http://www.societyofrobots.com/member_tutorials/node/161)
Title: Re: Designing simple h-bridge but question on changing current direction
Post by: corrado33 on April 12, 2010, 04:03:50 PM
http://www.societyofrobots.com/member_tutorials/node/161 (http://www.societyofrobots.com/member_tutorials/node/161)

Hmmm.. cool but you still need to use two MCU outputs, which I think is that the OP wanted to avoid. 
Title: Re: Designing simple h-bridge but question on changing current direction
Post by: chelmi on April 12, 2010, 04:13:06 PM
http://www.societyofrobots.com/member_tutorials/node/161 (http://www.societyofrobots.com/member_tutorials/node/161)

Hmmm.. cool but you still need to use two MCU outputs, which I think is that the OP wanted to avoid. 

On a "basic" setup you need three (two for direction and one for speed), I thought the OP wanted to avoid the two digital pin for direction.
But maybe I misunderstood :)
Title: Re: Designing simple h-bridge but question on changing current direction
Post by: corrado33 on April 12, 2010, 04:45:24 PM
http://www.societyofrobots.com/member_tutorials/node/161 (http://www.societyofrobots.com/member_tutorials/node/161)

Hmmm.. cool but you still need to use two MCU outputs, which I think is that the OP wanted to avoid. 

On a "basic" setup you need three (two for direction and one for speed), I thought the OP wanted to avoid the two digital pin for direction.
But maybe I misunderstood :)


Oh!  Maybe I misunderstood.  Thanks for clearing that up!
Title: Re: Designing simple h-bridge but question on changing current direction
Post by: Soeren on April 12, 2010, 06:14:57 PM
Hi,

i want to be able to switch the direction the motor is running too... so my question is there a way to change current with out having to use two digital outputs on microcontroller, and having two use two different transistors going to the power source per motor
An H-bridge is an H-bridge is an H-bridge (but not a rose), so no, but you can control both the direction and speed of a motor by a single (signal) line (+ power and ground). You need a motor controller which is the functional equivalent of a servo, changing speed instead of angle.

If you just don't wanna shell out for 4 power MOSFETs, a single and relay will go a long way (with the associated "glue" circuitry) and it will need 2 signal lines, one for PWM and one for direction. This circuit (http://That.Homepage.dk/PDF/PWM+Relay_4_Motor_Ctrl.pdf) shows how that can be done.

Some people (a lot of them in fact) dislikes the relay, but it keeps you from snuffing 4 power MOSFETs in a single moment of distraction while writing your code and you shouldn't ever go directly from forward to reverse at any speed above idle anyway, unless your bridge are designed for serious over voltage (and current), as power braking will give.

That aside, a relay makes the circuit much simpler as well (it can be simpler than the one in the schematic if it isn't going to handle much power).
Title: Re: Designing simple h-bridge but question on changing current direction
Post by: codeblue on April 13, 2010, 07:13:17 PM
ok... i see what your saying... its no problem using 4 MOSFETS just triying to see if it required 4.... I should have looked up a schematic before posting.. dumb me