Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Battery Monitoring Device

Status
Not open for further replies.

Tom81

Member
Hi guys,

I'm planning on building a battery voltage monitoring module (using a PIC16F88) for some testing we are doing at work. Here are the requirements:

A specific load is applied to a battery. The purpose of the module is to continuously sample the battery's voltage as it is gradually discharged, then remove the load via a relay once a pre-defined voltage threshold is reached. Voltage output is displayed on a 4x7segment display.

I think I have most of the circuit and programming worked out. Just seeing if anyone could provide some advice on the following?

THRESHOLD ADJUSTMENT
I'd like to be able to set the voltage threshold before the load is applied. Threshold can be adjusted between 7.3v and 25.5v. I was thinking of using the PIC's ADC for this, in conjunction with a pot/resistor circuit as per PDF attached. (NOTE - the switch is just there for another input so I could save on pin usage).
If I set the ADC high and low voltage references to Vss and Vdd, do I need a resistor before the Micro's input pin to limit current? Or can I put voltages (between 0 and 5v) straight into the input pin when using ADC?
What are the consequences of drifting outside 0 and 5V at the input pin? Should I use a 5V Zener to limit input voltage at the pin?

RELAY CONTROL
I'm planning on driving the Relay using an NPN BC547, switching from the Micro via a 1K resistor at the base. Relay is 12V, so current would be around 100mA. I'll admit I'm not great with transistor calculations - Would the transistor be able to handle the current?

Any feedback or questions, let me know. Thanks in advance.

-Tom
 
If a PIC input pin is set up as an ADC input, the input leakage current is small, but the source impedance should be less than 10K. The voltage should NEVER be allowed to be more positive than Vdd or more negative than Vss.

Your idea of sharing the ADC input with the switched digital input is questionable. If the wiper of the 5K pot is run all the way to the +5V end, the switch will put a dead short on the +5V power supply.
 
Hi Mike,

RE Dead short - Thanks for pointing that out, I completely missed it. How does this look?

View attachment 67629

With the switch closed, I'm able to read voltages (between approx 1.43v and 5v) as the pot is adjusted. If the switch is opened, the micro will see 0V, regardless of pot position.

-Tom
 
Should work in that position. I assume that where the diagram says +5V, that is really the battery input?
 
The battery is acutally 12~13V. The circuit above is just for the threshold adjustment. Although the supply voltage for the pic will also come from the same battery voltage that's being measured. I'm using a 7805 REg for the pic. I kept the minimum threshold setting at 7.3v. This should take into account the minimum input voltage required for the reg (IE 7V). In reality I'll never need to go that low anyway.

For measuring the battery voltage, I was thinking of using a second ADC pin and a voltage divider circuit (to drop the voltage by a factor of about 5.1).
 
The ADC inside the PIC is ratiometric, meaning the reading is a ratio based on Vdd. A 7805 is not very precise, so your battery voltage reading can be only as accurate as the voltage produced by the 7805. If you care about accuracy, then get a precision voltage reference in lieu of the 7805.

If you are discharging a deep-cycle lead-acid battery, you shouldn't go below about 10.5V. If it is an automotive starting battery, you shouldn't be going below 11.5V (at room temperature). Under charge, these batteries can go as high as 14.5V. If the task is to read this range, if you use just a resistive voltage divider, you will only be using a small part of the PIC ADC range. I used an external opamp which has the appropriate gain and offset to create a signal that goes 0-5V while the battery voltage goes 10 to 15V.
 
Last edited:
Hi Mike,

Good point on the V ref, I'll probably use an LM336.

As you have probably guessed, for the range I've used 0-25.5v to make it easy for programming, during the ADC conversion from 8-bit (FF) into a voltage (IE 0.1v per bit). I don't really need a high level of precision, so this range should be adequate.

Thanks for the suggestions, I'll post up a full schematic once I get around to finishing it.

-Tom
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top