COI - Temperature Monitor

Mechanical Setup:

You will need an Intel Edison for Arduino, a Grove Starter Kit Plus and a computer with the Edison-Arduino IDE installed.

Begin by plugging the Edison board with Grove Starter Kit Plus Base Shield attached into the computer via two micro usb cables. Then attach the Grove RGB LCD screen to any of the I2C ports on the Grove base shield with one of the Grove Universal 4-pin Cables. Attach the Grove Temperature Sensor to port A0 on the Base Shield using a Grove Universal 4-pin Cable.

We also recommend using a static mat while connecting the electronic components.

Step 1: Code ...

COI - Temperature Monitor

Type or copy the following code into your Edison-Arduino IDE, and click to upload the program to your Edison board.

#include #include rgb_lcd lcd;int tempSense = 0;int B=3975; //This is a constant used to convert between the thermistor resistance in the temperature sensor and the actual temperature in Celcius.double minTemp = 10;double ideal = 20;double maxTemp = 25;void setup() { lcd.begin(16, 2); lcd.setRGB(255, 255, 255); pinMode(tempSense, INPUT);}void loop() { lcd.setCursor(0,0); lcd.print(" ");//32 spaces clears screen of all text - deals with text offset glitches lcd.setCursor(0,0); double read = analogRead(tempSense); double resistance=(float)(1023-read)*10000/read; double temperature=1/(log(resistance/10000)/B+1/298.15)-273.15; lcd.print(temperature); //Set the color gradient temperature = min(temperature, maxTemp); temperature = max(temperature, minTemp); double fraction; if(temperature < ideal){ fraction = (ideal - temperature) / (ideal - minTemp) * .5 + .5; } else { fraction = (maxTemp - temperature)/(maxTemp-ideal) * .5; } int r = 0; int g = 0; int b = 0; double quarter = 1.0/4.0; if(fraction < quarter){ r = 255; g = (int)((fraction)/quarter * 255); } else if(fraction < 2 * quarter){ r = (int)((2 * quarter - fraction)/quarter * 255); g = 255; } else if(fraction < 3 * quarter){ g = 255; b = (int)((fraction-2*quarter)/quarter * 255); } else{ g = (int)((4 * quarter - fraction)/quarter * 255); b = 255; } //Set LCD Colors lcd.setRGB(r,g,b); delay(500);//Wait half a second.}

Step 2: Results


The finished product is a temperature monitor which displays the current temperature in Celsius, and provides an at-a-glance color display of the temperature. The minTemp, maxTemp, and ideal can be changed in the code, and affect the color display. As the temperature approaches or passes the maxTemp, the display turns red, as the temperature nears the ideal, the display turns green, and as the temperature approaches the minTemp, the display turns blue. In the picture, you can see that our room is rather warm.

This device can be used to monitor the
temperature around plants, livestock, and valuable or delicate objects.


Using a static mat is always advisable when connecting electronics. Also, if the screen-clearing command (printing 32 spaces) is not included, the lcd screen will occasionally acquire an artifact of an additional temperature reading offset from the original.

COI - Temperature Monitor
Temperature_Mood_Lighting.ino1 KB

Step 3:


Tag cloud

make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel