Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | Servo & logic power

Discussion forum for the BasicX family of microcontroller chips.

Servo & logic power - Tom Becker - Sep 24 18:58:09 2006

For a crude prototype I used an alkaline 9v battery and regulated that
down to 5v with a 7805. That sufficed (six hours, anyway) while the
project only drew 30mA.

I needed to add a single standard RC servo; I didn't expect a 9v battery
to be able to supply the servo (at 5v) - and it, mostly, didn't,
resetting the processor more often than not.

The servo will not be moving much, nor frequently; it will mostly idle,
drawing a few milliamps, but when motion is required it'll need 300mA or
so, in spikes. My plan is to use six alkaline AAs and take 6v directly
from the bottom four cells for the servo (sharing ground, of course),
while regulating all six cell's 9v to 5v for logic.

Anything wrong with that?
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: Servo & logic power - Don Kirby - Sep 24 20:37:07 2006

I don't see any great flaws in your plan. You could also run the
whole thing on just 4 cells (6 volts), and skip the 7805 altogether.
The BX does have a built in regulator after all.

Obviously, if you need to power other circuitry as well, you'll have
to keep the 7805

-Don

--- In b...@yahoogroups.com, Tom Becker wrote:
>
> For a crude prototype I used an alkaline 9v battery and regulated that
> down to 5v with a 7805. That sufficed (six hours, anyway) while the
> project only drew 30mA.
>
> I needed to add a single standard RC servo; I didn't expect a 9v
battery
> to be able to supply the servo (at 5v) - and it, mostly, didn't,
> resetting the processor more often than not.
>
> The servo will not be moving much, nor frequently; it will mostly idle,
> drawing a few milliamps, but when motion is required it'll need
300mA or
> so, in spikes. My plan is to use six alkaline AAs and take 6v directly
> from the bottom four cells for the servo (sharing ground, of course),
> while regulating all six cell's 9v to 5v for logic.
>
> Anything wrong with that?
> Tom
>



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Servo & logic power - Tom Becker - Sep 24 22:20:05 2006

> ... You could also run the whole thing on just [] 6 volts, and skip
the 7805...

Sure, but I think not very effectively.

The 78L05 on the BX-24p needs 7v on Vin, so I'm using a BX-24 on this
project since it has a 2951 LDO regulator, permitting Vin as low as 5.5v.

According to http://www.energizer.com, their AA alkaline cell can
provide 2850mAH from 1.58v to 0.9v, a 680mV range. Four fresh cells
make a little more than 6.3v; six cells make ~9.5v. Four cells will
allow the regulator to drop out if each cell loses only ~200mV.
Assuming the energy is released linearly, that's only about 30% of the
cell capacity, so 70% of the battery would need to be discarded.

Six cells will provide 5.4v at depletion, only 12.5mV per cell below the
2951 specified dropout voltage, so almost the entire cell capacity is used.

That doesn't consider the unregulated servo load (7.5mA@6v + motion),
nor regulator heat losses which will be greater for the higher Vin, but
I expect six cells should considerably outperform four, even if 50% more
expensive.

I've got it clip-leaded on the bench now. The static project draws
~55mA, so 48 hours should use ~2700mAH and still provide regulated 5v
for logic and a usable servo voltage of ~3.6v. Time will tell.

Thanks for the feedback.
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Servo & logic power - Tom Becker - Sep 24 22:52:55 2006

The 2951 can provide sufficient current for the entire project,
thankfully, so I did remove the 7805, which wouldn't regulate at 5.5v,
anyway. The 2951 runs only slightly warm , ~110F, when providing about
100mA total.
Tmo



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Servo & logic power - Tom Becker - Sep 29 0:49:45 2006


> I've got it clip-leaded on the bench now.

Well, I've run through four sets of cells. The scheme seems to work
well for this application. Both the regulator minimum voltage and a
usable servo voltage are available until just before battery depletion.

As the regulator gives up, the processor would continue to run below
5v but, since the analog inputs are no longer accurate - and the
project needs them - code detects less than 5.6v on the BX-24
regulator input, while the machine is still healthy, to enter a
shutdown mode. That saves the machine state by writing a few
persistent variables and sleeps. Very nice.
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Servo & logic power - Tom Becker - Sep 29 9:43:34 2006

In an attempt to predict imminent battery depletion, I tried
differentiating the battery voltage samples to determine the discharge
slope. That didn't work, principally because the 10-bit resolution of
the BX-24 ADC is too small unless the sample period is quite long.

Since in this application the bottom four cells are loaded slightly more
than the top two cells, those cell voltages start about 1% below the
upper two cells. I found that sampling both battery stack voltages (~6v
and ~9v) and normalizing them to a per-cell voltage for comparison,
reveals an apparent slope instantaneously.

The per-cell voltage ratio remains relatively constant [it is only 0.6%
less (-1.6%) as I write this, 16 hours into a set of batteries] until
approaching depletion, as the discharge slope steepens. Using
alkalines, at depletion the lower cells are about 25% below the upper
ones, in this instance.

FWIW.
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Servo & logic power - Don Kirby - Sep 29 18:06:36 2006

Thanks for the update Tom. I always enjoy hearing about someone elses
project evolutions and results.

Have you tried running it from NiMH or NiCd batteries yet? How will
the application deal with the different discharge characteristics of
other battery chemistries?

-Don

--- In b...@yahoogroups.com, Tom Becker wrote:
>
> In an attempt to predict imminent battery depletion, I tried
> differentiating the battery voltage samples to determine the discharge
> slope. That didn't work, principally because the 10-bit resolution of
> the BX-24 ADC is too small unless the sample period is quite long.
>
> Since in this application the bottom four cells are loaded slightly
more
> than the top two cells, those cell voltages start about 1% below the
> upper two cells. I found that sampling both battery stack voltages
(~6v
> and ~9v) and normalizing them to a per-cell voltage for comparison,
> reveals an apparent slope instantaneously.
>
> The per-cell voltage ratio remains relatively constant [it is only 0.6%
> less (-1.6%) as I write this, 16 hours into a set of batteries] until
> approaching depletion, as the discharge slope steepens. Using
> alkalines, at depletion the lower cells are about 25% below the upper
> ones, in this instance.
>
> FWIW.
> Tom
>



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Servo & logic power - Tom Becker - Sep 29 22:22:52 2006


> Have you tried running it from NiMH or NiCd batteries yet?

No, I deliberately chose alkalines because they don't have the sharp
knee that NiCd and NiMH cells exhibit. An almost flat voltage plateau
before the knee gives little indication before the cell voltage pretty
abruptly falls from about 1.25 volts (NiCd) or 1.1v (NiMH), although the
latter is not as sharp. I want to use as much of the battery as
possible, and be in control to the end so the machine can do an orderly
shutdown.

Reconsidering now, five NiCd or NiMH cells should drive both the
processor regulator and the servo quite well, but the window with NiCds
is small (7.0v to 6.5v); NiMH cells droop more (7.0v to 5.5v). I'll
play with sensing the slope of a set of NiMH cells and see what comes of
that.
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Servo & logic power - Tom Becker - Oct 2 10:23:23 2006

> ... sensing the slope of a set of NiMH cells...

Incredible! Five new Duracell 2650mAH AAs ran the project for 29
hours at ~100mA, and supplied ~6.9 to 5.595v before suddenly - within
six seconds - showing a slightly higher discharge slope then
collapsing to ~4v. Six seconds after 29 hours! Like a switch.

The discharge slope started at ~-40uV/second and lessened to
<-10uV/sec after about eight hours. It stayed there - a negative but
virtually flat slope - until it started steepening after 24 hours or
so. The last several hours showed a slope of ~-100uV/sec; in the last
few seconds, it reached ~-200uV/sec and then rapidly increased; the
current essentially turned off. These dV/dT rates are detectable by a
BX-24 and its 10-bit ADC but my code filters and differentiator are
slow (~120 seconds), too slow to see this knee, I think.

The discharge rate and the cell voltage, though, appear to be well
related. With these cells, -100uV/second at 100mA corresponds to
about 1.150v per cell. I'll be looking for 5.750v (5 * 1.150) this
time, which should predict the knee about 20 minutes later.

More after another few runs.
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Servo & logic power - Tom Becker - Oct 5 14:52:14 2006

> ... sensing the slope of a set of NiMH cells...

Well, I am now a little more battery-smart. I've learned that cell
voltage, alone, is insufficient to determine the battery
state-of-charge, and voltage slope is also insufficient, although each
varies usefully according to charge, load and temperature.

A proper method is to integrate the battery current, or
Coulumb-counting. The integration of discharge current decreases the
available energy (in mAH) directly over time. For example, if a
healthy battery starts out holding 1000mAH, and it is discharged at
an average rate of 100mA for three hours, the battery can be expected
to retain ~700mAH. That's the ideal, of course; there are other
losses, and age degrades.

Maxim's battery management parts sense the pack current by measuring a
microvolt-level voltage across a very-small shunt resistor that's in
series with the battery. From a known state, integrating that value
will closely track the energy currently in the battery, producing a
meaningful fuel-gauge.

Still, if allowed to reach "Empty", the sharp knee is unforgiving;
believing that a 50% charge is available is comforting, but believing
that 5% is available is less comforting when the end is so abrupt, and
that's what I'm after.

Meanwhile, five NiMH cells is ideal for the BX-24 (not the BX-24p) and
as a simultaneous servo supply. The end, though, is fast.
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Re: Servo & logic power - Tom Becker - Oct 12 18:13:42 2006

Well, here are two methods to detect an imminent NiMH battery depletion.
One allows the battery to droop until the processor regulator starts
to drop out. Another senses cell voltage and calculates a discharge rate.
Sense regulator dropout:

The BX-24 uses an LP2951 low-dropout regulator, whose /Error pin pulls
the processor into /Reset, so it's not normally possible to run a BX-24
unregulated. The BX-24p uses the simpler 78L05, which permits
unregulated operation.

Loss of regulation can detected by using an offset, not ratiometric,
analog input to compare to the reference. A ratiometric analog input
will not appear to change when the reference voltage drops below
regulation, but an offset input will appear to change when the reference
changes when the regulator quits. A diode from +5v through 10k to
ground provides a very stable ~4.4v when regulated and less when
unregulated; that change can reliably signal loss of regulation.

Once the loss of regulation is detected, a load can be shed (I turned
off Bluetooth, ~20mA) to immediately increase the supply voltage,
gaining a little more regulated time - while the processor safes
devices, stores working variables, and then shuts down, sleeps or shows
a battery warning until it goes dark.
Sense cell voltage and discharge rate:

A 100k/56k voltage divider on a 10-bit ADC pin allows a maximum of 7.8v,
and a resolution of ~7.6mV. Very slowly integrated (delta k = 0.0001)
and then slowly differentiated (dVdT k = 0.0005), very small voltage
discharge rates are measurable.

At 100mA, fully charged Duracell 2650mAH NiMH AA cells show a high
discharge rate for a time, reaching a peak (5 cells, ~30uV/sec @ 0.1A),
which then lessens as the cells come to equilibrium. During most of the
discharge period the battery voltage is essentially flat, losing only a
few microvolts per second. When approaching depletion, the discharge
rate again reaches and surpasses the early peak. The early peak appears
to be a good predictor of the end slope for a constant load.

Heavier loads lower the cell voltage, develop a larger early slope peak
a little later (5 cells, ~200uV/sec @ 1A), and lessen the depletion knee
slope. Light loads (perhaps < ~10mA with AAs) exhibit a very sharp
discharge knee that's probably too quick to detect with firmware, so it
might be better to threshold a very long average of the cell voltage to
predict the end in that case. However detected, shedding a load works
here, too, of course, to gain some measure of assurance that you'll
finish shutting down before crashing.
I'm using the latter method successfully so far, but I really like the
first method, detecting loss of regulation, bouncing back into
regulation for a bit and shutting down. That's depletion.
Tom



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )