Help: Power drop on Servo Controller

I have built a servo controller around a PIC Microcontroller. The servos are pwered by a 6V NiCad battery pack that also powers the PIC through an
LM1117.
Unfortunatly, as soon as I get some load on the servos, the PIC resets due to the poer drop.
How can I make sure that the PIC will always get sufficient DC, so it won't reset?
Adding a separate battery for the PIC is not an option (space constraints).
Any help is greatly appreciated.
Matt
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Matthias Melcher wrote:

servos are

resets due

won't
constraints).
I don't know what an LM1117 is [LM117 ???], but most voltage regulators require at least 2v of overhead minimum. IE, that's 5+2 = 7v "minimum". So, things to try:
a. use LDO v.reg. b. use LDO v.reg = 4v to drive the PIC Vcc buss at 4vdc. c. For not too much extra space, add a 6th AA or AAA cell in series with the other 5 to boost the power to the v.reg up to 7.2v, and also use an LDO v.reg or else a 4v v.reg for the PIC.
Item c. is similar to what I did on one of my servo-driven bots, and it worked fine.
- dan michaels www.oricomtech.com =====================
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

The LM1117 is a low dropout voltage regulator. http://www.national.com/pf/LM/LM1117.html
Good point though that regulating 6V to 5V is somewhta critical. Since the PIC runs down to 3.2V, I used the same regulator in the 3.2V version, and while the servos are happy with 3.2V on the PWM line (digital servos), I still get PIC resets when all 16 servos move at once.

The sixth cell is a good idea, however the servos are 4.8 to 6 Volts. I'll give it a shot, but in the long run, I'd have to change the chassis. I don't like dangeling batteries ;-)
Matt
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Matthias Melcher wrote:

Matt:
In general, you want to keep your power draw equipment (e.g. servos) off of the power supply that is driving your logic circuits (e.g. microcontrollers.) Two battery packs are a good way to do that. However, you have said that you do not have the room for the second battery pack.
It turns out that servos can be directly connected to your battery pack. So hook the servos up directly and run the microcontroller off of a low drop out voltage regulator like the LM2940-5. It can live with no more than approximately 5.5 volts of battery power. Be sure to plant a .1 uF decoupling capacitor right next to your PIC to save it from transients. Also, do not scrimp on the voltage regulator capacitors; use some nice tantalums.
Since I am paranoid, I drive the servo pulse signal through some open collector circuits (a PN2222 and a pull up resistor, with a base current limit resistor). That way the servo pulse signal always swings from 0.2V up to the full battery voltage. Some people do not bother with this step, since many servos are perfectly happy to eat signals that swing from 0 to 5V even though the servo is running at a higher voltage. It is your choice.
I know that you don't have room for two battery packs, but for other people reading the list -- if you have the room for two battery packs, use two; you will tend to have fewer problems. If you are really careful, you can get it to work all off one battery pack; however, lots of people are beginners and the cost of an extra battery pack is well worth the hassles that will be avoided.
My $.02,
-Wayne
P.S. To contact me directly, send mail to Wayne .at. Gramlich @dot@ Net.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes, I am afraid it'll end up beeing just that. Metal work coming up ;-)

Did that.

I added a .1uF and a 10uF electrolyte right on the power lines of the PIC, and a 10uF right in front and right after the voltage regulator, to no avail. No tantalums though.

Yes, that is a pretty good practice. I do use a pullup to remove the power-on-jerk and another resitor in series to limit current, but in this particular robot, I use digital servos which draw a few uA on the PIC's.
Thanks for the informaton
Matt
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Matthias Melcher wrote:

You already got some good replies, but I wanted to add just one thing: is this really a *six* volt nicad pack, or is it just 4.8 volts? Remember that nicads put out 1.2 volts nominal per cell, not 1.5 volts, so a pack of four cells will be only 4.8 volts. Even with a low dropout regulatoryou're getting pretty close to brownout level voltages for an MCU, and any surge to the servos may dip the terminal voltage below a magic threshhold.
I know Brian Dean, who designed the MAVRIC controller, has some tricks he does to help assure proper voltage levels on his AVR-based boards. He's a regular contributor here, so you might drop him a line.
-- Gordon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes, I have five NiCad cells, giving me 6.2V when they are fully charged.

Yes, clearing the Brownout detection bit helped a little. The PIC crashes less frequently, but if it does, it usually needs a power cycle to awake again. Maybe I should simple rewrite the PIC software to deal gracefully with brownouts... .
I don't have a basic stamp here to check, but I will look at more schematics... . The problem seems to be the number of servos sucking at the battery. 16 seems to be too much.
Thanks!
Matt
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Matthias Melcher wrote:
. The problem seems to be the number of servos sucking at the

Oh man, 16 servos, that's a lot of juice. If this is a walker, and regular 44 oz-in servos, then prolly > 2.5 Amps average, to > 4.5 amps peak. If bigger torque-ier servos or digital, then lots more Amps than that.
Given this humungus load, a couple of other things to try besides the drop-out ckt on the v.reg are ....
1. some large filter caps on the servo power buss right where the battery connects. All of those wires [including those from the battery to the controller] have a lot of inductance and you're prolly getting a lot of gnd and power buss bounce.
2. secondly, don't pulse all the servos simultaneously, rather pulse them in sequence, like the r/c receivers do. If you look at the recent thread on servo internal pulses/etc, you'll see that Gordon McComb discovered that power is only applied to the internal motors in the servos for a short period [2-5 msec or so] after they receive the control pulses. The rest of the time, there is no voltage applies across the motors. If you pulse all the servos at the same time, then the power surges will all superimpose.
- dan michaels www.oricomtech.com ====================
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Matthias Melcher wrote:

Forgot to mention you might also look to see what products like the Basic Stamp 2 use. Seems to me they use an ultra-low drop out regulator (<0.25 volts?), because they allow the use of nicads on the BOE Bot, which is designed to support up to four servos.
Just looked up their schematic...note the honking 15 uF cap across the voltage regulator output. That can't hurt the situation. The regulator is a National LM2936.
-- Gordon
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Matthias Melcher wrote:

Depending on the power constraints of the PIC and if the voltage drop is momentary and not constant, you can use a diode and a capacitor:
Connect a diode between the power supply and the PIC, you'll get about 0.6 volts drop over the forward biased diode. Make sure you put a big enough capacitor on the PIC.
When the voltage drops from the motor, it will drop below the voltage stored in the capacitor (which will continue to power the PIC circuit), once the diode is turned off, your PIC power is effectively isolated from the battery drop. When the battery voltage rebounds, it will again forward bias the diode and charge the cap.
The voltage drop under load is based on the internal resistance of the supply. NiCad batteries have a pretty low internal resistance and typically behave well in this mode. I would say that your batteries need to be recharged, replaced, or that there is some source of resistance between the batteries and the circuit.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Matthias Melcher wrote:

The servos use too much power in starting, the voltage drops, the PIC resets.

I *always* use a separate battery.

You can use smaller batteries.
If you can't, use bigger caps on both the motor side and the PIC side to help reduce the transients. -- D. Jay Newman http://enerd.ws/robots /
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
D. Jay Newman wrote:

Exactly
It's a good idea in theory, but it makes the power system more complex.

You still need to manage the charging differently. Using two batteries is like partitioning your hard disk (on Windows) to C and D. You will eventually run into the problem when C+D would be big enough, but neither C not D has enough space.

Pr, as I said, add diode isolation and capacitor decoupling to the PIC.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
mlw wrote:

This really should do the trick for most hobby-type servos. I would definitely go this route prior to using a separate supply.
I'll frequently use a separate battery for larger motors because I'm lazy, but for servos you probably don't have to do this -- and really, you can frequently get away with not doing it for bigger motors.
If you DO go with separate supplies, keep in mind that the servo control line and servo power supply will need to share a common ground.
--
(Replies: cleanse my address of the Mark of the Beast!)

Teleoperate a roving mobile robot from the web:
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
the Artist Formerly Known as Kap'n Salty wrote:

Unless you optically isolate them!!! :-)

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
mlw wrote:

The servo control line (AKA "signal" ) is the line actually going into the servo -- a low on this line is taken in reference to the black gnd (usually labeled "negative") wire.
Obviously, whatever is pulsing the signal line itself has to do it using some kind of isolation scheme if separate supplies are used. Personally, I'd just go with the cap/diode method, although maybe there's an upper limit on the number of servos this works reliably with. Dunno.
--
(Replies: cleanse my address of the Mark of the Beast!)

Teleoperate a roving mobile robot from the web:
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
: I have built a servo controller around a PIC Microcontroller. The servos are : pwered by a 6V NiCad battery pack that also powers the PIC through an : LM1117.
: Unfortunatly, as soon as I get some load on the servos, the PIC resets due : to the poer drop. : How can I make sure that the PIC will always get sufficient DC, so it won't : reset? : Adding a separate battery for the PIC is not an option (space constraints). : Any help is greatly appreciated. : Matt
Guard the power line into the PIC circuit. The easiest way is to put a Schotkey diode between the battery back and the input to the regulator. Now, put a big electrolytic cap on the line that goes from the cathode of the diode to the input of the regulator, the size depends upon the current used on the PIC board, my guess is that 100uf to 470uf should be enough to survide the dv/dt power needs of the controller. Now use an LDO regulator, one that only needs .5V or so above your Vcc needs. This will survive a couple ms voltage sag on the battery side. Now, you need to make sure that you don't have EMI seeping into your board and messing up your oscilator circuit. To help with that "guard" your crystal pads with a copper flood on both sides of the board and heavily bypass your Vcc line. Another good idea, if extreme, is to put a choke on the power lines to the processor and make sure power enters that processor "side" of the choke at exactly one point, same with grounds to the processor.
These measures aren't too extreme and will create a more robust circuit.
have fun, DLC
--
============================================================================
* Dennis Clark snipped-for-privacy@frii.com www.techtoystoday.com *
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Wow, thanks for all the help from the NG. So putting it all together, I got it checked in the skope and working! Yeah!
So here's a summay:
Problems: - regulating 6V down to 5V is a bad idea, because of voltage drop. - running up to 24 servos simultanously on a walker robot puts huge strain on the battery, each servo sucking up to 1Amp! - noise!
Limitations: - due to space and simplicity in the charging unit, it is not possible to have a second battery
Solutions: - the voltage regulator runs through a filter, then a low drop diaode, then a cap, then the regulator, then two more caps - Connect the regulator as close to the battery as possible, don't run the lines by a few motors first (stop thinking digital! Wire is always a resistor and a cpacitor!). Clean up the layout! - Worst case, use a switching regulator that even pumps 3V up to 5V if need. - a 300Ohm resistor on every servo data line in series keeps the noise from the servos to the PIC low (not neede for digital servos) - 3k pullup on the servo data line keeps the servos from jerking all at onece when power is switched on - I change the software to send pulses to the servos in groups of 4 with 2ms delay from group to group, so that there is only on high load (leg) servo per group. This spreads battery load over the 20ms cycle. - with digital servos, the load on the battery is even greater. On the other hand, they are happy with 3.2V pulses. So in that case, I use a 3.2V regulator which runs more stable on 6V battery anyways.
Problem solved! Thanks for all the help!!
20uH +---+ Bat ---UUUU---|>|--o--|reg|--o---o--> pic | +---+ | | === | === == 470uF| | 10u| |.1uF GND ---------------o----o----o---o--> GND
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Wed, 4 May 2005 04:14:33 +0200, "Matthias Melcher"

I use a diode and capacitor to isolate my servo controller from momentary voltage drops. There is a basic schematic at the bottom of the below link. The diode acts somewhat like a check valve preventing the capacitor from discharging back to the servo motors when the voltage drops low. The diode I used has .7v voltage drop, so you might want to use a type with a lower voltage drop and a really big capacitor. You might be able to use an NPN transistor as a low voltage drop diode if needed.
http://www.geocities.com/zoomkat/ezservo.htm
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.