Arduino Clock (without Rtc) With Temperature And Humidity

Hackster.ioLearning Hardware Community. Projects× Log inSign up ProjectsProjectsChannelsChannelsNewsContestsEventsVideos ×

Embed the widget on your own site

Add the following snippet to your HTML:

Arduino Clock (without rtc) with temperature and humidity

This project is a arduino clock made without using an rtc and it is totally accurate it also displays the temperature and the humidity

Read up about this project on Hackster.io

Arduino Clock (without rtc) with temperature and humidity

harshitmehra20075 6,322
  • Overview
  • Things
  • Story
  • Schematics
  • Code
  • Credits
  • Comments(8)
harshitmehra2007harshitmehra2007Published © GPL3+Arduino Clock (without rtc) with temperature and humidity

This project is a arduino clock made without using an rtc and it is totally accurate it also displays the temperature and the humidity

BeginnerFull instructions provided2 hours6,322Arduino Clock (without rtc) with temperature and humidity

Things used in this project

Hardware components

DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
  • Buy from Newark
  • Buy from Adafruit
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
  • Buy from Newark
  • Buy from Adafruit
Nano 33 BLE Sense
Arduino Nano 33 BLE Sense
×1
I2C 16x2 Arduino LCD Display Module
DFRobot I2C 16x2 Arduino LCD Display Module
×1
Jumper wires (generic)
Jumper wires (generic)
×1
  • Buy from Newark
  • Buy from SparkFun

Software apps and online services

Arduino IDE
Arduino IDE

Story

Don't mind the look of it but it works very fine I used the arduino nano as the programming board for the project You need to set the time in the code

Above the void setup

I am thinking to upgrade it with a few more things but till now I am just using a dht11 sensor with a LCD 16x2 along with an i2c module if you don't have a i2c module believe me you need to buy it saves alot of wire and effort and to me the wiring along with i2c is simple so I used it you can edit the code if you want to use normal lcd display

also I used the simple DHT library which makes working with the DHT11 sensor and I changed the increase rate of seconds to 0.50 as when I finalized it with arduino nano it started moving 1 second faster idk why

here

so for the connects I used a DHT 11 with 4 pins and here's its pinout

data pin goes to digital pin 11 as per the code and for the lcd

vcc goes to arduino 5v (same for the DHT11 sensor)

gnd goes to arduino gnd (same for the DHT11 sensor)

scl goes to A5

sda goes to A4

this is all for the project this was my first upload pardon me if any mistakes

thanks,

Read more

Schematics

The connections

Code

  • Code

Code

C/C++Just upload it#include <SimpleDHT.h> #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); int h = Your hours here; int m = Your minutes here; int s = seconds here; int flag = 0; int TIME = 0; const int hs = A0; const int ms = A1; int state1 = 0; int state2 = 0; int pinDHT11 = 11; SimpleDHT11 dht11(pinDHT11); void setup() { pinMode(hs,INPUT_PULLUP); pinMode(ms,INPUT_PULLUP); lcd.init(); lcd.init(); lcd.backlight(); lcd.print("Made by - "); lcd.setCursor(0,1); lcd.print("Harshit"); delay (3000); lcd.clear(); } void loop() { byte temperature = 0; byte humidity = 0; int err = SimpleDHTErrSuccess; if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess){ return; } lcd.setCursor(0, 0); s = s + 0.50; lcd.print("TIME:" ); lcd.print(h); lcd.print(":"); lcd.print(m); lcd.print(":"); lcd.print(s); if (flag < 12) lcd.print(" AM"); if (flag == 12) lcd.print(" PM"); if (flag > 12) lcd.print(" PM"); if (flag == 24) flag = 0; delay(1000); lcd.clear(); if (s == 60) { s = 0; m = m + 1; } if (m == 60) { m = 0; h = h + 1; flag = flag + 1; } if (h == 13) { h = 1; } state1 = digitalRead(hs); if (state1 == 0) { h = h + 1; flag = flag + 1; if (flag < 12) lcd.print(" AM"); if (flag == 12) lcd.print(" PM"); if (flag > 12) lcd.print(" PM"); if (flag == 24) flag = 0; if (h == 13) h = 1; } state2 = digitalRead(ms); if (state2 == 0) { s = 0; m = m + 1; } s=s+1; if(s==60){ s=0; m=m+1; } if(m==60) { m=0; h=h+1; } if(h==13) { h=1; flag=flag+1; if(flag==2)flag=0; } lcd.setCursor(0,1); lcd.print("Temp= "); lcd.setCursor(5,1); lcd.print((int)temperature); lcd.setCursor(7,1); lcd.print("C"); lcd.setCursor (9,1); lcd.print("H="); lcd.setCursor(11,1); lcd.print((int)humidity); lcd.setCursor(13,1); lcd.print("%"); }

Credits

harshitmehra2007

harshitmehra2007

3 projects • 2 followersFollow ContactContact

Comments

Related channels and tags
  • Clocks
  • Clocks
  • Weather
  • Weather
  • clocks
  • easy
  • lcd
  • lcd_i2c
  • weather
  • without rtc

Tag » Arduino Nano 33 Ble Rtc