If You have seen my last blog post I have shown how You can make a LCD clock using the Arduino. If not please Read the previous blog post As this is a continuation of the same. This time we will add temperature and Humidity data on the clock. Also make the Clock light up automatically when the light intensity falls below a certain level.
The parts that will be requiring to make this are:
- Arduino Uno (actually any other arduino will do too)
- bunch of connecting wires (multicolored)
- breadboard (preferably small sized)
- DS- 1302 Real time clock module
- Serial 16×2 Character LCD
- 9V battery (prefer using a rechargeable battery pack)
- DHT-11 humidity and temperature sensor module
- analog ambient light sensor module
Let us begin
The connections to the clock are the same as shown in the previous post. we shall only add a few more connections to two new parts. namely the DHT-11 temp and humidity sensor and the analog light sensor.
DHT-11 Temperature and humidity sensor
here is the pic of the sensor.
As you can see it has 3 pins, the Ground, Vcc and Signal
this is the component that will give us the temperature and humidity. here are the specifications:
- Power Supply： 3.3~5.5V DC
- Output： 4 pin single row
- Measurement Range： Humidity 20-90%RH， Temperature 0~50℃
- Accuracy： Humidity +-5%RH， Temperature +-2℃
- Resolution： Humidity 1%RH， Temperature 1℃
- Interchangeability： Fully Interchangeable
- Long-Term Stability： <±1%RH/year
There is a higher variant of this sensor named DHT-22. It has a higher resolution and is more sensitive. but it is also costly. hence the modest DHT-11 is more practical.
Steps to install the DHT-11 library in Arduino
- You need to download the library created by Rob Tillart for the DHT-11. You can get it from here.
- Just click on the download zip to get the zip file.
- Extract the zip file to the folder where you have installed Arduino software.
- Also, cut and paste the Examples that are included to the examples folder in the Arduino folder. This should make the examples accessible through the Arduino IDE software.
- Just check this by opening the software and clicking on the File menu and then on examples. you should find the two examples listed there.
Analog light intensity sensor
here is the light intensity sensor we will be using
As you can see it also has three pins. Ground, Vcc and Signal
Sensors are basically of two types, Analog and digital. Analog sensors give a output voltage proportional to the input. here the light sensor gives a signal corresponding to the light intensity. the arduino scales the input it has received on a scale of 0-1023. digital sensors on the other hand give a high signal when the input has crossed a certain threshold.
Analog sensor output should be connected to the pins labelled as A0,A1,…etc on the arduino. digital sensors output should be connected to the pins on the opposite side labelled as 1,2,3…etc
we shall make the LCD light up if the light intensity falls below a certain level.
Above is the snippet of code that lights up the LCD if the light intensity is below a certain level. as you can see currently the level set is 800. you can change the set level if you want to
Warning the light sensor gives an output inversely proportional to the ambient light. i.e. if there is more light the output will be of a lower value. if there is less amount of light the output will be of a higher value
The Final Part
lets finish the build
- Open the Arduino IDE software on your computer
- Connect the Arduino
- Upload the following code to the Arduino
- After the program is done uploading Disconnect the Arduino
- Connect all the parts as per the circuit diagram below
- Wait for a few second for the clock to print its data
Here is a pic of how the clock should look like
Also now the LCD lights up in the dark
Will post new content next week. Please feel free to like,Share and comment if you will.