Pages

Saturday, 7 October 2023

Automatic Backup Lighting - V2.0

After several months of not needing backup lighting we suffered a week of regular power interruptions due to an equipment failure on the grid feeding our suburb. While very inconvenient it did highlight how useful automatic backup lighting can be. 

I have made the following changes since V1.0:

  1. switched to LiFePO4
  2. swapped to a STM8S003 running STM8eForth
  3. tried a variety of Leds. 

LiFePO4 Batteries

Switching to the LiFePO4 battery was a mixed blessing. The run time is impressively long though I could have achieved this with a different Li-Ion battery. And potentially the life in cycles means the backup lights might last for at least my lifetime.

For a while I had more lights than I could keep on charge. So I was forever having to manually connect and disconnect. Once I forgot to do this and the battery dropped below 3.0V. Which meant the micro wouldn't trigger the charging circuit and the cell kept going flat even though I thought it was on charge. The result was a ruined LiFePO4 battery. A change in hardware fixed this.

Most of all I slept easy knowing there would be no spontaneous combustion risk, unlike a li-ion battery which has a very small risk of bursting into fire.

STM8S003 running STM8eForth

This is almost perfect. Only a few cents more expensive than an ATTINY device and presently has better  availability. The ability to reprogram or adjust parameters via a serial cable as needed was a huge improvement over the ATTINY development landscape of assembly language and write / burn cycles.

The only downside was a battery voltage below 3V means it goes into reset which prevents the battery charging since the micro was controlling a pass transistor. That's been fixed. The presence of a charging voltage now turns on the pass transistor and the micro is not involved. The micro merely senses the charging voltage is present and controls the lighting accordingly. 

It meant I could alter things like on and off periods very easily by connecting the light to a serial port. And the button could be programmed to do one thing while on charge and another when there was no power as I thought up new applications. 

The CPU clock is now down to 15kHz which means the micro draws only 0.5mA. So once the battery voltage falls through 3.1V and the light is held off, the battery can run for a long time before the micro goes into reset and halts. Once power is restored and the battery voltage rises everything goes back to how it should be.

Leds

This proved to be the most frustrating part of V2.0 due to tolerances. By which I mean the led driver, supposedly turns off at 27V but in practice it can be lower due to tolerances. Using 3 high intensity leds with a 9V rating doesn't mean they clamp to a 27V level. It depends on the current being forced into the leds. More current means a higher voltage.

Once I realised this was why sometimes a board would work and other times it refused to it was a lot smoother sailing!


Conclusion

I think I have all the bugs resolved now. In the New Year I hope to write up this project in more detail.

A really bright backup light can prove immensely useful. And being able to unplug the light to use as an inspection lamp or similar has been proved to be very useful. The only thing I would change if it were possible would be to use a LiFePO4 battery more like the form factor shown below. The large cylindrical LiFePO4 cell constrains the sort of case I can use.

 

No comments:

Post a Comment