DIY Electric Car Forums banner

$200 Build your own intelligent charger.

199136 Views 565 Replies 60 Participants Last post by  PStechPaul
7
This project started here. I had built a high voltage electric vehicle but found the options for charging somewhat limited and very expensive. I wondered how complicated it could possibly be? A couple of minor explosions and the odd electric shock later, here it is - a fully programmable digital charger capable of operating up to 350v and 35A.

I built mine largely from parts salvaged from junk computer UPS's but even if you bought all the parts new, I doubt it would come to much more than $200.

First of all the circuit diagram:


I would strongly recommend you test and tun this using an isolating transformer. While testing, I used and isolating transformer as well a Variac which allowed me to reduce the input voltage to a relatively safe 50v or so.

This is a list of the parts you will probably need to buy. I've not included most of the resistors and capacitors - but they are shown on the circuit above:
High Side Driver - A3120
Encapsulated 12v Power Supply
15v DC/DC Converter (this could do with being higher power than 3W)
5v Zenner Diodes used to protect microcontroller
40A Bridge Rectifier Avoid the Chinese ones from eBay - they say 35A but let the smoke out at about 15A.
Ultra Fast Diodes I'm using 5 salvaged 10A Shottky diodes, but they are no longer available. Something like the ones listed will be fine though. Parallel up enough for 2 x the max charge current.
Microcontroller This is the most expensive part at about $60

Parts you are best off salvaging from something else:
Large Electrolytic Capacitor. Must be rated at >= 2 x your mains input voltage or it will explode (exciting and smelly). I have a 2200uF 500v capacitor - but something a lot smaller will be fine - it's just what I had.

IGBT I've used a big 200A 600v IGBT from a 3 phase UPS - but it only needs to be rated at about double your charge current. There are some nice ones on eBay for about $25 - but you can just parallel up a load of low current ones on a heatsink. Watch out though - often the metal tab on the device is connected to one of the pins. This may cause a problem for other stuff connected to the heatsink - particularly your fingers!

Output smoothing Capacitor I used something similar to this but it's not that critical. It's to get rid of the switching spikes from the output so any low value high voltage (non electrolytic) capacitor will probably do.

It's not shown in the circuit, but I also put a power diode in series with the connection to the batteries. This is just in case the batteries are connected the wrong way round. In this case you will get a loud pop and the smoke will escape.

Relay The microcontroller board includes a relay which it says is rated at 15A. However - it kills itself at a lot less than that. I'm using it to switch a larger 60A relay in the output line (RL1 on the diagram).

Shunt The current is measured using a simple 0.22 Ohm shunt. I would recommend one of these over a wire-wound type as they have very low inductance and can be bolted directly to a heat sink. This particular one is rated at 50W or 14A but bigger are available.

I built mine on stripboard just to try it out - but may get some PCB's made.

Next, I'll cover the software and microcontroller.

Attachments

See less See more
1 - 20 of 566 Posts
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.

Attachments

See less See more
Interesting effort, Simon... but your circuit... well... let's just say it's missing a bunch of stuff.

1. WHERE'S THE FUSE, SIMON??? I don't see any surge protection, either. If the IGBT fails it will fail short circuit, and if your battery pack has just enough impedance to not vaporize the IGBT's bondwires, welll...

2. inrush current limiting, aka "precharge" - this is probably why you blew up one of the electrolytics. You need to put, say, a 100 ohm/5W resistor in series with the cap that gets shorted out by a relay after a second. This will make the bridge rectifier a lot happier, too.

3. proper isolation of the control circuit from the mains - while I think it is arguably pointless to isolate the mains from the battery pack, referencing the microcontroller interface to the mains is a real no-no. Lots of stuff needs to be changed to fix this issue, but start with your current sensing and gate driver.

4. current sensing - I really recommend you go back to a Hall effect sensor both because it is naturally isolated AND likely more accurate in this situation. The reason has to do with the reactance of the stray inductance in the sense resistor approaching or even exceeding the actual resistance value, which exaggerates the output voltage as the frequency goes up.

5. buck inductor - the core material and number of turns of the inductor should be specified with a bit more care. I like to use this site:

http://schmidt-walter.eit.h-da.de/smps_e/abw_smps_e.html

to get a reasonably accurate initial estimate of the component values needed.

Now, please edit that circuit before someone here with even less knowledge/experience builds it with even less suitable components and destroys their battery pack, burns down their car/garage/house/whatever.
See less See more
  • Like
Reactions: 1
Well done. I'm looking at something like this myself but am thinking of a more traditional 50hz transformer based design.
with even less knowledge/experience
That's a little bit hostile - don't you think?

OK - I missed out the fuses, and the bleed resistors. I'll update it in a minute.

Isolation from the mains. The IGBT driver is opto isolated from the microconroller. The current and voltage sensing is more difficult. One option I considered was to use an A to D board with an optical data link to the main board. Do you have a constructive alternative suggestion?

http://schmidt-walter.eit.h-da.de/sm...bw_smps_e.html - the site you suggested is very good. Wish I'd seen it previously.
To use this, the only bit you cannot work out for yourself is frequency - and it's about 41kHz. For my application it suggests 500uH inductance with 2.5mm wire. The inductance I'm using is a bit bigger than that - but it seems to work OK.

Is this really any more dangerous than using a bridge rectifier and a kettle element or capacitor as a current limiter as a battery charger? However, Tesseract's response to the thread on that one was:
Good luck, and don't forget your safety glasses with this one
I'm obviously missing something.

I agree in general with your points - but the point of this was to make something low cost which is better than a kettle element! It's not supposed to be competing with multi thousand dollar chargers - so treated with the same caution you would extend to a kettle element current limiter, it should not be a problem.

Si
See less See more
This is a fantastic idea. I am anxious to watch it's evolution.
Good news! It all seems to work rather well.

I built a charge profile from the info here and have achieved a 20% increase in range compared to charging the batteries withg a variac.

I'm charging at a constant current (8.5A) until the batteries get to 2.45v per cell (Bulk Charge). Then switch to constant voltage (limited to 2A) at 2.45v for a period of 4 hours (Absorption Charge). Then switch to a 2.27v per cell float charge which times out after 4 hours.

I've also fixed several of the bugs in the software and improved the voltage measurement calibration to within 1%

Si
Very interested in this as it looks like I too will be using odyssey batts. What ah capacity are you using and how long to recharge?
Mine are 50Ah (15 of them). The bulk charge depends on the degree of discharge but assuming they are completely flat, it should take about 6 hours plus 4 hours Absorption.

This was with the Optimas from the junk yard. Before I fit the Odysseys, I want to build something to limit each battery to 14.7v allowing them to auto equalise.

Si
Yeah i've been brainstorming on that also as the odysseys don't like going above 14.7v per batt and i'm worried that a "dumb" pack charger would cause damage even if the total voltage were limited. Its a tough ball of wax because even if you detect one bat at 14.7v others probably are not.
That's a little bit hostile - don't you think?
Not in the slightest. There's a reason the UL/CE/VDE etc. are in existence, you know. Has something to do with electrical problems being the number one cause of house fires I believe.


Isolation from the mains. The IGBT driver is opto isolated from the microconroller.
Indeed it is, but the rest of your circuit is not courtesy of your voltage and current sensing methods. Also, your gate drive resistor is awfully high and there is no return path for the gate current (ie - you need to connect the (-) output of the 15V DC-DC to the emitter terminal of the IGBT, and you ought to put a 15V TransZorb and at least a 10k resistor from gate to emitter).


The current and voltage sensing is more difficult. One option I considered was to use an A to D board with an optical data link to the main board. Do you have a constructive alternative suggestion?
There are many ways to transmit voltage level information across an isolation boundary. Probably the most popular is the venerable TL431 and an optocoupler. One clever method uses a self-oscillating flyback converter to produce an output proportional to its input. BTW - using a resistive divider is the same mistake K*lly makes in it's controllers, and why you get a little tingle from them if you happen to be touching the vehicle frame and a battery terminal at the same time.


http://schmidt-walter.eit.h-da.de/sm...bw_smps_e.html - the site you suggested is very good. Wish I'd seen it previously. To use this, the only bit you cannot work out for yourself is frequency - and it's about 41kHz. For my application it suggests 500uH inductance with 2.5mm wire. The inductance I'm using is a bit bigger than that - but it seems to work OK.
You have to make an educated guess about the frequency of operation. For a motor controller there is little advantage in going any higher than is necessary to render the motor silent (at least from the switching frequency); for an SMPS, though, there is considerable merit in going higher because you can use less inductance (= smaller core).

For a buck converter, specifically, using more inductance than called for is fine - it just shifts the boundary between continuous and discontinuous modes downward. Transient response is affected, but that's not normally an issue for a battery charger.


Is this really any more dangerous than using a bridge rectifier and a kettle element or capacitor as a current limiter as a battery charger?
Yes, it is more dangerous for two main reasons: 1) you have a big fat electrolytic capacitor in the circuit (and your precharge resistor needs to be shunted out by a relay, btw - you can't leave that 100 ohm resistor in there all the time and expect this thing to function worth a damn); 2) the other circuit had some form of current limiting impedance in the circuit whereas yours does not.

I'm not saying the "dumb charger" is better, just that yours has much more potential to do bad things.
See less See more
Great knowledge sharing!!!

Since you must have studied requirements for charging voltage - what do you think about 12V Scumacher charger:

When set to 8A it will:
- charge at 8A till voltage reaches ~14v, then will start to slowly decrease coltage, but will charge up to 16V, finishing at 1-2A
- once 16v reached, it will step back to 15.5v and hold that for 1-2 hours.
- after that switch to float mode at ~13.2

Similar scenario when set to 12A.

Batteries clearly get good charge, and hold 12.8 even after a 1-mile ride.
Chargers have another mode of charge, for GEL type of batteries, and will supposively set lower cutoff voltage, but i haven't played with it yet.

Is it too muhc of charge?
See less See more
Those Odyssey battery chargers look very similar to the Schumacher chargers. I would guess they are the same with a different sticker.

http://www.odysseybattery.com/chargers.html

http://store.schumachermart.com/sc-1200a.html

I wonder if a couple of the Schumacher SC-1200's could be put in series......

Brian
I can try , but doubt it, about series. Besides, why would you do that? To loose the balancing effect??

Nice link! I can't find such for Schumacher, but it is definitely a different algorithm in "Standard" battery mode. Chargers look similar, but can be programmed differently.
I am using 8 volt batteries. Two of these Schumachers in series would hopefully make a 24volt charger so I could charge three 8 volt batteries off of two of them. Just brainstorming..........

Brian
I think i have spotted something usefull for my Keystone Interstate (from costco - http://www.batteries-faq.com/activekb/questions.php?questionid=1

BUlk charge - 14.4 but absorbtion - 15.5 ! Schumacher goes a bit past 15.5 but then runs absorbtion charge at 15.5.

Tested GEL mode - charger will go up to 14.5 volts, and stay there for some hours, didn't catch exactly how much. THen go to float.
Interesting, but that almost exactly what Odyssey recomends. Are odyssey - gel batteries?
Nope, the popular odyssey batteries are agm. Many say they are the best agm batteries you can buy.
OK - I've used TL431's in this kind of configuration before:
http://www.powersystemsdesign.com/design_tips_june07.pdf
All be it a long time ago. They are a fine way of providing isolation on an analog signal.

However, this has been where the microcontroller shares it's -ve terminal with other stuff like the casing or heat sink.

In this case the buttons and display on the controller are plastic - and are behind another layer of plastic to insulate the user from the controller. Why does it matter if the microcontroller is isolated or not? There is no electrical connection between the controller and the outside world (other than to the mains and batteries).

In any case, if I were going to go down that route, I would probably just isolate the buttons and display through simple opto's. Likewise if it had a data / rs232 connection.

(ie - you need to connect the (-) output of the 15V DC-DC to the emitter terminal of the IGBT, and you ought to put a 15V TransZorb and at least a 10k resistor from gate to emitter)
I had missed a connection between the IGBT Emitter and the A3210 driver which I have corrected.

The 590R is a bit high, but the 15v DCDC converter could not deliver the current that a smaller value would pull which resulted in a lot of ringing. 590R was just a compromise which seemed to work. With a higher power DCDC, the value can be lower. If the DCDC can spit out 2A continuous, a 100R resistor works well.

The A3120 doesn't need a 10k bleed resistor to switch the gate off - it has a pair of transistors on it's output - one to pull up and the other pull down. As it stands, the switching waveform is fairly symetrical.

A transorb is a good idea though for a bit of extra protection of the IGBT.

I'll maybe re-draw the circuit with a few of these thoughts included.

Si
See less See more
Nope, the popular odyssey batteries are agm. Many say they are the best agm batteries you can buy.
Since AGM is just another type of VLRA battery- they must have the same charging pattern. Previous model of 12/8/2A charger has Gel and AGM types on the same button.
So Shumacher chargers indeed hold the correct charging for different types of batts! I guess I am ok with using Starndard setting for my floodies.
Just a mad idea but what about using part of an inverter arc welder. You get a mains rectifier with filtering , switch mode psu. May need to rewind the hf transformer secondary and play with the feedback control etc.
1 - 20 of 566 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top