Pages

Saturday, 30 December 2023

Automatic Backup Lighting - V2.0 Details

 

 Description

This project  provides automatic backup lighting whenever the mains power is lost. 

Using high power white leds the lighting allows me to safely move about.

Multiple lights can be daisy chained via the power connectors marked AB in the schematic below. I only fitted one connector to the PCB pictured since it was a prototype.

Use of the bridge rectifier means I become agnostic on the power source used. AC or DC from a wall wart, 9V to 24V is fine.

Because the STM8S003 does not have a bandgap reference voltage I simply use a 3.08V reset chip to monitor the battery voltage and provide a go/no-go signal to the micro.

Picture of finished Prototype


Rough but it works really well.

 Schematic

 


Software

Here is the barebones V2 code. It runs on a STM8003 flashed with STM8 eForth. I didn't bother trying to minimise the current drawn by the micro beyond that achieved by simply slowing down the clock, resulting in around 1mA of current drawn by the CPU.

For the version with the button fitted please contact me and I will upload it. I would need to tidy up my comments in the listing before uploading.

\ If Pwr? Pin is high turn off light after 20 seconds
\ If Pwr? is low turn off light after 5 minutes

RESET
NVM

Variable 'Toff \ time light is on when power fails
Variable 'Ton  \ time light stays on when power restored

\ Port C Pins
6 CONSTANT _Pwr?
7 CONSTANT _LedEn

\ Port D pins
2 CONSTANT _LowBatt?

: setup_pins  ( -- )
   \ Port C inputs are floating, no interrupts enabled
   [ _LedEn PC_DDR ]C!  \ Port c outputs
   [ 0 PB_DDR _LowBatt? ]B! \ set as an input
   [ 1 PB_CR1 _LowBatt? ]B! \ enable pull-up
;

: _LEDon ( --- ) [ 1 PC_ODR _LEDEn ]B! ;
: _LEDoff [ 0 PC_ODR _LEDEn ]B! ;
: LowBatt? [ PD_IDR _LowBatt ]B? ;

: Light?
   Pwr?
   if   1800 'Toff !
       'Ton @
        If      _LEDon -1 'Ton +!
        Else    _LEDoff
        Then
    Else
        90 'Ton !
        'Toff @
        If   _LEDon -1 'Toff +!
        Else _LEDoff
        Then
    Then
;

: MAIN   
   SETUP_PINS
   [ $35 C, $1F C,  $50 C, $C6 C, ]     \ Clock CPU at 15.625kHz
   BEGIN
      LIGHT?
   AGAIN
;

RAM   
NVM
' MAIN 'Boot !
RAM


Tuesday, 19 December 2023

Joule Smasher Led Flasher - Update at 12 Months into 10 year Life on AA

 

It's been just over 12 months since I installed a fresh AA battery into an early Joule Smasher Led Flasher. The battery voltage over that time has been on track to last 10 years. 

The graph below has two curves. One is the best AG3 cell result which lasted some 19 days. If a AA battery was to last 10 years then the 3650 days could be scaled to 19 days. One day for the AG3 cell would represent 193 days for the AA battery. As long as the AA voltage on the scaled axis is above the AG3 cell voltage then I consider the AA is on track to meet the 10 year lifespan.

So far, everything is on track to meet the expected 10 years of life. While I changed the timing in the early stages (~1ms till Day 89, 10ms till Day 113, 3ms thereafter) I don't believe this will seriously detract from the test results. The AA battery voltage after 378 elapsed days, or 1.96 days after scaling,  is 1.416 volts. 

While comfortably above the AG3 curve the voltage is starting to fall to the levels where the AG3 cells all showed a flattening in the discharge curve. If the discharge curve does not flatten out like all the previous test results the AA battery is presently forecast to last 8 years.


Replace the Lead Acid Battery in your Ride on Mower with LiFePO4

Truly Maintenance Free Low Ownership Cost Project

My ride on mower is a low quality product and I was fed up with replacing the lead acid battery and fighting corrosion on the battery terminals.

No longer. It is entirely feasible to change that lead acid battery out for a LiFePO4 battery and a unique Battery Management Systems (BMS) as described below. 

I expect the LiFePO4 battery to last at least 2000 starts which works out to 38 years if I start it every week of the year.

The Problem

My mower is powered by a Briggs and Stratton engine. The charging circuit is very simple, a dynamo and a diode. So the unregulated dynamo pushes several amps into the battery regardless of the state of charge. In practice this overcharges the battery requiring regular topping up with distilled water and shortened battery life.
 

The Options

  1. Keep replacing the battery with dubious quality cheap replacements
  2. Replace with a high cost big brand name battery and hope it lasts longer. 
  3. Replace with a LiFePO4 battery and BMS and never have to touch it again.
Given overcharging is the norm with my ride on mower it would appear option 2 is just wishful thinking. The LiFePO4 cells plus my BMS work out to be initially 30% more expensive than a lead acid battery. The economics strongly favour option 3 if a special BMS is used that compensates for the poor quality of the mower's electrical charging system.
 

The Special BMS - Requirements

It should be obvious but nothing you can buy off the shelf is really designed to maximise the life of a LiFePO4 battery. All they try to do is prevent catastrophic failure until the warranty period has ended. That sounds cynical but ask the BMS seller if they are confident the LiFePO4 battery will still be good in 30 years. And if you buy a BMS from an online Chinese marketplace then you know your warranty ends as soon as money changes hands.
 
To get a long life from a LiFePO4 we must avoid:
  1. charging in freezing temperatures,
  2. over-charging, and
  3. discharging below 0% state of charge

Point 1 - charging in freezing temperatures

Point 1 is not applicable in this application since I never go lawn mowing when it's freezing cold. But it does mean this might not work in a snowmobile or similar without a little more thought.

Point 2 - over-charging

This is my main concern given my mower, and probably yours too, has an unregulated charging voltage. In testing I found my mower could readily push the LiFePO4 battery charging voltage over 14.2 volts.
 
Yes, I read that when the charging voltage reaches 14.6 volts the battery is 100% charged. But in my opinion charging to 100% is an aggressive charging regime that is unwarranted in this application. I'll take the conservative option and try to hold the maximum charging voltage under 14.0 volts. I really want the battery to last and if I get this right I'll be replacing the mower, not replacing the battery, in 20 years or so!

Point 3 - discharging below 0% state of charge

 What does it really mean when you read statements like the following? :
"over-discharging can lead to battery damage. If any battery is near empty (below 2.5V), the BMS must be disconnected from the load. Batteries may be slightly damaged below 2.0V, but are usually recoverable. However, a battery driven to a negative voltage will be damaged beyond recovery"

I certainly agree that the 2.5 volt threshold can be a point off failure since I've experienced it first hand.  However, in an engine starting application I'm unsure if the individual cell voltage is relevant. Does the 2.5 volt threshold apply under heavy intermittent loads?

I'm going to suggest that this BMS doesn't need to monitor for low cell voltages while cranking. The reason is based on ohms low in a worse case scenario. If I have a cell with 3.2v of terminal voltage and an internal resistance of 5mΩ, then a 150Amp starting current pulse would drag the voltage at the battery voltage down by 0.75V to 2.45V. But the cell has not been discharged. It is just delivering a lot of current. This appears to be just what happens with a lead acid battery.
 
Hence, in this engine cranking application I will use a buzzer to warn if the battery voltage is below
12.8 volts, or 3.2 volts per cell. I made provision for those who, like me, decide that modifying the mower's wiring is worthwhile to implement a lock-out for the starter solenoid. This prevents the engine cranking when the battery is lower than 12.8 volts.


Interaction of Cell Size and BMS parameters

The smallest cells I tested in my mower were sold as 14Ahr. During testing they performed well but in the final application a slightly larger cell of 30Ahr will be used. It is useful to compare the expected charge/discharge regime in the mower with a sound research paper such as the one found here.

 
  D. Wong et al. 14Ahr Cell 30 Ahr cell
Cell capacity 2.6 Ahrs 14.0 Ahrs 30.0 Ahrs
Discharge Current 40 Amps 150 Amps ?
150 Amps ?
Discharge Rate 15C 11C 5C
Discharge Time 5* 3 3
Depth of Discharge 100% 0.9% 0.4%
Charge Current 40 Amps** 3 Amps 3 Amps
Charge Rate 15.38C 0.21C 0.10C
 
* 5 seconds discharge followed by 1 second recharge. Repeated till 100% discharged
** After fully discharged recharged at this rate
 
Even with a pessimistic cranking current the larger 30 Amp Hour cells are operating under very different, and I have assumed more favourable, conditions than that tested by D. Wong et al. The tested cells lasted around 47 cycles under the testing regime used by D. Wong et al. Assuming a 1% depth of discharge from cranking that might mean 4700 cranking cycles from the LiFePO4 battery. At two cranking cycles a week that's 45 years of life. I won't be around to verify they last that long but I have a lot of confidence the LiFePO4 battery can outlast the mower.
 

Proof of Concept Results

No issues with starting the motor and charging the battery. However, I wasn't entirely happy with the high voltage (18V) being seen by the hour meter and fuel cut-off solenoid once the battery was charged and disconnected from the electrical system. A low resistance load resistor solved the high voltage at the expense of heat. 

 

BMS Prototype 1

 
My proof of concept design had a lot of smarts but the crud coming from the alternator meant a real belt and braces approach was needed. 

I ended up using a BMS with the following characteristics:
  1. A number of parallel mosfets which when turned on allow the mower to be started and the alternator to directly charge the batteries.
  2. Once the battery voltage rises above the set point a dump resistor is switched across the alternator to absorb some of the energy and the mosfets isolate the battery. No further charging takes place.
The only reason for the resistor bank is to keep the fuel solenoid and hour meter from seeing too high a voltage. If you didn't have, or were prepared to risk, an hour meter or fuel cutoff solenoid being damaged then the dump resistor may be unnecessary. 
 
My set point was to stop charging when the battery reached 13.4 Volts. Combined with a charge balancer it should ensure no damage is ever done by overcharging the LiFePO4 cells. The state of charge should approach 90% at most. 

BMS Circuit Diagram

I'm reluctant to publish a full circuit diagram because it will be instantly copied by the Chinese and sold with inferior parts which will reflect poorly on me. Contact me if you want to see the finer detail.
 
 

Solid state or Relay?

My initial "proof of concept" tests were with a modified Low Voltage Disconnect Switch working in reverse. It utilised 3 90A mosfets and survived a lot of abuse.
 
When I built the first prototype of this BMS I used 3 x 47 Amp mosfets, of Chinese origin. Magic smoke escaped.
Rebuilt with 3 Chinese x 74 Amp mosfets. Magic smoke escaped.
Rebuilt with Western specified 90 Amp mosfets - success.
 
I struggle with the idea my mower needs a cranking current over 150 Amps. Replacement starter motors are specified as 0.9kW, or 75 Amps. I will assume 150 Amps until I measure it.

So correctly specified mosfets will do the job.  I considered a starting solenoid as a relay, but I'm unsure if the coil can handle being energised for longer than a cranking time period. In any event, a relay or starter solenoid is more expensive so I'll stick with the mosfets for now.
 


BMS Version 1


Taking everything I learned from the proof of concept and the prototype I produced Version 1 of the BMS. Everything works as intended though using the load resistor to tame the "alternator" is not an elegant solution. But it means no change to the mower wiring is required.
 
And the resistor gets hot. Initially I had it mounted by standoffs on the plastic case. It melted the plastic and fell off to be left dangling by the wires. It is now mounted behind the seat in the open air.




And here is a picture of Version 1 temporarily installed in the mower with the small LiFePO4 battery used for testing. With the arrival of spring I'll be mowing weekly so this combination will be tested to destruction. I have some more pcb's so I can rebuild it as needed.

After a delay in posting this spring has turned into summer and those baby LiFePO4 cells are still working well. I experimented with the charging cut-off algorithm and the current iteration is a hard cut-off at 13.6V or 3.4V per cell.
 
 
 
 

 BMS Version 2

 
There are already a couple of points which could be improved upon. Version 2 is taking shape and I'm just waiting to see what might fail in version 1 before I finalise it. I'm not in a great hurry but the goal is to not only replace the mower battery but also the secondary lead acid battery in my 4WD. That battery fails about every 4 years so I have some time up my sleeve to get this right.