Fri Apr 20, 2018 12:46 pm
Hi guys,
Inspired by Simon's wrap-up and collection of datasheets etc. I decided some time ago to dig out the UPS board again and give it another try. In summary, the board is not really useful, as it is, but it can be extended with a PIC18F... as described by Simon or, as in my case with a 5V Arduino Pro mini.
I'm running the board now for some weeks with good results, after I found some solutions for the following issues:
1) biggest drawback of this board is, that we can not sense reliably, when a power supply is connected or not. Even with an additional controller it is not possible without adding a rectifier diode between the supply and the board to decouple the circuits. The downside of adding a diode is that the input voltage at the board's side would drop by 0,4V to 0,7V, depending on the performane of the diode.
So we need to evaluate other, available information to find out, if the battery is charged or not.
2) the charging circuit and the I2C interface circuit are separated and therefore may or may not be in sync. An example for that are the 4 LEDs controlled by the charging circuit and the SOC value provided by the I2C interface. The learning capability of the latter makes it even worse to really calibrate both against each other by software.
So some additional 'intelligence' is required to use that board in a way which comes closer to what people expect from such board.
In brief, here is what I did:
Use an Arduino Pro mini to read SOC and ChargeRate from the board (yes, running both, Arduino and my Pi as I2C controllers with a potential timing conflict, but this should be ok, if you do not access the I2C interface too often) once in every 60 seconds.
Evaluate the status from SOC and ChargeRate data and provide the result via I2C to the Pi on request (this time the Arduino is acting as a slave).
The Pi then can send the time in seconds, after which the board is to be turned off. I used a Tristate Input on the Arduino, which is changed to Output/Low for a certain period of time to activate the existing push-button.
In order to know if the Pi is currently powered or not, I connected the output of the UPS board to the analog input of the Pro mini via a voltage divider. This turned out to be quite handy and reliable.
In order to save power, I set the Arduino to sleep. It is woken up by the second LED which is either flashing or off provided a minimum charge is available on the battery. Since the charging circuit is pulsing the relevant LED outputs, I set the Arduino to wake up on a change of the corresponding output.
In addition I'm checking SOC and ChargeRate after wakeup if there is really a minimum charge available. Should the conditions be met, the Pi is turned on.
I haven't compiled yet a pictured summary due to lack of time, but if there is some interest I may do so over the next weeks including the Arduino sketch. So let me know, what you think.
P.S.: I didn't have the problem yet, that battery is not being charged, when power supply is reconnected. This actually works quite reliable.