Adequate temperature sensor for logging

So, I want to log the temperature in a room every minute for a day, to see how it fluctuates.

I have an Arduino Uno, so my plan was to connect a thermistor up to it to measure the temperature and then send this data through serial communication to software on a host PC which then logs it in a file.

My problem is that I have no experience of designing sensing circuits, and so I fear that what I plan to do with the thermistor will be woefully inadequate for its purpose.

Here is a crude diagram:

I know that it is kind of pathetically simple, I just wanted to know if it will perform with a reasonable accuracy. I can probably handle a reading that is 1*C out...

If it really is as bad as I suspect, are there any simple suggestions you could make to improve it?

If the voltage changes, the analog value changes.
You would also need to calculate the temperature.
And the 4k7 could change with different temperatures.

Search for DS18B20.
If you download the OneWire library, it has code in the examples for the DS18B20.
http://playground.arduino.cc//Learning/OneWire

Looks nice and simple, thanks.

Got a couple ordered already.

LukeTimothy:
Looks nice and simple, thanks.

Got a couple ordered already.

I like them, but I'm not sure I'd call them simple. The library is nice though, it makes things pretty easy. LM34 and LM35 are pretty decent. I have one of them in front of me right now measuring room temperature. Their output is a mV signal directly indicating the temperature. For example with my LM34, .765mV = 76.5F. LM34 is for Fahrenheit and LM35 is for Centigrade.

LM34 is for Fahrenheit and LM35 is for Centigrade.

It makes sense to always buy the LM34 as its smallest step is 5/9 of the LM35 (e.g. 0.5F = 0.27C)

IMO the better temperature sensors give serial data rather than analog data.

But really anything consistent can be calibrated, even by table. :sunglasses:

Some transistors have a nice amount of variation with temperature, there's even a temperature self-correcting circuit used to measure the one that varies with... probably used in those fancy chips that output serial data.

BTW, there's supposed to be a built-in temperature sensor in the UNO's 328P. That might do!

Also if you want something that doesn't need a PC running, there are cheap working SD card adapters you can log onto. Or, you have 1k EEPROM which can store 17 hours of 1 byte per minute data (0 to 255 or -128 to 127), the SD is really overkill for this.

BTW, there's supposed to be a built-in temperature sensor in the UNO's 328P. That might do!

IIRC that is analogRead(A8) , I used it to create a seed for the random function although it is not random enough to be 100% random, the pin is always free!

(please don't start a random generator discussion here :wink:

The internal temperature is very unreliable, it is the same as holding your finger up to measure the temperature, Arduino Playground - InternalTemperatureSensor

So, I got some of the DS18B20s, and I hooked one up using the parasitic power configuration (pin 1 to ground, pin 2 to arduino with 4.7k pull-up and pin 3 unconnected)... but my arduino seems unable to detect it. The OneWire search function fails everytime.

Well, I guess the first answer is - why not wire it in the normal mode? Parasitic seems to be a pretty pointless exercise.

Secondly, I understand that, for parasitic mode, pins 1 and 3 are connected, not pin 3 left unconnected.

Oh, I see. I guess the diagram I found that showed how to connect in parasitic mode was wrong...

I really should have started with the datasheet. Nevermind. I'll connect it up normally.

LukeTimothy:
Oh, I see. I guess the diagram I found that showed how to connect in parasitic mode was wrong...

I really should have started with the datasheet. Nevermind. I'll connect it up normally.

All you have to do is ground the other pin (Vcc) to enable parasite power mode.

LukeTimothy:
Nevermind. I'll connect it up normally.

Probably a good idea but, if you've got doubts, try here:

http://openenergymonitor.org/emon/buildingblocks/DS18B20-temperature-sensing

Other helpful notes:

Guidelines for Reliable Long Line 1-Wire® Networks

This one is a list of links:
Application Notes and Tutorials
1-Wire Devices

Considering the number and range of 1-wire devices that bus is worth learning.

Okay, so I have it connected normally... but the temperature it returns is 0, which is definitely wrong... and when I ask for the number of devices found I get 0 too. I am currently using the DallasTemperature Library.

Before, when I had it wrongly connected, I was getting a 'temperature' read out of -127, which I know indicates "DEVICE_DISCONNECTED"... but what this 0 means I have no idea, especially when there are apparently no devices found.

GoForSmoke:
Other helpful notes:

Guidelines for Reliable Long Line 1-Wire® Networks
Guidelines for Reliable Long Line 1-Wire Networks | Analog Devices

This one is a list of links:
Application Notes and Tutorials
1-Wire Devices
Mixed-signal and digital signal processing ICs | Analog Devices

Considering the number and range of 1-wire devices that bus is worth learning.

Don't take any of this wrong, I'm not trying to offend you in any way; I never really wanted to. Looks like you've been digging pretty hard thru the Dallas stuff, glad to see you got into it. You have to admit that it's a unique beast compared to "ordinary" serial comms (I2C, SPI, async etc..) There's really nothing else like it that I've seen, but I really can't think of any other way to carry on bi-directional multidrop comm on a single wire. Carry on. :slight_smile:

I haven't looked thru their product line for years now, did you see anything incredible? Remote ADCs?

There are really only two things to go wrong - the software, and the hardware. The latter includes the wiring.
If you are using established software, i.e. the standard libraries and a sketch known to be kosher from Hacktronics or the like, the problem has to be hardware. If the wiring is OK (?) the sensor may well be a dud - because it has suffered from recent user abuse. Trust me, the DS18B20 can take a lot of abuse, but your options for a working solution are limited.

So, what is the code? and do you have a virginal DS18B20 to hand?

afremont:

GoForSmoke:
Other helpful notes:

Guidelines for Reliable Long Line 1-Wire® Networks
Guidelines for Reliable Long Line 1-Wire Networks | Analog Devices

This one is a list of links:
Application Notes and Tutorials
1-Wire Devices
Mixed-signal and digital signal processing ICs | Analog Devices

Considering the number and range of 1-wire devices that bus is worth learning.

Don't take any of this wrong, I'm not trying to offend you in any way; I never really wanted to. Looks like you've been digging pretty hard thru the Dallas stuff, glad to see you got into it. You have to admit that it's a unique beast compared to "ordinary" serial comms (I2C, SPI, async etc..) There's really nothing else like it that I've seen, but I really can't think of any other way to carry on bi-directional multidrop comm on a single wire. Carry on. :slight_smile:

I haven't looked thru their product line for years now, did you see anything incredible? Remote ADCs?

I haven't dug that far yet. Got new things I haven't taken care of here, mostly SPI modules and life in general.

SPI isn't the best 4-wire but it's fast and there's lots of SPI devices. Big plus is speed.
What I read of SD bus, I like but don't have modules that use it. It has speed and versatility.
The 1-wire, I don't think that data speed is hot but like java the data can be prepared small.
I also have but haven't tinkered with bluetooth modules and IR-wireless.

To Nick: Murphy was right!

There are really only two things to go wrong

I wonder if there's a ML corollary for that.

You need to find the arduino sketch which will look for all of the one-wire devices which are connected.

Yeah, 1-wire isn't going to win any speed competitions that's for sure. It's a hideous signal on a scope when it's working right. I'm impressed at how fast SPI has gotten, it really ran away from I2C.

My next big Arduino purchase will probably be an XBee pair. The modules are cheap, but once you buy the Arduino shield and the USB carrier module for the PC side, it's $100. :frowning: I've played around with an accelerometer, but I also want to do some tinkering with a gyro and compass. Complete 9DOF IMUs tend not to be real cheap either.