Project showcase
On Table Clock & Temp

On Table Clock & Temp © GPL3+

Checking out time and room's temperature by one hand shake.

  • 3,146 views
  • 0 comments
  • 7 respects

Components and supplies

lcd 20*4
×1
tcrt 5000
×1
lcm 1602
×1
tiny rtc i2c module
×1
lm 35
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
Mfr 25frf52 1k sml
Resistor 1k ohm
×1
Mfr 25frf52 47k5 sml
Resistor 47.5k ohm
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

Ide web
Arduino IDE
DXP Altium Designer
Fritzing

About this project

Do You Know the Time & Your Room Temperature?

This is a simple project that let you check out time, date and your room temperature by only a hand waving on TCRT5000 (IR sensor). This feature is not big size so you can place it on your bedside table, and check out time and weather temperature before sleep, after waking up, or whenever else.

System's Work

Part I: Waking up system by only a handshaking

My core system (hear Atmega328, core of Arduino Uno) is always in sleep mode (to use low power) and when someone shakes his hand Tcrt5000 (IR sensor) make an interrupt to system and wake it up, so system's work starts.

Part II: Measuring time & temperature

After waking up system goes through measuring temp by using LM35, then check out time by using the RTC module and after that show them on LCD.

Part III: Show on LCD and go to sleep

After all with an LCM1602 (a module that connects pin to pin to your LCD then gets an I2C output) information will be sent to LCD.

Hint: I connected pin 16 and 15 of LCD to pin 6 and 7 of Arduino so I can turn LCD's back light of and on when ever I want, also I used PWM of pin 6 to turning on LCD's back light smoothly.

Code

clk-temp-codeArduino
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
//rtc-lcm(sweach led ghat' beshe va 16 lcd be 6 va 15 lcd be 7 vasl beshe)-lm35(A0)-ir(57K ohm,1K ohm , be halat interrupt be paye 2 khroji mide)-lcd

#include <Wire.h>
#include<avr/sleep.h>
#include "RTClib.h"                  
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x3f or 0x27 (depends on your chip) for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x3f, 20, 4);
RTC_DS1307 rtc;

char daysOfTheWeek[7][12] = {"   Sunday", "   Monday", "  Tuesday", "Wednesday", " Thursday", "   Friday", " Saturday"};

void setup () {
    lcd.begin();
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));// to set rtc init value by your pc time
    pinMode(6,OUTPUT);  
    digitalWrite(6,0);
    pinMode(7,OUTPUT);  
    digitalWrite(7,1);
    delay(300);
    attachInterrupt(0, wakeUpNow, LOW);
    lcd.backlight();
}

void loop () {
    pinMode(7,OUTPUT);
    digitalWrite(7,1);
    pinMode(6,OUTPUT);  
    for(int i=255;i>0; i=i-4){  
     analogWrite(6,i);
     delay(20);
    }
    finFunc();
    pinMode(6,INPUT);  //to put it to HiZ to low power using
    digitalWrite(6,0);
    pinMode(7,INPUT);  //to put it to HiZ to low power using
    digitalWrite(7,0);
    lcd.clear();
    lcd.setCursor(0,1);
    lcd.print("      stand by      ");
    lcd.setCursor(0,2);
    lcd.print("  hover your hand!  ");
    sleepNow();
    lcd.clear();
}
void finFunc(){
  for(int i=0; i<25; i++){
    mainFunc();
    delay(200);
  }
}
void mainFunc(){
    int temp = (5.0 * analogRead(A0) * 100.0) / 1024;
    DateTime now = rtc.now();
    lcd.setCursor(6,0);
    if(now.hour()<10)
      lcd.print("0");
    lcd.print(now.hour(), DEC);
              Serial.print("time:  ");
              Serial.println(now.hour(), DEC);
    lcd.print(':');
    if(now.minute()<10)
      lcd.print("0");
    lcd.print(now.minute(), DEC);
    lcd.print(':');
    if(now.second()<10)
      lcd.print("0");
    lcd.print(now.second(), DEC);
    lcd.print(" ");
    lcd.setCursor(0,1);
    lcd.print(now.year(), DEC);
    lcd.print('/');
    if(now.month()<10)
      lcd.print("0");
    lcd.print(now.month(), DEC);
    lcd.print('/');
    if(now.day()<10)
      lcd.print("0");
    lcd.print(now.day(), DEC);
    lcd.setCursor(11,1);
    lcd.print(daysOfTheWeek[now.dayOfTheWeek()]);
    lcd.setCursor(8,2);
    if(temp<10)
      lcd.print("0");
    lcd.print(temp);
                  Serial.print("temp:  ");
                  Serial.println(temp);
    lcd.print((char)223);
    lcd.print("C");
    lcd.setCursor(2,3);
    if     (temp>=43)
       lcd.print("High Temp Alert!"); 
    else if(temp>=31)
       lcd.print("    Too Hot!    "); 
    else if(temp>=28)
       lcd.print("      Hot!      "); 
    else if(temp>=23)
       lcd.print("      Norm      "); 
    else if(temp>=19)
       lcd.print("      Cold      "); 
    else if(temp>=15)
       lcd.print("    Too Cold    "); 
    else
       lcd.print(" Low Temp Alert "); 
    Serial.print("dipi:  "); 
    Serial.println(digitalRead(2));
    Serial.print("");
  }
  
  void sleepNow()      
{
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);   // sleep mode is set here

    sleep_enable();          // enables the sleep bit in the mcucr register
                             // so sleep is possible. just a safety pin 
    attachInterrupt(0,wakeUpNow, LOW); // use interrupt 0 (pin 2) and run function
                                       // wakeUpNow when pin 2 gets LOW 
    sleep_mode();            // here the device is actually put to sleep!!
                             // THE PROGRAM CONTINUES FROM HERE AFTER WAKING UP
    sleep_disable();         // first thing after waking from sleep:
                             // disable sleep...
    detachInterrupt(0);      // disables interrupt 0 on pin 2 so the 
                             // wakeUpNow code will not be executed 
                             // during normal running time.
}

void wakeUpNow(){}

Custom parts and enclosures

clk-temp-shield
PCB pic, Altium Designer
Clk temp shield
final_pcb
Final%20pcb
clk-temp-pcb
Clk%26temp pcb

Schematics

clk&temp_schematic
Clk%20%26%20temp bb

Comments

Similar projects you might like

Talking Clock 2 - New Version (Bilingual: EN-PT)

Project tutorial by LAGSILVA

  • 7,350 views
  • 19 comments
  • 33 respects

Motion Detector Clock

Project in progress by Frazer Reid

  • 1,893 views
  • 0 comments
  • 3 respects

Simple Arduino Digital Clock Without RTC

Project in progress by Annlee Fores

  • 96,211 views
  • 23 comments
  • 80 respects

Tri-Mode Digital Clock With ATtiny85 And RTC

Project showcase by LAGSILVA

  • 5,207 views
  • 0 comments
  • 19 respects

Adjusting Dual Clock using DS3231 on 1.8" ST7735 Display

Project showcase by FLORICA Tudor-Nicusor

  • 3,963 views
  • 2 comments
  • 11 respects
Add projectSign up / Login