# Battery temperature monitoring

Discussion in 'Embedded Systems and Microcontrollers' started by yasinji, Mar 12, 2012.

1. ### yasinji Thread Starter Member

Mar 25, 2009
12
0
I am developing an alogrithm for battery charging. I am using PIC16f685 processor and CCS C compiler for programming. The problem is I am using a NTC(Value 30K) to measure the ambient air temperature inside the battery box. The NTC is used in a voltage divider from 5VDC reference as 30K NTC parallel to 33K 1% SMD resistor in upper arm and 10K 1% SMD resistor in lower arm. The NTC resistor value changes from 108K@0deg to 30k@25deg to 9.79K@50deg to 1.8K@100deg. The equivalent parallel value with 33K changes accordingly and the voltage across 10K which sensed by adc port changes accordingly as 1.42V@0deg to 1.94V@25deg to 2.8V@50deg to 4.28V@100deg. Now I got a voltage wrt temperature and correspounding didgital values are read from adc result register. How can I write code for program to understand 1.94V correspounds to 25deg or a 2.09V correspounds to 30deg celusis. Please help.
I am a newbie in C programming. I thought of a Lookup table array but with the 10bit adc resolution the digital value changes from 290 to 877. How can I implement a lookup tablefor this. or there is any other easy method Pls advice. Also if I measure the ambient temperature inside the battery box and correct the high battery cut off according to that -5mV/Cell/deg c does the battery get properly charged.

Last edited: Mar 12, 2012
2. ### t06afre AAC Fanatic!

May 11, 2009
5,939
1,222
Hi can you use LM35( or M34) for the temp measurement. Much more simple to read

3. ### yasinji Thread Starter Member

Mar 25, 2009
12
0
The task given to me is to measure ambient tempearture using NTC rsistor which is much cheaper compared to LM35. pls help

4. ### John P AAC Fanatic!

Oct 14, 2008
1,638
225
Have you got the actual T-vs-R curve for the thermistor you're using? If so, you can do an Excel plot over the range of temperature that you need to work with. Then do a calculation for the resulting voltage (which the A/D will see). Suppose you assume that the voltage is linear with temperature--how much error would there be? What if you break it up into 2 or 4 segments, is the error acceptable then?

This will work better if the thermistor is in contact with the battery, not just sensing the air temperature near the battery.

5. ### t06afre AAC Fanatic!

May 11, 2009
5,939
1,222
It would help to know which NTC you are using. The data sheet will have a formula for the resistance as a function of the temprature. The data sheet my also have some suggestions then absolute accuracy is not that important. The ADC has ten bit. That mean you can split up the lookup tables into 4 tables that each contain 255 values. These tables may be generated by some cumputer program. I must admit it will be more elegant solutions. But well as a last resort it is doable. If you have enough free flash memory that is

6. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,442
1,628
I always want to back up and understand the problem before offering solutions. You have an NTC resistor to measure temperature, OK.

Over what range and what accuracy do you require?

7. ### yasinji Thread Starter Member

Mar 25, 2009
12
0
The Ntc used ic 30K at 25deg. I have attached T vs R curve for the NTC.

File size:
94.6 KB
Views:
27
8. ### MrChips Moderator

Oct 2, 2009
12,646
3,458
If you are using the thermistor to monitor battery temperature then I can assume that accuracy of temperature is not critical.

Use a voltage divider with voltage into the 30K-ohm thermistor and a 5K-ohm series resistor to GROUND. Measure the voltage across the 5K-ohm resistor using an ADC. You can adjust the fullscale voltage reading by changing the value of the resistor.

The response curve is fairly linear from 25C to 100C.

Here is the Voltage vs Temperature curve:

Last edited: Mar 15, 2012