How to implement zenner regulator to solar power ATtiny85?

I am looking to use an ATtiny85 to regulate the charge for LiPos for a remote Arduino.
The 85 will control the amount of charge, depending on the amount of sunlight, by adjusting a LiPo charging chip.
I could run the 85 off the LiPo but i don't want to as the LiPo may get so discharged that its internal safety circuit cuts off the power so that the LiPo doesn't discharge to ruination. Therefore I would be in a Catch-22 where the 85 would never power up again as the battery is below cutout threshold and, with the charge controlling 85 unpowered, will never get to recharge.

Therefore I would power the 85 from the 12v solar panel that can put out up to 24 volts. The zenner/resistor network would regulate the voltage to the 85. I was thinking a 4.3v zenner.

However I have a couple of problems related to hysterisis that I need resolved. As the sun comes up there will be weak power from the solar panel. The voltage may be just enough to power the 85 into an unstable state but not enough to fire it up properly. To overcome this I would set the brown-out on the 85 to 4.1 volts. I would use powersaving settings on the 85 and would expect a current draw of, say, < 2ma. But still I am concerned that the solar panel will just get up enough voltage to exceed the 85 brownout; the 85 will power up and exceed the current available from the panel; the voltage will drop; brownout occur; 85 drops out; voltage rises... and so on. How do I get around this?

Also the 85 is measuring the voltage of the solar panel through a resistor divider connected to one of its AI pins.
This voltage will be measured relative to the supply voltage to the 85 (or that applied to AREF but the AREF pin doubles as MOSI which I use to communcate with the charge controller). Therefore, when the solar panel is providing just a few volts at the start and end of the day (and below the zenner voltage), the voltage reading (as seen by the ADC) will be incorrectly overstated and the 85 will tell the charging chip to pump current into the LiPo when it shouldn't be.

Any views on how I can fix this?

i'd use a light diode resistor and a transistor... that way the transistor will only switch on when there's enough light to charge your lipo..

Thanks cjdelphi.

The PCB board would be sealed and out of the sunlight so I would need to weatherproof the LDR and connection and connect an extra set of wiring to run to the LDR through an extra hole in the aluminium enclosure, sealed with a gromet.

Definitely a solution but extra work and cost when I thought that the Solar Panel could double as the 'LDR' sensor.

fair enough... what about using the solar panel to do the job?

garden solar lights do this all the time.. how do they do it? voltage divider/transistor?

Just as an idea, how about using a CR2032 lithium button battery as the backup? That delivers 3V for roughly 200 mAH.

I tested a sketch using the watchdog timer on this page: http://www.gammon.com.au/power

If you supply 3V rather than 5V the power consumption in sleep mode is 4.2 uA. My calculations show the battery (at that rate) would last around 5 years.

Maybe you could have a second processor with the lithium battery on it. Its job is just to wake up every 8 seconds and monitor the solar power output. If too low, it asserts reset on the second processor, and goes back to sleep. If high enough, it releases reset on the main processor (the one powered by the solar panel) which then gets to work without brownout issues.

But still I am concerned that the solar panel will just get up enough voltage to exceed the 85 brownout; the 85 will power up and exceed the current available from the panel; the voltage will drop; brownout occur; 85 drops out; voltage rises... and so on. How do I get around this?

Does this matter anyway? It will just keep resetting until the sun is bright enough.

How about something like the MC34064?

The MC34064 is an undervoltage sensing circuit specifically designed for use as a reset controller in microprocessor?based systems. It offers the designer an economical solution for low voltage detection with a single external resistor. The MC34064 features a trimmed?in?package bandgap reference, and a comparator with precise thresholds and built-in hysteresis to prevent erratic reset operation.

lemming:
Therefore I would power the 85 from the 12v solar panel that can put out up to 24 volts. The zenner/resistor network would regulate the voltage to the 85. I was thinking a 4.3v zenner.

Why not use a 78L05 or other 5V low dropout regulator instead? It's more efficient than a resistor and zener.

lemming:
However I have a couple of problems related to hysterisis that I need resolved. As the sun comes up there will be weak power from the solar panel. The voltage may be just enough to power the 85 into an unstable state but not enough to fire it up properly. To overcome this I would set the brown-out on the 85 to 4.1 volts. I would use powersaving settings on the 85 and would expect a current draw of, say, < 2ma. But still I am concerned that the solar panel will just get up enough voltage to exceed the 85 brownout; the 85 will power up and exceed the current available from the panel; the voltage will drop; brownout occur; 85 drops out; voltage rises... and so on. How do I get around this?

If you run the 85 at a low frequency, you can probably get the current consumption well under 2mA. If the situation you describe occurs, why not put a delay at the start of your program, so that you know the power has remained stable for some time before it does anything?

If you are worried that when you start the charge pump, the voltage will drop, how about putting a large capacitor across the 5V supply? That will power the 85 long enough for it to detect the drop in solar cell voltage and stop the charge pump.

lemming:
Also the 85 is measuring the voltage of the solar panel through a resistor divider connected to one of its AI pins.
This voltage will be measured relative to the supply voltage to the 85 (or that applied to AREF but the AREF pin doubles as MOSI which I use to communcate with the charge controller). Therefore, when the solar panel is providing just a few volts at the start and end of the day (and below the zenner voltage), the voltage reading (as seen by the ADC) will be incorrectly overstated and the 85 will tell the charging chip to pump current into the LiPo when it shouldn't be.

Any views on how I can fix this?

Use the internal 1.1V or 2.56V reference instead of using the 5V supply as the reference.

I was thinking about this...

And I decided that if i was going to attempt this, I'd have an analog circuit, using a voltage divider, that way when the voltage rises high enough (depending on the 2 resistor values), the base of your transistor will switch on..

12v --- 30k ~~~~ . ~~~~10k ---0v
.
.___________ base will rise to 3v, when the solar panel reaches 12v, the base of the resistor will be 3volts.

Collector/Emitter begin to flow, which can turn on the 85 safely, using this voltage divider, the solar panel has to reach 12v.

Change the values to suit your specific needs, but any reason why this would not work?

A unijunction switches on at 0.5v, if so, use the resistors to give a 0.5v (ON) when the panel reaches say 5v, this ensures it to be switched on and be supplied with enough current for your 85.

I don't see unijunctions mentioned very often ever... why?

Thanks for your input guys.

(Nick Gammon) "... how about using a CR2032 lithium button battery...".

I would rather not have two types of battery to maintain for the system to work if there is a way to harness the solar panel.

(Nick Gammon) "Does this matter anyway?"

Come to think of it, the cycling reboots don't really matter(I hadn't considered that). But still, I suppose I'm just a stickler for the perfect solution. It feels like a cludge if the micro is repetitively booting up and crashing out on low voltage.

(dc42) "Why not use a 78L05 or other 5V low dropout regulator instead?"

I have tried linear and switch mode regulators with test solar setups and they work fine with full sunlight but when the voltage is getting marginal they tend to get unstable and some of them oscillate the voltage to the load. The zenner setup is simple and delivers a stable output voltage irrespective of the input voltage. For less than 2ma (probably much less) required to power the 85, it seems more than adequate and more stable.

(dc42) "... how about putting a large capacitor across the 5V supply?

I have tried this but it only slows down the cycling a bit.

(dc42) "Use the internal 1.1V or 2.56V reference instead of using the 5V supply as the reference."

Sounds good! Thanks. It will not give much granularity, converting the the 0-24 volts to 0-2.56 volts through a voltage divider, but it should be enough for my needs.

(cjdelphi) "... I'd have an analog circuit, using a voltage divider, that way when the voltage rises high enough (depending on the 2 resistor values), the base of your transistor will switch on"

This concept sounds good but if I could simplify it a little...
I could use the 85's brownout setting to prevent the micro starting up until it got over 4.1 volts. However a voltage divider would be connected to the reset pin of the 85, holding it low, so that the approximate 1 volt reset threshold would not be met until the solar panel was delivering, say, 12 volts. Enough voltage headroom so that the minor current draw, when the micro started, would not drop the voltage into unstable territory.

Does this sound OK?