Microcontroller and Software
The project is based on an AT Mega 128 development board which includes a relay, a beeper, a 2 line 16 character LCD (sadly not backlit) and five buttons. It also has several digital and analogue ports brought out on to connectors on the rear.
The microcontrollers themselves are inexpensive, but you need to spend about the same again on a programmer. It is a 'dongle' which connects to the USB port on your PC and to one of the sockets on the back of the controller (the JTAG port in my case).
You also need a language to program it in / with. To make it as widely understandable as possible, I adopted a version of Basic - MikroBasic
I started with the demo version - and found I quite liked it. Because of the size of the program, I bought the 'pro' version which was about $150 - but I will get more use out of it than just this I hope.
That means that unless you can persuade someone else to do it for you, you are looking at another $200 to burn the software on to the microcontroller board.
Once the software has stabilised, I might offer some kind of "send me your board and I'll blow the software on to it for a nominal consideration" type thing - which will lower the cost a bit.
I have attached the code for the charger. This version works but has a few 'issues'. Most are cosmetic (screens not being very clear or UI being poor) but the main one is that the charge cycle times out after about 20 mins - so you only get 20 min charging at a time.
I have also uploaded the .HEX file which you can burn directly on to the controller using a piece of free software
How the application works
There are three main functions:
1. Calibrate
From the home screen, push the left button. It will ask you to measure the battery voltage with a meter and adjust the reading on the screen (using the top and bottom buttons) to match. This just calibrates it's internal volt meter.
To exit to the home screen push the middle button (this works from most of the other screens too - sort of like the back button)
2. Edit
From the home screen, push the Bottom button. Edits the charge profile.
The charge profile consists of five 'Pots' (Why 'Pots' - cos it's short and each pot contains info?). Each represents one charging stage.
within each pot, you can set:
Enable - Enables this pot. If your profile only needs 2 pots, disable the other 3.
Voltage - Sets the max voltage
Current - Sets the max current
The output will try to achieve the specified voltage, unless the current is too high - then it will limit the current. Remember, this is the voltage of the whole string, not a battery or cell.
Trans Voltage - this is a voltage which when reached, this pot will terminate and the next enabled pot start. Set higher than the charge voltage to ignore this parameter (as it will never be reached)
Trans Current - If the charge current drops below this value the pot will terminate and the next enabled pot begin. Set to zero for it to be ignored.
Timeout - the time in seconds (up to 2550s) after which the pot will terminate
You use the top and bottom keys to increase and decrease values, the left and right keys to cycle through the parameters and the middle button to save and exit back to the home screen.
3. Run
From the home screen, push the right button. Runs the charge profile. The duty cucle starts at 1 and climbs slowly until the desired voltage or current is reached - then increases and deacreases to keep it within the desired limits. It will hover around +/- a couple of volts because of the limited PWM resolution but this should be OK for the batteries, it's better than 1% regulation.
4. Test
From the home screen, push the Top button. This was added to test the circuit without necessarily charging a battery. I just conected the output to a light bulb as a load. You can use the top and bottom buttons to adjust the duty cycle from 1 to 255. The display shows the measured current and voltage.
I forgot to mention that I had abandoned using a hall effect current probe in favour of a shunt.
The hall effect probe, for a number of reasons worked better than the shunt but unfortunately I stepped on the only one I had and broke it. In it's place I have used a 0.25 ohm 100W resistor which will drop 5v at 20A - and give me good resolution across this range. I will probably go back to the hall effect sensor at a later date when another suitable one falls in to my hands. This is the type I used previously.
The project is based on an AT Mega 128 development board which includes a relay, a beeper, a 2 line 16 character LCD (sadly not backlit) and five buttons. It also has several digital and analogue ports brought out on to connectors on the rear.
The microcontrollers themselves are inexpensive, but you need to spend about the same again on a programmer. It is a 'dongle' which connects to the USB port on your PC and to one of the sockets on the back of the controller (the JTAG port in my case).
You also need a language to program it in / with. To make it as widely understandable as possible, I adopted a version of Basic - MikroBasic
I started with the demo version - and found I quite liked it. Because of the size of the program, I bought the 'pro' version which was about $150 - but I will get more use out of it than just this I hope.
That means that unless you can persuade someone else to do it for you, you are looking at another $200 to burn the software on to the microcontroller board.
Once the software has stabilised, I might offer some kind of "send me your board and I'll blow the software on to it for a nominal consideration" type thing - which will lower the cost a bit.
I have attached the code for the charger. This version works but has a few 'issues'. Most are cosmetic (screens not being very clear or UI being poor) but the main one is that the charge cycle times out after about 20 mins - so you only get 20 min charging at a time.
I have also uploaded the .HEX file which you can burn directly on to the controller using a piece of free software
How the application works
There are three main functions:
1. Calibrate
From the home screen, push the left button. It will ask you to measure the battery voltage with a meter and adjust the reading on the screen (using the top and bottom buttons) to match. This just calibrates it's internal volt meter.
To exit to the home screen push the middle button (this works from most of the other screens too - sort of like the back button)
2. Edit
From the home screen, push the Bottom button. Edits the charge profile.
The charge profile consists of five 'Pots' (Why 'Pots' - cos it's short and each pot contains info?). Each represents one charging stage.
within each pot, you can set:
Enable - Enables this pot. If your profile only needs 2 pots, disable the other 3.
Voltage - Sets the max voltage
Current - Sets the max current
The output will try to achieve the specified voltage, unless the current is too high - then it will limit the current. Remember, this is the voltage of the whole string, not a battery or cell.
Trans Voltage - this is a voltage which when reached, this pot will terminate and the next enabled pot start. Set higher than the charge voltage to ignore this parameter (as it will never be reached)
Trans Current - If the charge current drops below this value the pot will terminate and the next enabled pot begin. Set to zero for it to be ignored.
Timeout - the time in seconds (up to 2550s) after which the pot will terminate
You use the top and bottom keys to increase and decrease values, the left and right keys to cycle through the parameters and the middle button to save and exit back to the home screen.
3. Run
From the home screen, push the right button. Runs the charge profile. The duty cucle starts at 1 and climbs slowly until the desired voltage or current is reached - then increases and deacreases to keep it within the desired limits. It will hover around +/- a couple of volts because of the limited PWM resolution but this should be OK for the batteries, it's better than 1% regulation.
4. Test
From the home screen, push the Top button. This was added to test the circuit without necessarily charging a battery. I just conected the output to a light bulb as a load. You can use the top and bottom buttons to adjust the duty cycle from 1 to 255. The display shows the measured current and voltage.
I forgot to mention that I had abandoned using a hall effect current probe in favour of a shunt.
The hall effect probe, for a number of reasons worked better than the shunt but unfortunately I stepped on the only one I had and broke it. In it's place I have used a 0.25 ohm 100W resistor which will drop 5v at 20A - and give me good resolution across this range. I will probably go back to the hall effect sensor at a later date when another suitable one falls in to my hands. This is the type I used previously.