Arduino Remote Control Indoor Thermometer

Happy Holidays everyone, its been a while since my last post but i have been a bit busy over the past few months. I have been working on a Infrared remote control version of my indoor thermometer. It has a menu and displays the current temperature in Celsius, Fahrenheit, and Kelvin.

Before i go any further i need to credit   and more specifically his instructable  on IR remotes and Arduino. Also credit is due to Ken Shirriff for the original IR remote libraries located on Git Hub.

For this project i used the same set up as with my previously posted indoor thermometer with the added TSOP4838 IR receiver and IR remote. The first task was decoding the IR signals from the remote i had which was very easy thanks to the previously mentioned instructable. Each button sends out a different signal and once you have the signals its a matter of just coding what you want done when said signal is recognized.

Here is the code.

#include <IRremote.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,7,6,5,4);

float temp;
int tempPin = 0;
int IRpin = 11;
IRrecv irrecv(IRpin);
decode_results results;
boolean menu = true;
boolean submenu = true;

byte degree[8] = {
  0b01111,
  0b01001,
  0b01001,
  0b01111,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
};

byte downArrow[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00100,
  0b00100,
  0b10101,
  0b01110,
  0b00100,
};

byte upArrow[8] = {
  0b00100,
  0b01110,
  0b10101,
  0b00100,
  0b00100,
  0b00000,
  0b00000,
  0b00000,
};



void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn(); //Start the receiver
  
  lcd.createChar(0, degree);
  lcd.createChar(1, downArrow);
  lcd.createChar(2, upArrow);
  lcd.begin(16, 2);
  
 
 
  
}

void loop()
{
  
  temp = analogRead(tempPin);
  float tempK = (((temp/1023) * 5)*100); //calculate Kelvin
  float tempF = (((tempK - 273.15)*1.8) + 32); //calculate Farenheit
  float tempC = (tempK - 273.15); //calculate Celsius

  if(irrecv.decode(&results))
    {
      irrecv.resume();
    }
    
  if (menu == true || results.value == 16738455) //menu page 1
    {
        menu = true;
        submenu = true;
        lcd.clear();
        lcd.print("1:Farenheit"); //menu
        lcd.setCursor(0,1);
        lcd.print("2:Kelvin");
        lcd.setCursor(15,1);
        lcd.write(byte(1));
        delay(1000);               
    }
    
  if (submenu == true && results.value == 16769055) //display menu page 2 by pressing the minus button while on menu page 1
    {
        menu = false;
        lcd.clear();
        lcd.print("3:Celsius");
        lcd.setCursor(15,0);
        lcd.write(byte(2));
        delay(1000);
    }
    
  if (submenu == true && menu == false && results.value == 16754775) //display menu page 1 by pressing the plus button while on menu page 2
    {
        lcd.clear();
        lcd.print("1:Farenheit"); //menu
        lcd.setCursor(0,1);
        lcd.print("2:Kelvin");
        lcd.setCursor(15,1);
        lcd.write(byte(1));
        delay(1000);      
    }
    
  if (results.value == 16724175)
    {
        submenu = false;
        menu = false;
        results.value = 0;
        Serial.println(tempF); //display Farenheit
        lcd.clear();
        lcd.print(tempF);
        lcd.write(byte(0));
        lcd.print("F");
        delay(1000);           
    }
    
  if (results.value == 16718055)
    {
        submenu = false;
        menu = false;
        results.value = 0;
        Serial.println(tempK); //display Kelvin
        lcd.clear();
        lcd.print(tempK);
        lcd.write(byte(0));
        lcd.print("K");
        delay(1000);
     }
     
  if (results.value == 16743045)
    {
        submenu = false;
        menu = false;
        results.value = 0;
        Serial.println(tempC); //display Ceslsius
        lcd.clear();
        lcd.print(tempC);
        lcd.write(byte(0));
        lcd.print("C");
        delay(1000);
    }
              

}

The remote i used which you can see in the pictures below is small with few options so i used the + & – button as up and down for the menu, and 1 2 & 3 to select which unit of measurement to display also i used the 0 button to go back to the menu.  Here are the pictures and schematic.

IR Indoor Thermometer
IR Indoor Thermometer

Just as a side note as to not confuse anyone in my pictures the potentiometer to adjust the temperature sensor has been removed. I had previously adjusted it to the correct setting and there was no need to leave it on.

If theres any questions about this or any of my other projects feel free to post them here. Hopefully ill post again before the new year but if not then Merry Christmas and Happy New Year to you all.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s