Whats a good temperature sensor / thermistor?

I'm new to arduino, and plan to buy a starter kit tomorrow.

for my first project i have decided to build a type of RGB mood light, but will change colour depending on the temperature.

from 18c (blue) to 28c (red), with the ideal perhaps an orange colour. and it needs to fade between the colours evenly.

someone mentioned that the sensor that comes with the kit im going to buy is only 9bit and would only give like 20 readings so there would be a noticable difference between the colours. but i have no idea about "bits" when it comes to sensors etc.

any suggestions?

Thanks for your reply,

this is what someone said about it. excuse me but i'm very new to this so i dont have much clue about it yet.

Just a note on your RGB temperature indicator idea. The temperature sensor in that ARDX kit is TMP36. You may end up with a scale issue. Say you want to fade from blue to red over "room" temperature (20c-27c). 8-bit PWM there will give you 256 values each way for a total of 512 values over the range of full blue to full red representing 20c and 27c respectively. With that sensor the 7c room temp swing on a 10bit ADC is only 14 counts. Basically, you can have 14 "fade steps" between blue and red and whatever colours in between.

First of all, a TMP36 sensor is an analog output device. Its output is volts, not bits. The ADC on the Arduino has ten bits, so I don't know where the "9 bit" stuff comes from. I think I can guess where the "20 values" comes from, and I'll show my guess in a minute.

But, first of all:

How many different "fade values" do you really need? Let's say, for the moment, that you would like to have a range of 0 - 255 to make it go from one extreme to the other. Maybe you think you would like more, but, let's say for now that 256 different values are the target. (That's a nice round number.)

Maybe you can experiment with a sketch that doesn't read temperature, but applies different values over some range for certain amounts of time and observe the visual effects of varying the output that many fade steps. I mean, however you get numbers that represent temperature, you have to use the numbers to arrive at values to feed the Arduino pwm output pins that control LED brightness, right? I might start experimenting with the LEDs first and then do the temperature thing after I decided what I really needed to get an acceptable visual result.

Well, let's get to the temperature thing...

Assume for the moment that the TMP36 temperature sensor output voltage is exactly given by its nominal formula:

V = 0.5 + 0.01 * (Temperature in Celsius)

Then for 18C, the output is 0.68 Volts, and for 28 C, the output is 0.78 Volts

Now, assume for the moment that the ADC reference voltage is exactly 5 Volts.

I think that the stated conclusion about "20 values" came from something like working backwards from the Atmel ADC formula to discover the ADC readings from the applied voltage.

For example:

A reading of 139 would indicate an applied voltage of approximately 0.688 Volts, which corresponds to 18.8C A reading of 159 would indicate an applied voltage of approximately 0.776 Volts, which corresponds to 27.6C

Therefore, a temperature swing in the neighborhood of 18C to 28C causes the ADC readings to change only 20 counts.

Now, as Richard said, you can use the internal ADC reference rather than 5 Volts to get a somewhat better spread.

If you assume that the internal bandgap reference voltage is exactly 1.1 Volts and you use that for the ADC reference voltage instead of the default 5 Volts, then

A reading of 633 would indicate an applied voltage of approximately 0.680 Volts, which corresponds to 18.0C A reading of 726 would indicate an applied voltage of approximately 0.780 Volts, which corresponds to 28.0C

So, now, a temperature swing in the neighborhood of 18C to 28C causes the ADC readings to change 93 counts.

Now, here's a gentle reminder: The bandgap reference voltage might be off by a percent or so, and the ADC readings might be off by a couple of bits, and the temperature sensor reading might be off by a degree or so, so the readings might not be exactly as indicated above.

Now, just between us chickens, I would like offer the opinion that it's just possible that the human eye may not discern a huge subjective difference between having 93 different fade values and having 256 different fade values, so you might want to try scaling the counts so that ADC values from, say, 630 to, say, 730 are mapped to the 0-255 range. If you already have a TMP36 sensor, then maybe you can try something like that. That could be all you need.

If that's not good enough, then...

You could get a better spread with a DS18B20 sensor, which has digital output (using a so-called 1-Wire connection). See Footnote. With this device, a ten-degree Celsius temperature spread gives a count difference (in a 12-bit digital word) of 160 counts. Still not 256, but somewhat better than the analog sensors like the TMP36. More importantly, for some applications, it also doesn't depend on the accuracy of the ATmega analog reference voltage or of any ADC converter bit errors. I have a feeling that for visual effects like you are describing, where absolute accuracy to the nearest tenth of a degree is probably not important, the TMP36 might be just the ticket.

I mean, if there were only one way to do things, then life would be a lot simpler right?

  1. State the problem.
  2. Derive or discover (or get someone else to derive or discover) the solution.
  3. Implement the solution.

Fortunately for the intellectually curious among us, life is more interesting than that.



Footnote: The DS18B20 has been used successfully in many Arduino designs. It is just as easy to connect as the analog sensors, and 1-Wire Arduino libraries are readily available to read and interpret temperature values. It may be a little more expensive than analog sensors, but a lot of us think it's worth it.

Thanks for all your replys especially dave as you went so in depth with your reply.

I'm still very new to all this, so i dont even know what pwn or ADC means yet. let alone all this to do with the internal references and what not.

I'm still yet to buy the ardunio. but it looks like somthing like this project i had in mind is no where near my skill... i'll focus on the tutorials for the blinking light and simple things for now.

but i may come back to this in the near future.



I double the DS18B20 -

Check - http://milesburton.com/index.php/Dallas_Temperature_Control_Library - for a good library with examples

so i dont even know what pwn or ADC means yet

PWM - Pulse width modulation - http://en.wikipedia.org/wiki/Pulse-width_modulation

ADC - Analog Digital Convertor - http://en.wikipedia.org/wiki/Analog-to-digital_converter

Another vote for the DS18x20 digital thermometers. You can hang a number of them from 1 digital pin.