Tutorials with Arduino: Temperature by colors.

This is a very simple proyect too. We are measuring the ambient temperature with a Thermistor (4,7k) and showing the results by an RGB Led. We are assuming the cool temperature is Blue and the hot is Red.

You can see it working in this video:

The part list is as follows:

  • 1 x Arduino UNO
  • 1 x 4,7k Thermistor
  • 1 x RGB Led (or 2 different color leds)
  • 2 x 220 ohm resistor
  • 1 x 4,7k resistor (wi am using 2 of 2,2k in series,  i ran out of 4,7k 😉

The connections are simple. We are reading the thermistor info on the Analog 0 port, it receives the +5v  directly and Ground trough the 4,7k resistor.

The RGB led is connected to digital outputs 9 for Hot (red) and 10 for Cool (blue). You should connect the blue pin to the 220 ohm resistor for output 10 and the same with the red pin of the RGB Led on the output 9.

We receive the thermistor readings and we compare it to a predefined value we have (the breakpont between cool and hot). If the readings are above the breakpoint we are hot (red) otherwise we are cool (blue).

Very simple!

Here´s the code:

/*Temperature by Led
Just a simple measuring temperature app, that shows the results by the color of the LED.
Cool is Blue, Hot is Red.
Can be used with more leds in array for a Led termometer, or any other aplication.
Made by @MrLndr at www.arduinoarts.com

Thermistor lookup Table (only if the thermistor and the resistor have equal resistance at max.

250,  1.4
275,  4.0
300,  6.4
325,  8.8
350,  11.1
375,  13.4
400,  15.6
425,  17.8
450,  20.0
475,  22.2
500,  24.4
525,  26.7
550,  29.0
575,  31.3
600,  33.7
625,  36.1
650,  38.7
675,  41.3
700,  44.1
725,  47.1
750,  50.2
775,  53.7
784,  55.0
800,  61.5
850,  66.2
875,  71.5
900,  77.9
925,  85.7
937,  90.3
950,  96.0
975,  111.2
1000, 139.5


int tempPin = 0;     // the thermistor and 4,7k resistor
int temp;     // the analog reading from the sensor divider
int LEDCool = 10;          // connect Blue LED to pin 10 
int LEDHot = 9;          // connect Red LED to pin 9 
int breakPoint = 575;
void setup(void) {

void loop(void) {
  temp = analogRead(tempPin);  

  Serial.print("Temp = ");
  Serial.println(temp);     // reading the values

 if (temp <= breakPoint){ //is cool or hot?
   digitalWrite (LEDCool, HIGH);
   digitalWrite (LEDHot, LOW);
   digitalWrite (LEDHot, HIGH);
   digitalWrite (LEDCool, LOW);


Related Posts

  • Tutorials with Arduino: The Knight RiderA very dumb and simple, but really good looking example of the Arduino UNO and LEDS. The effect of the Knight Rider Car. The idea with this example is to learn how to work with arrays on the code. (see the code below) Here is the project working on video: http://www.youtube.com/watch?v=vFqCYGdtPyY…
    Tags: the, arduino, tutorial, led, diy
  • Tutorials with Arduino: Digital thermometer #arduino #displayFinally we are doing something else than our SM-1 Ikea Robot Lamp. It´s been refreshing doing some other projects and tutorials, because these last days have been everything about the robot. See it in action on this video (and watch out for the fire part!) http://www.youtube.com/watch?v=sbP1CUqC5EA So, let´s get to…
    Tags: the, and, temperature, thermistor, tutorial, led, arduino
  • Tutorials with Arduino: Arduino controlled by Apple Remote (updated)Controlling Leds by the Apple Remote (video updated using the Iphone Photostudio for Arduino Stand) http://www.youtube.com/watch?v=vjnOvdJrHMo The idea originated because i´m learning a lot on Led driven home applications for lighting, and the first project i´m doing is led lighting for the kitchen (indirect). The commercial systems are very expensive,…
    Tags: the, and, led, tutorial, diy, arduino