How could I know environment temperature all the time in such a hot day? I called my absent friend but surprised to find that she got a cold because of cold weather and she had to monitor body temperature with a thermometer. She concerned with my health, advising me to pay attention to room temperature to keep healthy.
Thinking about her words, I decide to DIY a small office thermometer with DS18B20 sensor that based on Arduino UNO to know the environment temperature.

DSC_4755.JPGHardware in Need:
1. DS18B20 Temperature Sensor

DS18B20.jpgDS18B20 is the most common temperature sensor in the market, small, precise, and convenient to connect. After package, it is applicable to different situations. You can change exterior according to situations, such as plastic films, boilers, engine rooms, clean rooms, and even magazines.

2. Gravity: I2C 16x2 Arduino LCD with RGB Backlight Display

1419_P_1500454238386.jpgHave you been fed up with Black/White LCD screen? Do you want to try a colorful one? DFRobot I2C 16x2 Arduino LCD with RGB Backlight Display module will bring you a new experience about screen. It comes with RGB full color backlight, which has 16 million kinds of color. It is also convenient to connect, this I2C 16x2 LCD Screen is using an I2C communication interface, only two communication wires can realize backlight control. It supports screen scrolls, cursor movement etc. All codes are based on special Arduino libraries.

3. DFRduino UNO R3

521_P_1415674112537.jpgDERduino UNO R3, a simple microcontroller board fully compatible with Arduino UNO R3, replaces 8U2 with ATmega16U2 as a USB-to-serial converter. The convert speed and memory space of ATmega16U2 is the same as Arduino UNO R3. This master board adopts ENIG (immersion gold), quality, delicate, and cost effective.

4. Gravity: IO Expansion Shield for Arduino V7.1

Parts Diagram

DSC_47791.jpgCircuit Connection Diagram

HT.png

DSC_4512.JPG
Operating Result

DSC_47201.jpgWhen the room temperature is less than 25°C, the screen shows green. Is this temperature comforts people?

DSC_47151.jpgWhen the room temperature is more than 25°C and less than 30°C, the screen shows yellow. The color suggesting increasing temperature, you can use fan now.

DSC_47181.jpgWhen the room temperature is more than 30°C, the screen shows red. A fan means nothing to such a hot warming, only air-conditions can help you survive in the summer. I made a crust by 3D printer to protect and beatify inner parts.

3D Assembly Drawing

E4[4Q{NO%S{`ZEH1@CEA$C3.png3D Sketch Design

DSC_4768.JPGIf you are interested in this project, you can download 3D printing files in the end page. You can also design your own private crust.
Relate to programing, you can also add time display function. So it can be a combination of thermometer and clock. Your ideas will be appreciated. 

Program:

#include <OneWire.h>
#include <Wire.h>
#include "DFRobot_RGBLCD.h"
int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2
DFRobot_RGBLCD lcd(16,2);  //16 characters and 2 lines of show
//Temperature chip i/o
OneWire ds(DS18S20_Pin);  // on digital pin 2
void setup(void)
{
  Serial.begin(9600);
  lcd.init();
  lcd.setRGB(0, 255, 0);
  lcd.setCursor(1, 0 );
  lcd.print("Tep: ");
}
void loop(void)
{
 float temperature = getTemp();
  delay(1000);
   lcd.setCursor(5,0); 
   lcd.print(temperature);
    if(temperature<25)
    {
    lcd.setRGB(0, 255, 0);
   }
    else if (temperature<30)
    {
    lcd.setRGB(255, 215, 0);
    }
    else 
    {
    lcd.setRGB(255, 0, 0);
    }
    lcd.setCursor(10, 0 );
   lcd.write(0xdf);              //display°
   lcd.print('C');
    delay(100);
  delay(100); //just here to slow down the output so it is easier to read
}
float getTemp()
{
  //returns the temperature from one DS18S20 in DEG Celsius
  byte data[12];
  byte addr[8];
  if ( !ds.search(addr)) {
      //no more sensors on chain, reset search
      ds.reset_search();
      return -1000;
  }
  ds.reset();
  ds.select(addr);
  ds.write(0x44,1); // start conversion, with parasite power on at the end
  byte present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE); // Read Scratchpad
  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] = ds.read();
  } 
  ds.reset_search();
  byte MSB = data[1];
  byte LSB = data[0];
  float...
Read more »