Introduction: Weekend Project Clock Date Thermometer and Humidity With Arduino Mega

Guys, I wanna share my weekend project on creating a clock with humidity and temperature sensor,
It's using DHT11 sensor, RTC DS1307, LCD 16x2 and Arduino Mega 2560,

Keep reading and good luck

Step 1: Prepare All the Parts Needed.....

In this experiment I need to use this parts :

1. Arduino Mega 2560 board
2. RTC DS1307
3. LCD 16 x 2
4. DHT11 sensor
5. 4K7 Resistor
6. 10K trimpot for LCD brightness

Step 2: Connection to Arduino Board :

Here's the connection to arduino board :
//init DHT11 sensor
#define DHT11_PIN 6

// Init the DS1307
DS1307 rtc(20, 21);

// Init the LCD
//LiquidCrystal lcd(22, 24, 26, 28, 30, 31);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Step 3: The Main Loop for Displaying .....

Here's the main loop for displaying, I used Arduino 022..

void loop()
{
  // Display time centered on the upper line
  //lcd.setCursor(4, 0);
  //Read the temperature and humidity
   int chk = DHT.read11(DHT11_PIN);
  lcd.setCursor(0, 0);
  lcd.print(rtc.getTimeStr());
  //Read temp sensor
   double temp = Thermister(analogRead(0));  // Read sensor
   //Read Humidity
   //DHT.humidity,1
   //Read Temperature
   //DHT.temperature,1
   //print screen
   lcd.setCursor(9,0);
  //lcd.print(temp);
   lcd.print(DHT.temperature,0);
   lcd.print("C");
  //Display Humidity
   lcd.setCursor(13,0);
   lcd.print(DHT.humidity,0);
   lcd.print("%");
 
  // Display abbreviated Day-of-Week in the lower left corner
  lcd.setCursor(0, 1);
  lcd.print(rtc.getDOWStr(FORMAT_SHORT));
 
  // Display date in the lower right corner
  //lcd.setCursor(6, 1);
  lcd.setCursor(3, 1);
  lcd.print(",");
  lcd.setCursor(4, 1);
  lcd.print(rtc.getDateStr());

Step 4: Test and Enjoy My Project.....

Test and enjoy my project.....
Let's watch the video...


Thanks for reading and good luck for your experiment.....