Go Down

Topic: Temperature sensor (Read 5 times) previous topic - next topic

carl47

Nov 30, 2009, 10:26 pm Last Edit: Nov 30, 2009, 10:39 pm by carl47 Reason: 1
I am making a weather station using Arduino 2009.
The Arduino adc has 10 bits as do most of the digital sensors.
My indoor temperature range is 0 to 40 C. Using the full range of
the adc the best accuracy I could get is 0.04 C per binary step.

There are many temperature sensors on the market:

http://www.chipcatalog.com/Cat/65.htm

The digital output devices all have a LM335 type device a dc amplifier,
a adc converter and then a serial transmit circuit.
The format of the serial data can be the Dallas Semiconductor 1-Wire or I2C or SPI.

The AD7416 is only a few dollars and has a 0.25 C per binary step and is at:

http://www.datasheetcatalog.org/datasheet/analogdevices/422626197AD7416_7_8_e.pdf

Looking now at the old standby the Lm335 is at:

http://www.datasheetcatalog.org/datasheet2/0/01g1j31dx93i4k0k0qag4l8914py.pdf

If I connect the LM335 output to an analog input and use the 5.0v internal AREF
the following will occur:

0.5C per binary step

If I set AREF to 3.3v and include in code         analogReference(EXTERNAL);
the following will occur:

0.3C per binary step

We are not getting the accuracy because the Lm335 voltage swing is only a
small proportion of the adc operating range.
We need a dc amplifier. One device has it incorporated. The AD22103 is at:


http://www.datasheetcatalog.org/datasheet/analogdevices/630448615ad22103.pdf

We now get this result:

0.1C per binary step

This is getting close but we cant have negative temperatures.
My outdoor temperature range is to be -10 to 50 C.
I decided that the best answer for my requirements was to use a LM335 and
a seperate dc amplifier.

The amplifier needs to be single supply and have a large % voltage swing.
You do need a larger regulated voltage. I power my arduino with 9v so I used
that supply and then divided down to give me the full 0 to 5v swing.

I chose the LM3900. Application notes are at:

http://www.national.com/an/AN/AN-72.pdf

We now get this result:

0.04C per binary step

The sensor circuit and other files are at the site given below.
Download LM335.zip

http://sourceforge.net/projects/arduinoweather/files/


Code: [Select]
/*  A simple temperature sensor check program
   The circuit uses one point calibration.
   Adjust the pot to give the known ambient temperature.
*/

const int analogpin = 0;  // Analog input pin

void setup()
{
 Serial.begin(9600);   // initialize serial communications at 9600 bps:
}

void loop()
{
 int adcvalue = analogRead(analogpin);    // read the analog in value:            
 Serial.print("sensor = " );                        
 Serial.print(adcvalue);    // print the adc value to the serial monitor:
 double temp = adcvalue / 25.6;  //convert it to Celsius
 Serial.print("\t temp = ");      
 Serial.println(temp);   // print the temperature
 delay(1000);   // wait 1 second before next sample                    
}

tytower

#1
Nov 30, 2009, 10:43 pm Last Edit: Dec 01, 2009, 03:56 am by tytower Reason: 1
I had to go to the digital DS18B20 [thanks] sensor to get accurate results .
Analog sensors seemed accurate but when you looked hard they fell down . Whether you run from usb or battery is important . The usb voltage in on mine was 4.68V so adc  was mapped to 0 to 4680 rather than 0 to 5000. But then when you went to battery it all changed and your conversions were out again.

I established that accuracy could be +-2 C with analog devices . Hence the shift to Dallas and OneWire

EriSan500

I guess tytower meant DS18B20 from Maxim.  ;)

Greetings,
EriSan500

carl47

Thanks...you are right about the USB supply.
Not only is it variable it carries digital noise. It is clean enough
for digital but has too much noise for analog circuitry.

At the RMIT university they use a Atmel board for student projects.

http://pjradcliffe.files.wordpress.com/2009/03/open_usbio_schematic.pdf

You can see that they use L-C filters for Vcc and another for the Aref.

I have my Arduino setup as a remote monitor. It runs from a
regulated 9v supply.
When connected to the computer with USB it will
still be using that supply.
At their core all digital sensors have an analog sensor. They will
have a very stable adc. As long as the arduino adc is stable(with stable Vcc)
a LM335 can be just as good.

I have been comparing my logged data over a couple of weeks with my
Oregon weather station. There is very close agreement - not scientific
I know but I'm not commercial It's just for myself.

The DS18B20 can be set to 12 bit adc so that it can give:

0.0625 C per binary step

So it will work as well as my circuit.

carl47

If anyone has tried this circuit for a  temperature sensor, some feedback would be appreciated.
:)

novice

Which circuit are you referring to?.

Is the RMIT board available for purchase?.

Juissi

I am using the DS18B20 in my project. Works fine and the 1-wire interface is pretty handy.

-Juissi

carl47

Quote
Which circuit are you referring to?.


Thats my circuit for the lm335 with a dc amp.
I'm happy with it, but if any one tries the circuit and has a different result I would like to hear about it.

The RMIT board is at:

http://interestingbytes.wordpress.com/hello/open-usb-io-interface-board/

Quote
1-wire interface is pretty handy.


I know it is a really good system.
It does lock you in once you use it. I would like the freedom of using
whatever weather device I choose.

Thanks for your replies.
;)


Go Up