We are going to make a clock with date along with humidity and temperature, and display the data in an I2C 16x2 LCD. We will get the time and date data from NTP server of NIST (National Institute of Standards and Technology - Boulder, Colorado United States). The humidity and temperature data will be read out from DHT22 sensor. We will get all these data once a minute.
The needed devices for this project are:
- Ameba Arduino - We chose this Arduino compatible board because of the built-in wireless shield and many supporting libraries. You can find this board at https://www.seeedstudio.com/Ameba-Arduino-Wireless...
- Serial LCD - You can look for this LCD by searching "16x2 serial LCD" at eBay or Amazon.
- DHT22 - This is a digital relative humidity and temperature sensor that has been used in many Arduino projects. Youc an find it in eBay or Amazon by searching for "DHT22". You can also use cheaper DHT11 for this project, DHT22 has however higher precision than DHT11.
Step 1: DHT22
DHT22 is a 4-pin sensor, the pinout connections are:
- VCC - This pin will be connected to Ameba 3.3V output
- Data - This is the data pin which will be connected to digital pin 2
- N.C - Not connected pin
- GND - Connect to ground of the board
Please note that a 4.7K - 10K resistor is usually required to use as a pullup from data pin to VCC. It can ensure a valid logic level when GPIO pin is switching from input to output. However we simplify and ignore this step as the DHT22 datasheet indicate we should not send any instruction to the sensor within one second to pass unstable status anyway. One 100nF capacitor can also be added between VCC and GND for wave filtering.
Step 2: Serial LCD
There are four wires in this serial LCD module and the connections to Aemba Arduino board is simple & straightforward:
- GND - Board ground
- VCC - Board 5V output
- SDA - Board SDA pin (A4 )
- SCL - Board SCL pin (A5)
Step 3: Final Wiring
The system connection figure and final wiring pictures are as shown above.
Step 4: Code Reference
For NTP server library, please download it from https://github.com/Ameba8195/Arduino/raw/master/li...
The Arduino sketch is also attached. In this sketch, you need some editing to suit your environemnt:
- Pick the sensor type, DHT11, DHT21, or DHT22
- Input the SSID of your AP and its password
- Pick your time zone
After you make the above changes, you can compile the code and download to the board and reset, you just got a digital calendar with humidity & temperature display!