Stable battery power supply with fluctuating load

JezWeston

New Member
I'm using a 28X1 to control 40-odd RGB LEDs using eight PCA9532 i2c drivers, powered by 4 AAA NiMHs. It all looks most trippy, but testing has found a failure mode that I'm trying to find a way around.

When the batteries are tired, the system runs just fine, but is no longer programmable. What I think is happening is that the Picaxe has enough voltage to run, but not to be programmable. Is this possible? Switching all the LEDs on can kick the battery voltage from 5.5V down to 3.6V instantaneously. The charger that I'm using has enough grunt to stiffen the voltage so that the kit is programmable, provided the batteries are not too discharged.

I'm wanting to use the Picaxe to monitor the battery state (via a voltage reference diode), so that it can turn off the shiny lights before the batteries get munted. However, the drivers seem to be able to cope with low voltages better than the Picaxe, raising the frightening possiblity that the Picaxe might die with the drivers still on full-whack, leaving the battery pack to get ruined.

So, my current idea for sorting this out is to provide the Picaxe with it's own regulated power supply, so that it's always programmable and can switch the thing off before the Picaxe falls over. I've been digging around on the Maxim and Linear sites to find a dc-dc chip that can take in 6-3V, give out a nice steady 5V and 100 mA so keep the Picaxe happy. Haven't quite worked out how to find what I'm looking for yet. Oh, and it'd be nice to have a bit more current for the i2c memory chip, SRF005 range finder, and the couple of op-amps in there for input processing. Also, it needs to be tiny, coz everything's going inside a 25 mm diameter tube and there's quite a bit in there already. Surface mount isn't a prob, in fact it'll probably be needed to fit everything in.

Has anyone had any experience of such a power supply before? Any pointers or pitfalls? Or is there a better way around this problem?
 

JezWeston

New Member
Further digging into data sheets on the Linear site suggests that step-up and step-down converters seem to be either step-up or step-down, not both. (For example, the LT1073 is close to what I think I need, but not quite).

Given that I'm running this off four cells, my input range goes from 6V down to 4ish, so I need the converter to be step-down sometimes, step-up others. Is this possible? Is it easy?
 

BCJKiwi

Senior Member
It seems is a very small capacity power supply for circuitry plus 40 LEDs!

Do you really need to program while all the LEDs are on?
If you turn off the LEDs and plug in the charger whenever you want to program there should not be a problem.

As long as the program is running it should be able to shut itself down.

Else a DC-DC boost circuit would be needed of which there are many.
Have a look at the MAX619, runs from 2 to 3.6V and delivers a regulated 5V at 20mA - 50mA (at 2 - 3.6V) - enough to run the PICAXE as long as it is not supplying loads.

It also has a shutdown pin!

Alternatively put in another battery or two and one of the high efficiency voltage regulators.

addendum:
Just seen your latest post. For the MAX 619, you could parallel up the batteries so you don't go over 3.6V. Your current 4 cell would then deliver 2 to 3 volts instead of 4 to 6V and the MAX619 would deliver regulated 5V.

Would need to see the circuit to see if it's feasible to handle PICAXE and loads this way.
 
Last edited:

JezWeston

New Member
The regulated power is just for the Picaxe, the rest of it can live off the fluctuating batteries. The peak power is over 10W, and I'm pretty sure I don't have room for a regulated power supply with that much grunt. Hence I'm loathe to change the battery packs that I've got, coz they're working just fine for 99% of the load. It's just that the last 1% is the part that makes the control circuitry work...

The failure mode is with the Picaxe unprogrammable, the LEDs still on, the batteries too discharged for the Picaxe to run. I'm using the Picaxe to tell the drivers to turn off the LEDs, so I don't want to get into a state where the Picaxe isn't programmable. It's not that I need to, more that I can't avoid it. Does that make sense?

The circuit boards are all more than 100 mm long, so I've drawn them in pieces in Eagle and stitched them in the Gimp, so showing isn't easy. (I'm just starting redrawing in DipTrace, but I've not used DipTrace before, so might take a while.) Basically, it's just a standard download circuit, with i2c control of the drivers on other boards, (and a few other bits just hanging off I/O pins).

The problem is that I'm very space constrained, so chucking another battery in isn't feasible. One option might be to run the Picaxe off one of the cells in the power packs, although that makes me worry about unbalancing the packs, I'd rather do it from the power that I've got, if feasible.
 

BCJKiwi

Senior Member
If you stick in a MAX619, add a connection in the middle of the battery set at 2 batteries so the tap provides 2 to 3 volts to the MAX619 which will regulate that up to 5V+ which you can use to run just the 18X. Run the rest off the full battery set.
 

JezWeston

New Member
Okay, so a step-up seems like the way to go, from a lower-than everything else voltage.

I suppose I could use a two-step process to avoid unbalancing the battery pack, i.e. a step-down to take the voltage from 4-6V down to 3V then a step-up to give me a steady 5V? I've room where the Picaxe is for a couple of chips on board, less room where the batteries are. (I don't know if you've ever put 4 AAAs in a 25 mm tube, but it's tight. Add to that some wires passing them and it all gets a bit fiddly.)
 

BCJKiwi

Senior Member
If you have battery pack capable of 10W @ 6V = 1.67A or 10W @ 4V = 2.5A, I would not have expected the tiny mA draw for the 18X alone to have caused any noticeable imbalance.
 

Dippy

Moderator
Beaniebots found a nice all-in-one buck/boost controller a while back but I can't remember the number.

Personally, I think that would be overkill for this project and agree with what has been said before i.e. a butch battery with plenty of voltage headroom. The main supply to the LED bank could be transistor switched ad regulated if needed as I don't know the circuit. The supply to the PICAXE on a separate lo-dropout regulator, if it sees the batteries drooping on-load (basic pot/div if necessary) it simply switches them off but maintains power to PICAXE.
If 'site visits' aren't very often then PICAXE could go into a simple Sleep loop to keep any info stored in PICAXE.

A problem I had once with battery powered stuff was that on-load the batteries drooped, so I witched ofthe lod in code, the batteries then recover, it starts up and they droop and off.. repeat ad flateum. So introduce some hysteresis into your coding.

But one question: I have obviously misunderstood, but surely if it's all gone flat then you'll recharge your batteries before restart/reprogramme as you'll want to restart a fresh 'session' won't you? Why re-programme when the batteries are flat-ish?

PS. When I read that it was 'trippy' I thought yu meant it kept tripping as opposed to 'providing a high for a 60's hairy person with flowers'. Didn't understand your banter innit.

PPS. 4 NiMHs make a real awkward voltage unless you are OK with powering PIC from <5V. I don't know how much current your device takes or if space is an issue but I'd consider a bit more V. Or a bit less and use a boost regulator, on which some have an LBI status pin.
 

JezWeston

New Member
Ah, but the batteries are hard-wired in for shock resistance. So the kit has to cope with being on all the time. The battery bank is what I have room for, sadly.

Currently I'm needing to reprogramme at low powers, as there's no other way of turning things on or off, nor room for any switches. The aim is to a piece of kit that works when it's charged, shuts down when it's tired, and then just sits there till it's charged again.

Reading the MAX619 datasheet, it looks pretty handy. I may go for the MAX682 so I have enough grunt to run a few other gubbins on the main board.

Still, I'm not absolutely certain the voltage dropping is the problem. Is it possible for a Picaxe to have enough voltage to run, but not be programmable? Or might the cause of the prob be something else?
 

BCJKiwi

Senior Member
The specified supply for an 18X is 4V to 5.5V so while you may get away with the program still running below 4V it is out of Spec. see Hippy's summary of chip specs here;
http://www.picaxeforum.co.uk/showthread.php?t=8609

It is not suprising that a PICAXE won't program with a low supply voltage as the memory locations have to be written to eprom in the chip which requires more power as internal write voltage is much higher than 5V (obtained by an internal boost circuit).
 
Last edited:

hippy

Technical Support
Staff member
You have two distinct problems despite them being related; inability to program the PICAXE when batteries are low, and the risk of batteries being drained too much.

For the first problem you could take your Vbattery supply straight to the LED's and via a diode to the PICAXE +V. You can then mix an external Vpsu supply via another diode to the PICAXE +V and then connect an external 5V supply when you are programming and debugging.

As the batteries are rechargeable, you can perhaps divert part of that charging supply to the PICAXE via a regulator and the diode mixing and plug it in for charging whenever programming. At other times it won't matter that the battery voltage is too low for programming.

For the second issue I can understand the problem of the 18X dying and leaving the LED's on draining the batteries. The only way round that is to have the 18X turn off the LED's when battery depletion becomes imminent, or have a separate watchdog which can keep running at a lower voltage than the 18X which can force the LED's to shut down once the 18X has.

You could also use such a watchdog to control the 18X reset to ensure it shuts down and resets cleanly when batteries deplete and the external charger is connected for programming.

Alternatively, something at the battery end of the circuit which disconnects power when the batteries are depleted. The PICAXE can still be powered from the charging supply due to the diode mixing discussed earlier.
 

JezWeston

New Member
I note from Hippy's summary that using an external resonator increases the sensitivity to low voltages. This setup is overclocked to 20 MHz, which might be a contributing factor.
 

BCJKiwi

Senior Member
If you overclock voltage is much more critical.

However download always takes place at 4MHz with the PICAXE always switching to this speed internally for the download sequence once triggered.

The issue is actually getting the chip to behave properly at a low (below spec) voltage.

If the voltage is too low, if the chip starts at all it will usually start at 4MHz, not the higher speed intended, although if started at the higher speed (on a better supply) it will generally keep running at high speed as the voltage drops.

i.e. once statrted it will keep running as you have found. However restarting or programming on below spec voltages is not reliable if it happens at all.
 
Last edited:

JezWeston

New Member
That is indeed a very shiny part. It's too big for the current setup, but might be just the thing for the next project in the queue...
 

Dippy

Moderator
This was suggestion from BB from a while back. Looks very useful for those annoyingly-in-the-middle voltage scenarios.
Linear's LTC3780.
 

yamato

New Member
I recomend u to upgrade from AAA batteries to AA, more power available to drive the led load and for more time.

DC-DC boost up reg. is a good option cause provides constant volt. sucking the 1.5v or 1.2v batteries until 0.7 volts.

Mintyboost Kit (max756) only provides 300mA 5v or 500mA 3,6v, i have no ather experience with capacitor/inductor charge pumps.

MayBe to much electric noise in the circuit disabling programing? Sometimes the mistake is right there and we just cant see it (happens to me more than i would like), take a another look.
 

Technical

Technical Support
Staff member
Have you actually tried programming a 'switch leds off - pause 5000' to the start of your program and a reset switch?

Press the reset switch and then start the download within 5 seconds. The LEDs will then definitely be off during this period and there may be sufficient battery power to program the PICAXE...
 
Top