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 voltage measurement

Status
Not open for further replies.

Scarr

Member
Hi,

I'm going make a battery monitor circuit (below, not my design) I want to be able to detect 3.41v

Apparently this circuit will allow the voltage to rise at the A/D pin as the battery voltage drops and allows me to turn it on/off

Anyone got any suggestions on the diode to use to give best performance under various temperatures, also anyone any idea what sort of fluctuation I will get due to temperature etc.


Code:
                                       Vcc = Vbat 
                                          --- 
                                           | 
                                           | 
                                 ------------------- 
             R1                 | 
             10k                | 
 ------------/\/\/\-------------| Digital i/o 
|                               | 
|                               | 
|                               |        PIC 
|            Vref               | 
 -------------------------------| A/D input 
        |          |            | 
       --- D1     --- C1        | 
       / \ zener  --- 0.1uF     | 
       --- 1.5V    |  optional  | 
        |          |             ------------------- 
        |          |                       | 
       ///        ///                     /// 
       GND        GND                     GND
 
Scarr said:
Hi,

I'm going make a battery monitor circuit (below, not my design) I want to be able to detect 3.41v

Apparently this circuit will allow the voltage to rise at the A/D pin as the battery voltage drops and allows me to turn it on/off

Anyone got any suggestions on the diode to use to give best performance under various temperatures, also anyone any idea what sort of fluctuation I will get due to temperature etc.

Your question is a bit confusing?, are you wanting to monitor the supply voltage to the PIC?.

I would suggest using an external precision reference for the A2D (see my PIC analogue tutorial for details). With the reference accurately fixed the A2D input can simply be connected to the Vdd supply by a simple resistive attenuator, allowing you to monitor the Vdd voltage.
 
I don't think it will allow the voltage to rise as the battery voltage drops.
If you are using the Vcc as the reference voltage then it may allow the reading to rise. Wearing smaller shoes doesn't make you feet get bigger, although it might feel like it does.
 
Using a TL431

Hi Nigel,

I got the circuit from another forum :(

First, let me clarify what I'm trying to do, I want to monitor the battery supply to my project, all components are supplied by the same battery.

I normally use what I term "black box" electronics only becuase I'm not very good at electronics :lol:

When I say "black box" I mean IC's that have defined functions and I/O so I know what I'm getting like a "TL7701 voltage supervisor" I was going to use this in my design but I then started to think is there a simpler /cheaper / less space way, hence finding the circuit.

The other forum are saying replace the diode with a TL431 voltage ref and a 1k resistor and this will work better (or maybe even work at all!!)

I might just go back to the TL7701 as I'm loosing it :cry:
 
Re: Using a TL431

Scarr said:
The other forum are saying replace the diode with a TL431 voltage ref and a 1k resistor and this will work better (or maybe even work at all!!)

The TL341 is what my tutorial uses, it's a precision voltage reference, a zener would be pretty useless for this.

What is your actual supply?.
 
Re: Supply is...

Scarr said:
Hi Nigel,

It's 3.6v and I want to detect 3.41v and then flash a LED.

You should be OK then, use the TL341 as an external 2.5V reference (as my tutorial does) and connect one of the A2D inputs to Vdd via a potential divider. You can then measure the supply voltage and act accordingly.
 
Looking for advice again!

Hi Nigel,

I was originally going to use a TLC7701 but I wanted to save space on my board, however I am worried about accuracy, when you read about monitoring voltages it look like a black art :)

Do you think your suggestion will suffice with what is a 5% voltage difference or is the TLC7701 going to give me waht I'm looking for?

Thanks
 
Re: Looking for advice again!

Scarr said:
Hi Nigel,

I was originally going to use a TLC7701 but I wanted to save space on my board, however I am worried about accuracy, when you read about monitoring voltages it look like a black art :)

Do you think your suggestion will suffice with what is a 5% voltage difference or is the TLC7701 going to give me waht I'm looking for?

I see no reason why the TL341 wouldn't be fine, compare it's spec with the TLC7701 - or simply get one and test it?.
 
Nigel.

I'm back again Nigel,

First, please don't hit me for keep going on about this, but in my circuit I am already using a comparator in a vibration detector circuit (taken from here https://www.electro-tech-online.com/custompdfs/2005/10/motionalarm2.pdf)

Being a complete newb, I started looking at this and I think it might do what I want? it's small, I think it fulfils my 5% criteria, I have some already and it's almost understandable (for me that is)

The only problem is all the other voltage comparators when used as a voltage monitor show a potential divider on the spec sheet with info on what to do, however, this one does not, therefore I’m lost and need help again.

1) Will this do as my battery monitor
2) Can I simply use a potential divider to create the threshold voltage
3) If the answer is yes to the above, is there anything else I should be aware of with this device?

Thanks again.

P.S. Sorry for not mentioning this before but I didn't realise what this little IC was and how usefull it was.
 
Re: Nigel.

Scarr said:
The only problem is all the other voltage comparators when used as a voltage monitor show a potential divider on the spec sheet with info on what to do, however, this one does not, therefore I’m lost and need help again.

1) Will this do as my battery monitor

It 'could' do, but it means you're adding an extra IC.

2) Can I simply use a potential divider to create the threshold voltage

No, you would be comparing two similar changing values - your reference MUST stay constant - so you could use a TL341 as the reference for it. But again, it means adding an extra IC, when you already have the PIC that is perfectly suited for the job (you've nevermentioned what PIC it was, I presume it's got A2D inputs as your diagram shows?).
 
Of course it would!!!

Hi Nigel,

You see I keep missing the obvious stupid flaws!!

The MCU is an AVR Atmega128 not a PIC (Diag. was someone else) so yes it's got A2D and finally I will stop messaging around and go with the TL431 as you suggested.

The problem with electronics is there is always another way to do the job.

Thx for all your help.
 
Re: Of course it would!!!

Scarr said:
The MCU is an AVR Atmega128 not a PIC (Diag. was someone else) so yes it's got A2D and finally I will stop messaging around and go with the TL431 as you suggested.

Does the AVR have an external reference input like a PIC?.
 
Back on this!!!

Hi Nigel (or anyone else who wants to comment,

Sorry for long delay, I have now come to the point where I need to implement this voltage detector and have more problems!!!

I managed to read the voltage at ADC0 pin 61 of the Atmega128 I didn't need an external VREF after all as the M128 has a internal 2.56v VREF. So reading the voltage works fine simply a voltage divider.

However, when I go into low power mode and I turn off the M128 (using a ATtiny13 controlling the REG) I had managed to get the current down to 1.8ua. With the voltage divider attached it draws way too much current, I tried conecting the GND side to a M128 pin hoping this would solve it (as I thought it was not being driven low when off) but still too much current is being drawn.

It even draws too much current when I disconect it from GND altogether! I think it's sinking current via the ADC pin!!! (I know it's the voltage divider thats drawing current by simple disconetcing it from +v and the current drops again)


Anyone any suggestions how I can turn off a voltage divider.
 
Re: Back on this!!!

Scarr said:
Anyone any suggestions how I can turn off a voltage divider.

Simply use higher value resistors in the potential divider?, but you need to consult the datasheet to see how much current it might need.

Or, you could try using an I/O to feed the top of the potential divider, switch that pin LOW (or as an input) before calling sleep. Even fed from an I/O pin it should still function perfectly as a battery voltage monitor. With this method you could also only check the battery periodically, saving the current drain of the divider except for when you actually test.
 
Hi again Nigel

Hi Nigel,

If I connect a MCU pin as the voltage divider feed won't I be measuring the output of the PIN minus the voltage drop due to the divider? (See PIC)

I will try the increased resistance whilst I await your reply.

Thx Nigel....
 

Attachments

  • divider.jpg
    divider.jpg
    9.1 KB · Views: 388
Re: Hi again Nigel

Scarr said:
Hi Nigel,

If I connect a MCU pin as the voltage divider feed won't I be measuring the output of the PIN minus the voltage drop due to the divider? (See PIC)

Yes, but the output voltage of the pin is directly proportional to the supply voltage - and not 'minus' the voltage drop due to the divider, but 'divided' by the ratio of the divider (hence it's name).
 
Nigel

Hi Nigel,

The MCU is running of a 3.3v reg, not sure if this was or was not stated earlier but it is the case now. I have increased R1/R2 to 2m and the current is now nicley down to 3.8ua when off, also the voltage reading looks good (not sure if this will change with time / temp but when the actual voltage is 3.81 I get 3.8192 and this accuracy good when I change the voltage up and down.

So with your help it looks like this part is done.

Thx for all your help and patience.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top