Author Topic: Surge capacitor for H-Bridge  (Read 5874 times)

0 Members and 1 Guest are viewing this topic.

Offline krichTopic starter

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 0
Surge capacitor for H-Bridge
« on: June 05, 2008, 05:09:10 PM »
I'm building a motor controller based loosely on the H-Bridge tutorial on this site.

I see that there's a 10,000uF capacitor on the 24VDC power source, labelled "stops voltage spikes".  The way I understand it, this capacitor gives the motors a little extra juice in the event of a spike in demand (e.g. acceleration or reverse in direction).

Now, here's the question.  My motors are 12VDC and about 2.5A max stall current, much lower requirements than the tutorial.  How big of a capacitor should I design into my motor controller?  More specifically, is there some rule of thumb on sizing this particular capacitor?  One reason I'd like to scale it back, if possible, is that I don't have a 10,000uF capacitor in my parts bin.  I know I have a 2200uF, and maybe even a 4700uF.

On a related topic, should the cap be rated for a much higher voltage than the usual 1.5x input voltage to accommodate the high reverse voltage spikes coming from the motors?

Ultimately, I'll have a dampening routine so that there won't be instantaneous wide shifts in direction or velocity.

Thanks!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Surge capacitor for H-Bridge
« Reply #1 on: June 07, 2008, 05:35:15 PM »
Ideally, you'd want an infinite capacitance in the capacitor with infinitely fast charging/discharging capabilities.

However, as these features approach infinity, so does the cost and size of the capacitor.

So its a question of 'what capacitor is too big for my circuit' and 'how much smoothing does my exact motor(s) need'.

You'll never really know unless you build the system and put an oscope on it . . .

Offline krichTopic starter

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 0
Re: Surge capacitor for H-Bridge
« Reply #2 on: June 10, 2008, 11:29:24 PM »
Thanks Admin.  I did exactly what you suggested and built the circuit.  I'm running it off a 12V, 1.2A power supply on the bench.  I don't have a scope yet, but I have one on order.  Interestingly enough, I found that, experimentally, there was not much "visible" benefit to putting a capacitor on the 12V bus, but I did need to put a largish capacitor on the 5V bus to keep my MCU from browning out when starting up the motors or reversing/braking suddenly.  I'll definitely take a look at both power buses with the scope when it arrives.

Anyway, now I have the controller board built (I cheated and used an L298   ;D ) and have it hooked up to my AVR baseboard.  I am using hardware based phase correct PWM to control forward and reverse.  I'm told that on the L298, it's better form to use PWM on the inputs rather than on the enables, so that's what I've done.  Not a huge deal since the atMega168P has A and B channels on its timers.

Everything seems to be working great, but I've got one thing that's been plaguing me from the beginning and I'm not even sure it's really a problem.  It seems that my motors don't want to start turning until about 40% duty cycle on the PWM.  Is this normal?  When I get my scope, I'll be looking at my PWM signal to be sure it's all in order, but I can't decide whether I need to worry about this or not.  Its very noticeable when I turn on the smoothing algorithms.  When it traverses from 40% forward to 40% reverse, there's a big pause (relatively speaking) where  the motors aren't turning at all.

Thanks for your help.




Offline Rebelgium

  • Supreme Robot
  • *****
  • Posts: 637
  • Helpful? 0
  • It's called the future ... We like it here
    • orgcrime.net
Re: Surge capacitor for H-Bridge
« Reply #3 on: June 11, 2008, 12:46:31 PM »
I'm told that on the L298, it's better form to use PWM on the inputs rather than on the enables, so that's what I've done. 



Are you sure about that? Where did you hear this?
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline krichTopic starter

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 0
Re: Surge capacitor for H-Bridge
« Reply #4 on: June 12, 2008, 12:37:07 PM »
I'm told that on the L298, it's better form to use PWM on the inputs rather than on the enables, so that's what I've done. 



Are you sure about that? Where did you hear this?

Well, I can't exactly remember.  I might be able to find it in my many bookmarks on L298.  I remember it saying roughly, "Most folks use PWM on the enables, but the proper way is to use PWM on the inputs."  Anyway, I took a closer look at the block diagram on the datasheet, it seems to be a moot point, really.  The inputs and the enables are tied together with an AND gate before going into the transistors on the h-bridge, so I'm guessing it doesn't really make much of a difference.  I guess the way I did it caused me a bit more coding.  I'm going to be doing a second PCB with some enhancements, so maybe I'll try PWM on the enables this time.
« Last Edit: June 12, 2008, 12:38:31 PM by krich »

paulstreats

  • Guest
Re: Surge capacitor for H-Bridge
« Reply #5 on: June 12, 2008, 05:02:45 PM »
This is quite true.

Its far easier to use pwm on the enables, but using it this way also takes time for the device to switch on the inputs (small as it seems it really can count). Also the fact that you are constantly switching the gate/base on and off on the transistor will cause it to heat up much faster

Also you mentioned that your motors dont run until you reach about 40% on the duty cycle. This is to do with the motors and the quality/efficiency of them,  any less than 40% would produce too little power at 1 sitting to make your motors do anything. The solution is to spend an awful lot on efficient motors or the best option is just to set the 40% as the lowest speed in your programming. Remember that cheap motors are used in toys that go from 0 to full speed and arent expected to operate precisely.

Offline krichTopic starter

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 0
Re: Surge capacitor for H-Bridge
« Reply #6 on: June 12, 2008, 09:42:02 PM »
The more I discuss these things with the community, the more I learn.  You see, I didn't even think to look on ST's website for an Application Note until the whole Enable vs. Input question came up.  Glad it did, because even though both ways are valid, there is a apparently a good reason to use one over the other depending on your needs.

From the App Note located here:

Quote
For undirectional drive with a single channel the PWM control signal can be applied to either the
channel input or the appropriate enable input. 

>snipped discussion on unidirectional drive<

The situation is different for bidirectional motors driven by a bridge. In this case the two alternatives have different effects. If the channel inputs are driven by the PWM signal, with suitable logic, the recirculation path is through a diode, the motor and a transistor (figure 7a), givind a slow decay. On the other hand, if the enable input is controlled the recirculation path is from ground to supply through two diodes and the winding. This path gives a faster decay (figure 7b).

Now, I'm sure the solution to my question is contained in these words.  I will be studying both Figures 7a and 7B tonight to be sure I understand it theoretically.  Then I'll be doing some experimentation to see if makes any difference in my application.

Thanks for the validation Paul.  Looks like I've got my hands on some cheap motors.  Actually, they WERE pretty darned cheap.  That's why I got them.   ;D  Anyway, I've compensated for their lack of movement in the code and have a nice smooth transition from forward to reverse with only a very slight jerk when the motors reverse which will probably not be noticeable at all when I get wheels and a load on them.

My next task is to try to do some current sensing.  Oh joy.  I have no idea how that's done, so it's off to Google to figure it out.  My guess is I need a low resistance, high power resistor on the current sense pins.  Then take the voltage reading off the resistor into an OpAmp to boost it to a 0-5V range.  That's as much as I got off the datasheet when I read it earlier.  Wish me luck.  Actually, you'd better wish my L298 luck too.  It's a miracle I haven't smoked it yet.   ;)
« Last Edit: June 12, 2008, 09:46:07 PM by krich »

 


Get Your Ad Here

data_list