BeanieBots
Moderator
Switch mode Battery Charger. (code & circuit in post #2)
This project started off as a simple bi-directional battery capacity meter. This was at a time when there was a lot of chat about MPPT controllers and using PICAXE to control switchers. To prove the point one way or another, I decided to add the required bits to the project in an attempt to make a switching MPPT controller. After quite a bit of persistance, I eventually gave up and concluded that it was not possible using the PWM function directly because the resolution was not fine enough. The hunting on the input side was too great to offer any real benefit. However, I still had several days labour invested in the hardware which I did not want to go to waste. I decided to convert it into a bi-directional battery charger/discharger. This has proved to work really well.
I'd like to point out the sole purpose of the excersise was to prove/disprove by actually building and testing how well a switcher would work by connecting the FET directly (actually via a low value resistor) to a PICAXE PWMout pin. No FET drivers and no other means of PWM control. So please, no "theoretical" comments about how bad the design is. I'm fully aware that it's bad practice. I wanted to PROVE how bad (or good) that approach would be. Or even if it's possible as so many people seem to want to try it and so many others want to shoot them down in flames for trying. The FET is a IRF520 and the flyback transformer is self wound 27:23 on an RM8 core with air gap. The only other semiconductors are an LM324 bog standard quad op-amp, a 78L05 voltage regulator, a BC237 tranny, a 1N5821 Schottky for the switcher, an MUR160 for the snubber and a few other diodes.
Anyway, I could go on for ever about the why's and why nots but I won't unless somebody specifically asks.
As mentioned, the original hardware was for just a capacity meter, hence I used what seemed an appropriate PICAXE at the time, namely the 18X. When I finalised the battery charger/discharger design, it proved to be a little short in both I/O and program space so I couldn't squeeze in all the features I wanted. If anyone can see a way of reducing the code size by enough to add some more features I'd be very pleased. I could take out things like the "beep" for each button press but that alone would not be enough to add another menu item.
Without further rambling, here's the final project spec and functionality.
Functionality:-
User selectable cycle of:-
a) Charge only
b) Charge : Rest : Discharge
c) Charge : Rest : Discharge : Charge
d) Discharge : Charge
e) Discharge only
f) Hold at voltage for indefinite period.
Functional description:
The amp hours transfered at each stage are measured and saved to EEPROM for recall later.
The charge cycle charges at a user configurable constant current up to a user configurable BULK charge voltage.
Once the BULK voltage has been reach, the controller switches to constant voltage mode and holds the battery at that voltage until the current reduces to half of the user defined constant charge current. The charger takes note of how long it took to get to those conditions. It then enters float mode. It will stay in that mode for the same amount of time it took to do the bulk charge. Whilst in float mode, the battery voltage is maintained at an independant user configurable FLOAT voltage whilst not exceding the same maximum current used in BULK mode. Once the time has elapsed, the charge process is deemed to have completed. The BULK phase has a maximum timeout period of 8 hours to prevent dead or sick batteries from being cooked even further. Thus, the maximum possible charge cycle is limited to 16 hours.
The discharge phase discharges at a user definable constant current until a user definable cut-off voltage is reached.
If the only or last phase is a charge cycle, once the charge is complete, the controller enters hold mode.
In hold mode, the controller will hold the battery voltage at yet another user definable "HOLD" voltage indeffinitely. Current is limited to the current set for the charge cycle.
If a charge cycle is followed by a discharge, there is a 20 minute rest before the discharge starts. I would have liked to make the rest period user configurable but there was not enough program space. The rest period can be aborted during operation with a simple button press.
I am not convinced that the BULK to I/2 followed by FLOAT for same period is ideal. I'm open to suggestions on that one.
All voltages and currents are user configurable. I've in no way tried to impose my Pb beliefs. It's entirely up to the user how they choose to destroy their batteries.
Take note that during discharge, power is reversed and flows from the battery back to the supply. So, don't use a wall-wart or it will blow up. The supply must be a larger battery or clamped voltage source. Also, if the battery is diconnected during a charge, the controller will still try to supply current. Current into an open circuit builds up voltage VERY quickly. Too quick for a PICAXE to control. For that reason, one of the op-amps is configured as a comparitor for emergency shut-down should the converter go over-voltage. It is connected directly to the converter output and hence works for both charge and discharge. It is also on the converter side of the fuse for obvious reasons.
Continued in next post.......
This project started off as a simple bi-directional battery capacity meter. This was at a time when there was a lot of chat about MPPT controllers and using PICAXE to control switchers. To prove the point one way or another, I decided to add the required bits to the project in an attempt to make a switching MPPT controller. After quite a bit of persistance, I eventually gave up and concluded that it was not possible using the PWM function directly because the resolution was not fine enough. The hunting on the input side was too great to offer any real benefit. However, I still had several days labour invested in the hardware which I did not want to go to waste. I decided to convert it into a bi-directional battery charger/discharger. This has proved to work really well.
I'd like to point out the sole purpose of the excersise was to prove/disprove by actually building and testing how well a switcher would work by connecting the FET directly (actually via a low value resistor) to a PICAXE PWMout pin. No FET drivers and no other means of PWM control. So please, no "theoretical" comments about how bad the design is. I'm fully aware that it's bad practice. I wanted to PROVE how bad (or good) that approach would be. Or even if it's possible as so many people seem to want to try it and so many others want to shoot them down in flames for trying. The FET is a IRF520 and the flyback transformer is self wound 27:23 on an RM8 core with air gap. The only other semiconductors are an LM324 bog standard quad op-amp, a 78L05 voltage regulator, a BC237 tranny, a 1N5821 Schottky for the switcher, an MUR160 for the snubber and a few other diodes.
Anyway, I could go on for ever about the why's and why nots but I won't unless somebody specifically asks.
As mentioned, the original hardware was for just a capacity meter, hence I used what seemed an appropriate PICAXE at the time, namely the 18X. When I finalised the battery charger/discharger design, it proved to be a little short in both I/O and program space so I couldn't squeeze in all the features I wanted. If anyone can see a way of reducing the code size by enough to add some more features I'd be very pleased. I could take out things like the "beep" for each button press but that alone would not be enough to add another menu item.
Without further rambling, here's the final project spec and functionality.
Functionality:-
User selectable cycle of:-
a) Charge only
b) Charge : Rest : Discharge
c) Charge : Rest : Discharge : Charge
d) Discharge : Charge
e) Discharge only
f) Hold at voltage for indefinite period.
Functional description:
The amp hours transfered at each stage are measured and saved to EEPROM for recall later.
The charge cycle charges at a user configurable constant current up to a user configurable BULK charge voltage.
Once the BULK voltage has been reach, the controller switches to constant voltage mode and holds the battery at that voltage until the current reduces to half of the user defined constant charge current. The charger takes note of how long it took to get to those conditions. It then enters float mode. It will stay in that mode for the same amount of time it took to do the bulk charge. Whilst in float mode, the battery voltage is maintained at an independant user configurable FLOAT voltage whilst not exceding the same maximum current used in BULK mode. Once the time has elapsed, the charge process is deemed to have completed. The BULK phase has a maximum timeout period of 8 hours to prevent dead or sick batteries from being cooked even further. Thus, the maximum possible charge cycle is limited to 16 hours.
The discharge phase discharges at a user definable constant current until a user definable cut-off voltage is reached.
If the only or last phase is a charge cycle, once the charge is complete, the controller enters hold mode.
In hold mode, the controller will hold the battery voltage at yet another user definable "HOLD" voltage indeffinitely. Current is limited to the current set for the charge cycle.
If a charge cycle is followed by a discharge, there is a 20 minute rest before the discharge starts. I would have liked to make the rest period user configurable but there was not enough program space. The rest period can be aborted during operation with a simple button press.
I am not convinced that the BULK to I/2 followed by FLOAT for same period is ideal. I'm open to suggestions on that one.
All voltages and currents are user configurable. I've in no way tried to impose my Pb beliefs. It's entirely up to the user how they choose to destroy their batteries.
Take note that during discharge, power is reversed and flows from the battery back to the supply. So, don't use a wall-wart or it will blow up. The supply must be a larger battery or clamped voltage source. Also, if the battery is diconnected during a charge, the controller will still try to supply current. Current into an open circuit builds up voltage VERY quickly. Too quick for a PICAXE to control. For that reason, one of the op-amps is configured as a comparitor for emergency shut-down should the converter go over-voltage. It is connected directly to the converter output and hence works for both charge and discharge. It is also on the converter side of the fuse for obvious reasons.
Continued in next post.......
Attachments
-
85 KB Views: 541
-
22.9 KB Views: 374
Last edited: