Talk About the Latest in Home Automation/Home Electronics -
Home Automation Forum

Smarthome Forum
Insteon Home Automation
Login or Register
 
Home | Profile | Register | Active Topics | Search | FAQ | Smarthome
 All Forums
 General Discussion
 Lighting and Appliance Control
 Accurately measuring temperature with Arduino
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

yamadanao614
Starting Member

2 Posts

Posted - 07/27/2017 :  02:35:33 AM  Show Profile  Reply with Quote
I'm trying to build thermostat with Arduino. I want to power it using mobile phone battery/charger which makes system voltage quite variable. Right now I use Arduino Uno, but once it is complete I will port it to Lilypad.

First I tried to use TMP36 temperature sensor. So far it was complete failure. While the sensor itself appears to be very stable, I can't figure a way to accurately measure its voltage.

Using built-in 5v reference for analog sensors isn't working at all -- even powered from USB arduino's +5V are actually +4.8V (which shifts measured temperature by few degrees). When the board is powered from the battery, voltage drops to about 4V and measured temperature sky-rockets. I also tried to use +3.3V from the board as a reference. It seems to be more stable when the board is powered from USB, but its voltage drops when running off the battery.

How about ds18b20? Here is the datesheet:http://www.componentschip.com/pdf/6a-DS18B20-T-R.pdf


Is there any other way to reliably measure sensor output voltage?

For the second stage I'm planning to use thermistors. Just ordered a couple of these 20K thermistors.

From what I understand, these should be easier to measure accurately if I build voltage divider and use V_in as reference voltage for ADC.

A couple of questions about them:

Does it make sense to use few voltage dividers with different fixed resistor to increase accuracy?
I can use programmable pin as V_in, and measure temperature using few different voltage levels. Though its not clear to me whether this will actually increase accuracy.


Edited by - yamadanao614 on 07/27/2017 02:36:17 AM

Geo
Advanced Member

Canada
732 Posts

Posted - 07/27/2017 :  09:00:13 AM  Show Profile  Reply with Quote
You're looking at two different issues. First, make sure the sensor operates within its operating voltage range. TMP line of sensors operate from 2.7V to 6.6V. As long as you're within this range you're fine. The question is what precision are you shooting for? The type of TMP (or LM35) sensors give you 2C (3.6F) accuracy with 0.5% linearity. These sensors are based on temperature dependance of semiconductor junction. DS18B has better performance and, more important, its output is digital, thus not relying on the accuracy of Arduino or any other analog-to-digital (ADC) converter. The best achievable resolution of the above sensors is 0.5%. For better accuracy you'll need to look at other types, more expensive temperature sensors such as RTDs (0.01%) or thermistors (0.1%).
Your second problem is the Arduino operating voltage. When powered from a USB its internal voltage is about 5V, depending on the accuracy of the USB output, which obviously affects the reference level and consequently the digital value of the temperature. Using 3.3V reference gives you better results, although, given the small range of the sensor analog output there should be an amplifier between the sensor and the ADC input to improve the resolution (Arduino is 10 bits only) and reduce noise (make sure the TMP or LM sensor is properly loaded to prevent oscillations!). In any case, you should eliminate any temperature reading discrepancy by calibration which can be done by including an offset in software.
Finally, when running from a battery, that means using the Arduino power input, you need to supply minimum 7V and maximum 12V, because the power goes through an internal regulator which provides a voltage drop. Once the battery is below 7V the Arduino internal voltage drops below 5V and the whole thing goes haywire. Consequently, your battery should be 12V and you should provide its monitoring to cut off at 7V. Alternatively, have it connected to a charger and float it.
Running Arduino off a battery is not a very good idea because of its fairly large power draw. There are micros available designed specifically for battery operation with much lower power requirements.

GJN
Go to Top of Page

Geo
Advanced Member

Canada
732 Posts

Posted - 07/27/2017 :  09:15:34 AM  Show Profile  Reply with Quote
Little more about the thermistors. They are definitely not easier for measuring temperature.
First, thermistors are non-linear. They are OK to establish, for instance, a trigger point. For temperature measurement their output can be linearized using a resistor network. They require excitation, which takes power and the linearization is in the form of "S" curve, so that you may have three accurate points and settle for an error everywhere else. The smaller the measurement range, the better. Manufacturers provide the linearization data in their spec sheets. The operating voltage is crucial, as the current through the thermistor will heat it up and thus offset the actual temperature.
For more accurate measurements you digitize the output (once again, is 10 bits resolution of Arduino OK? 12 and more bits resolution requires good hardware design. Once digitized, you may calculate the actual temperature, algorithms are available for some thermistors or use a look up table. Its development is a lot of work, especially if you want high resolution. You measure, say, the output at every 0.1 degree and enter it into the table.
There are also ICs available (Linear LTC2983 for example) with a conversion algorithm already built in.

GJN
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Smarthome Forum © 2000-2017 Smartlabs, Inc Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07