Low Voltage Disconnect. ADC problem

jcgalvezv

New Member
I am trying to use a PICAXE-08M to control the low voltage in a Li-Ion battery and disconnect the circuit when the voltage is 3.5 Volts or less.

I connected an 1N4148 diode between the battery positive terminal and PICAXE-08M ADC2 port.

This is the test program:

Code:
symbol VOLTPORT = 2
main:
    readadc10    VOLTPORT, w1

    sertxd (#w1 , 13, 10)

    pause        500
    goto        main
.

In this test I didn't take several reading to average because I just wanted to know the value for a single ADC reading.

This is the ADC reading I am getting:

Code:
424
300
404
302
226
430
403
245
410
445
250
300
401
299
224
406
372
242
434
436
263
375
431
250
289
397
...
Since the current battery voltage is 4.15 volts and the voltage drop in 1N4148 is 0.7 volts I should be getting an ADC reading of 851:

4.15/1024 = 0.004052734375

3.45 / 0.004052734375 = 851

Why am I getting those inconsistent ADC readings?
 

Technical

Technical Support
Staff member
Do you also have a resistor to 0V? If not there will be no current flow through the diode (the ADC is high impedance) and so the reading will not be as expected.

What you should really do is V+ to resistor to diode to 0V, with the ADC connected at resistor/diode joint.

Are you also using a AXE027 USB cable (5V logic)? If not the RS232 voltages associated with the serial cable & serial commands will also affect the readings.
 

jcgalvezv

New Member
Thank you Technical for your reply and help.

I connected V+ to diode, diode to resistor and resistor to 0V and that solved the problem.

Now I am getting the correct values.
 

retepsnikrep

Senior Member
Also are you trying to get the Picaxe to measure it's own supply voltage (your cell) ?

Or is it powered independently?
 

jcgalvezv

New Member
Also are you trying to get the Picaxe to measure it's own supply voltage (your cell) ?
Yes. I need to use PICAXE-08M to measure its own voltage which is the controlled circuit voltage. PICAXE-08M works as a switch here to disconnect the measured circuit if the battery voltage drop under 3.5 Volts.
 

BeanieBots

Moderator
Be aware that the volt-drop of a diode can vary with temperature. The difference is particularly large at lower currents.
Be pesimistic with your cut-off voltage.
 

jcgalvezv

New Member
Be aware that the volt-drop of a diode can vary with temperature. The difference is particularly large at lower currents.
Be pesimistic with your cut-off voltage.
Thank you BeanieBots for your reply.

What else more accurate could I use to create this voltage drop to be able to measure the current battery voltage?

Is this voltage drop variation linear with temperature variations?
 

BeanieBots

Moderator
Ideally, you should use a "proper" reference voltage such as a "REF03" 2.5v precision reference.
What you choose to use depends on how accurate you want it.
You could even turn it around to your advantage. I don't know a great deal about LiPos but Pb voltages are temperature dependant. So, if your battery should be turned off at a different voltage depending on temperature, it would be a feature. If the temperature effect on your diode goes the wrong way, then just swap the diode and resistor positions. (adjust the code accordingly).

Most diodes are fairly linear with temperature. Unfortunately, the characteristics of the 1N4148 (and many others) depends on the manufacturer. Here is a typical datasheet. It shows Vf against If at several tempertures.
http://pdfdata.datasheetsite.com/web/39445/IN4148.pdf

I often use an LED as the "reference" but again, check the datasheet.
A good quality zener diode will probably do the job, check the datasheet.
Datasheet, datasheet, datasheet.
Did I mention, check the datasheet.
 

LizzieB

Senior Member
If you do the math you'll see that increasing the voltage drop across the "voltage reference" will make the D/A output much more responsive to changes in supply voltage. If you are sticking with the 1N4148 then put three in series. The forward voltage (of each diode) will change by about -2.3 mV/°C.
 

retepsnikrep

Senior Member
You need a reliable voltage reference in order to measure the changing cell voltage if it is also powering the Picaxe.

This is exactly what I am doing with my Li-fepo4 battery management project.

We are using an LM385 1.235v ref, and can measure the changing cell voltage to within about 20mv.

See the software I wrote here

http://www.solarvan.co.uk/bms/SlaveAnalogueOnOff031108_v1_09.txt

I'm sure if you read this you can deduce how we measured the voltage and extract the parts you need.

My schematic for this software is below, again you can use the bits you need and leave out the rest. The resistor R5 can also be increased to at least 100k+ to help reduce power consumption.

http://www.solarvan.co.uk/bms/AnalogueSlave080908.jpg

The cpu speed can be tweaked down as well to reduce current to a minimum.

Test the circuit for accuracy by leaving the programming lead connected and watching the CellV variable in the program editor by inserting the 'debug' command into the code.

Adjust the constant RefVADC until the reading is as accurate as you can get.

symbol RefVADC = 63200 ;Fixed Ref Voltage Calibration LM385 1.235v * 1023 * 100 / 2 = 63200
 
Last edited:
Top