Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Warhawk87 on June 17, 2011, 09:03:27 PM

Title: H-Bridge IC Motor Driver not working
Post by: Warhawk87 on June 17, 2011, 09:03:27 PM
Hey guys,

I definitely bit off more than I could chew with my first project, but I started already so I might as well finish!

I am trying to control my motors with an IC H-bridge Motor Driver.  The IC is a L6202.  I wired it up according to the schematic shown on its datasheet which is attached.  I left out Pin 1 and 18 because I didnt know how to set up the sense resistor and I didnt have a capacitor for Vref.  Other than those, everything is hooked up.  The IN pins are connected to my Arduino Duemilanove board, which produces a logic voltage of 3 and decimals.  The enable pin is also connected to my board and in my code that pin is always high.  Source voltage is a 12 volt battery, and the bootstrap capacitors are 35 V 100 uF.

The Dilema: I apply a logic high to IN1 and get no voltage out of OUT1.  While experimenting, I found that applying a logic high to Vref makes it work!  That didnt make any sense to me, so I hope you can clear that up.  Also, i am using PWM pins for my motors, but the speed doesnt seem to change as I change the values in the code.  I hope this isnt a shortcoming of using a motor driver.

Thanks for your help!
Title: Re: H-Bridge IC Motor Driver not working
Post by: Soeren on June 19, 2011, 08:10:24 PM
Hi,

I left out Pin 1 and 18 because I didnt know how to set up the sense resistor
The sense resistor pins are the ground returns for the motor current.
If you don't use sense resistors, you need to connect these pins to ground (0V).
Title: Re: H-Bridge IC Motor Driver not working
Post by: Warhawk87 on June 19, 2011, 08:24:29 PM
Thanks for your reply!

I'm still wondering why it worked when a logic high was applied to Vref...doesn't make sense to me...and how would I go about using the sense resistor if I wanted to?

Thanks again!
Title: Re: H-Bridge IC Motor Driver not working
Post by: Soeren on June 19, 2011, 09:13:44 PM
Hi,

[...] how would I go about using the sense resistor if I wanted to?
It depends on what you want the signal to go to, but let's assume a small signal transistor (2N3904, BC547 etc.) and that the max. motor current should be 0.2A (just an example, plug in your own numbers).

To open, the transistor needs its basis to go around 0.65V (+/- ~50mV) positive, referred to its emitter (which should be at 0V.
To develop 0.65V at 0.2A, you need a resistor of: 0.65/0.2 = 3.25 Ohm
Nearest standard value is 3.3 Ohm.  0.65V / 3.3 Ohm = 0.197A  (around 1.5% low, but much better than component tolerances).

The (open) collector can be read by a digital I/O pin with a pull-up resistor and the program will have to either shut down the motor or decrease the PWM duty cycle.

If you want to read the current by an A/D input, you could calculate the resistor for erg. 0.2V at max. current and amplify the signal with an op-amp (Av=25) for a 0 to 5V signal.

In each case, the resistor should be rated for the power it has to dissipate. In the first example it's 0.65V * 0.2A = 0.13W and in the second, 0.2V * 0.2A = 40mW - a 1/4W resistor will suffice in both cases, but you have to calculate this with your own numbers - if eg. the max current is 2A at 0.65V, you'll need a 1.3W or larger resistor, which means a 2W resistor minimum.
Title: Re: H-Bridge IC Motor Driver not working
Post by: Warhawk87 on June 20, 2011, 11:46:16 AM
Thank you very much! I love learning new things  ;D ill test it out tonight and post back if I still have trouble.