Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: fynflood on December 31, 2007, 06:59:17 AM

Title: H-Bridge/Arduino question
Post by: fynflood on December 31, 2007, 06:59:17 AM
I'm a noob, so bear with me  ;D

I'm building a bot with an Arduino. I'll be using 2 dc motors to drive it. I've made 2 h-bridges to control them. My questions is, can the h-bridge handle variable speeds. or is it ON and OFF?

I'm using the 6 transistor h-bridge, I'm not sure if that matters any. I guess I need to know if I should be using a digital output with PWM or not. I'd like it to go faster if there isn't anything nearby.
Title: Re: H-Bridge/Arduino question
Post by: Admin on December 31, 2007, 04:22:37 PM
Quote
I've made 2 h-bridges to control them. My questions is, can the h-bridge handle variable speeds. or is it ON and OFF?
yeap you want to use PWM, which is basically turning your motor on and off really really fast. By varying the on/off ratio, you can effectively vary the speed of your motor.

Quote
I'm using the 6 transistor h-bridge
don't H-bridges have only 4 transistors? :P
Title: Re: H-Bridge/Arduino question
Post by: fynflood on December 31, 2007, 05:27:58 PM
Thanks! Now I've got to figure out how to code the thing ; )

I built a couple of these:
(http://www.beam-online.com/Robots/Circuits/images/H-bridge_free.gif)

They're easy, and I had the stuff laying around
Title: Re: H-Bridge/Arduino question
Post by: airman00 on December 31, 2007, 07:53:32 PM
lol transistors switching on other transistors in your schematic

wat robot are you making?
Title: Re: H-Bridge/Arduino question
Post by: fynflood on January 01, 2008, 01:09:44 PM
lol transistors switching on other transistors in your schematic

what robot are you making?

Just a little guy that moves about, some basic obstacle avoiding. Something wrong with the schematic? It's been around for years.
Title: Re: H-Bridge/Arduino question
Post by: airman00 on January 01, 2008, 01:21:13 PM
the schematic is fine, just you could have used 4 transistors, the 6 transistors makes it slightly easier to use
with 4 u would switch 2 transistors at a time with 6 u would switch one at a time ( that one transistor controlled two others)

its a bit difficult to explain without a drawing, so whatever

the h bridge you made is fine  :)
Title: Re: H-Bridge/Arduino question
Post by: Half Shell on January 01, 2008, 03:58:00 PM
fynflood, you should drop me a message sometime. I've built a few robots doing arduino and am actually planning to build a few more soon.

http://itp.nyu.edu/physcomp/Labs/DCMotorControl

This tutorial uses the Texas Instruments SN75440NE dual h bridge. It has complete schematics and shows you code for arduino to on getting variable control.

I hope this helps. Feel free to contact me for help and I would love to know how the bot comes out.
Title: Re: H-Bridge/Arduino question
Post by: maverick monk on January 02, 2008, 02:47:10 PM
sorry to threadjack, but for simpler programming can you use simple on/off commands???

also,can simple i/o commands be used on pins labled pwm on the arduino board?
Title: Re: H-Bridge/Arduino question
Post by: Half Shell on January 02, 2008, 03:40:01 PM
I'm not entirely sure if I understand what you're asking, but I'll try my best to answer it.

If you want your motor to simply go full power or off, then you can merely use digitalWrite(#, HIGH); or digitalWrite(#, LOW); where # is the pin # you are outputting on the Arduino.

For the pins of the arduino that are labeled as PWM pins, you can declare them as outputs and merely use the analogWrite(#, #); The first # is the pin that you have it plugged into and the second # is an integer from 0 to 255. The PWM will be variable speed.