I've designed the following circuit for a battery charger. With the PIC just turning the output on and off when it is charged. For the program design what would be better, to have the analogue input constantly checked? Or to have the output on for the charge time then to move to the second?

|
|
|||||||
|
|
your schematic contains more then one mistake. Any pin of the µC can only handle 5V. Going above 5V without limiting the input current will damage the µC. IN your circuit, this can happen when the battery fails open circuit or when the battery is removed. You should add a series resistor with the input and a capacitor to ground on the ADC pin. The resistor can be 100K and the capacitor 100nF. You will also need a diode connected between the ADC input pin and the 5V power supply and a 'dummy load' across the 5V supply. This will prevent the µC from powering itself from the battery trough the diode between the ADC input and the supply pin of the µC. 10K will do. (And that's the reason I've chosen the 100K resistor between the battery and the ADC input. The 100nF capacitor will correct the input impedance seen by the input of the ADC. (The ADC uses a sample and hold. Now the sample and hold capacitor can charge itself by stealing some charge from the 100nF capacitor and it also makes the input less sensitive to noise.) Secondly, the drop-out voltage of the LM317 is to high if you want to charge 4 series connected cell's. The battery voltage will reach 6.2V and an LM317 needs 3V to operate (min. voltage between in and output). And then you also have the 1.25V drop across R1. That's 9V - 4.25V= 4.75V. Oh, and while I write this it occurs to me that disconnecting the power supply while the battery is still connected will damage the LM317. You will need a diode between the battery and the LM317. That's an other 0.5V if you use a Schottky diode. You might be better of using a PNP transistor and an op-amp to construct a low drop current source. And there sure are more elegant ways to disable the current source. Over driving the ADJ pin can save you a power-mosfet. (It takes two small resistors and an NPN transistor with the appropriate biasing resistors.) Regards |
|||||||||||
|
|
Depending on the chemistry of the battery you'll want to be very careful about overcharging. Here is a page describing attributes of various batteries: http://www.batteryspace.com/batteryknowledge.aspx Down near the bottom is the overcharging tolerance information. You have to be very careful with... well, everything except lead-acid batteries. Deciding when to stop charging or how to moderate the charging rate is very important in battery chargers. This page describes designing a PIC-based a NiCd/NiMH charger and discusses the important aspects of the charging method. Quickly though:
There's a lot to keep track of and bad things can happen if you try to charge the battery the wrong way. In general your schematic is good but it's the internals of the PIC that are going to be the important part here. Good luck. Edit: Followup question: is that really a 5V NiMH battery? If so, that's nominally 1.25V/cell and four cells = 5V. Okay, good deal, but you'll want to charge the cells up to about 1.4-1.6V. With four cells, that turns out to roughly 6V. You can't measure 6V with the A/D of the PIC and it may be dangerous for the PIC to have those voltages on its pins- check the absolute maximum voltage rating of that pin. It's usually VCC + something. In any case, you'll need a voltage divider to read the full range of the battery so you know when it's done charging. Bottom line: that circuit won't work unless I'm mistaken. And I have been known to be. Anyone confirm? |
|||||||||
|
