Mirror Project
Project : Mirror with Time clock, LEDs showing the Temperature and Time
Project Members: Yusra Ibrahim (M00945580), Maheen Yassar (M00931044),
Lanisha Gurung (M00960404)
Project Ideas:
A mirror that includes the real time clock, LEDs which shows the temperature and humidity and alarm for time set.
Equipment's:
1. Timeclock - RTC DS1307
2. Temperature sensor - BMP80 Adafruit
3. LED Display - 1620A
4. Humidity - DHT11
5. Buzzer
Planning of Project:
- The LED display turns on showing the time and temperature
- Time clock for to set a certain time
-When the exact time is set the buzzer goes on
Explanation of this project:
In this mirror project, it is a idea of making a mirror that shows a temperature, time and a alarm where we set a time for our important meeting, events and so on and buzzer on/off. For this project we have used the arduino kit, other equipments as mentioned above and the codes from the example of arduino which are:
DHT11 Sensor Reader for Arduino - Code for the humidity and temperature reader.
Liquid Crystal_I2C.h - Code for the LED to show temperature and time.
uRTCLib.h - Code for Real Time Clock and alarm.
Codes used for Project:
/**
* DHT11 Sensor Reader for Arduino
* This sketch reads temperature and humidity data from the DHT11 sensor and prints the values to the serial port.
* It also handles potential error states that might occur during reading.
* Author: Dhruba Saha
* Version: 2.0.0
* License: MIT
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
// Include the DHT11 library for interfacing with the sensor.
#include <DHT11.h>
// Create an instance of the DHT11 class.
// - For Arduino: Connect the sensor to Digital I/O Pin 2.
// - For ESP32: Connect the sensor to pin GPIO2 or P2.
// - For ESP8266: Connect the sensor to GPIO2 or D4.
DHT11 dht11(2);
#include "Arduino.h"
#include "uRTCLib.h"
#include <Wire.h>
#include <TimeLib.h>
#include <DS1307RTC.h>
// uRTCLib rtc;
uRTCLib rtc(0x68);
void setup()
{
pinMode(12, OUTPUT);
// Initialize serial communication to allow debugging and data readout.
// Using a baud rate of 9600 bps.
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
Serial.begin(9600);
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.setCursor(0,1);
lcd.print("Time: ");
#ifdef ARDUINO_ARCH_ESP8266
URTCLIB_WIRE.begin(0, 2); // D3 and D4 on ESP8266
#else
URTCLIB_WIRE.begin();
#endif
}
void loop() {
// Attempt to read the temperature and humidity values from the DHT11 sensor.
int temperature = dht11.readTemperature();
lcd.setCursor(6,0);
lcd.print(temperature );
// If using ESP32 or ESP8266 (xtensa architecture), uncomment the delay below.
// This ensures stable readings when calling methods consecutively.
// delay(50);
if (temperature != DHT11::ERROR_CHECKSUM && temperature != DHT11::ERROR_TIMEOUT )
{
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
}
else
{
if (temperature == DHT11::ERROR_TIMEOUT || temperature == DHT11::ERROR_CHECKSUM)
{
Serial.print("current temperature: ");
Serial.println(DHT11::getErrorString(temperature));
}
}
// Wait for 1 seconds before the next reading.
rtc.refresh();
Serial.print("RTC DateTime: ");
Serial.print(' ');
Serial.print(rtc.hour());
Serial.print(':');
Serial.print(rtc.minute());
Serial.print(':');
Serial.print(rtc.second());
if(rtc.hour()==15&&rtc.minute()==12){
Serial.print("ALARM");
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
} // end
lcd.setCursor(6,1); //
lcd.print(rtc.hour());
lcd.print(':');
lcd.print(rtc.minute());
lcd.print(':');
lcd.print(rtc.second());
Serial.print(" - Temp: ");
Serial.print(rtc.temp() / 100);
Serial.println();







Comments
Post a Comment