VU3CFC Ham Clock Version 1.0
Introduction
The VU3CFC Ham Clock Version 1.0 is a multi-functional device built using a NodeMCU ESP8266. It integrates weather data, local and UTC time, and environmental readings, displaying them on a 20x4 LCD. This blog will guide you through the hardware connections, required libraries, setup instructions, and the display's functionality.
Hardware Connections
-
NodeMCU ESP8266:
- Acts as the main microcontroller to interface with the DHT11 sensor, LCD, and APIs.
-
DHT11 Sensor:
- Pin D4 (GPIO2): Data pin connected to NodeMCU for temperature and humidity readings.
- VCC and GND: Connect to NodeMCU's 3.3V and GND pins, respectively.
-
20x4 I2C LCD:
- Uses an I2C interface, reducing the number of pins required for communication.
- Connections:
- SDA: Connect to NodeMCU's D2 (GPIO4).
- SCL: Connect to NodeMCU's D1 (GPIO5).
- VCC and GND: Connect to NodeMCU's 3.3V and GND pins.
Libraries to Install
Before uploading the code, ensure the following libraries are installed in the Arduino IDE:
-
LiquidCrystal_PCF8574
For interfacing with the 20x4 LCD using the I2C protocol.
Installation: Go to Tools > Manage Libraries and search forLiquidCrystal_PCF8574
. -
ESP8266WiFi
Allows WiFi connectivity on the ESP8266 module.
Pre-installed with the ESP8266 board package. -
WiFiClientSecure
For secure HTTPS requests to APIs.
Pre-installed with the ESP8266 board package. -
NTPClient
Fetches the current time from NTP servers.
Installation: Search forNTPClient
in the Library Manager. -
DHT
Reads data from the DHT11 sensor.
Installation: Search forDHT sensor library
by Adafruit. -
TimeLib
Helps in manipulating epoch time.
Installation: Search forTimeLib
.
Setting Up WiFi and API Keys
In the code, update the following placeholders with your specific information:
-
WiFi Credentials
Replace the placeholders in thessid
andpassword
variables:const char* ssid = "Your_SSID"; // Replace with your WiFi name const char* password = "Your_Password"; // Replace with your WiFi password
-
Weather API Key
Sign up at OpenWeather and get an API key. Replace the key in the following line:const String weatherApiPath = "/data/2.5/weather?q=Kalyan,IN&appid=Your_API_Key&units=metric";
What the Display Shows
The 20x4 LCD dynamically updates with the following information:
-
Line 1: Local Time and Date
Displays the current time in the local timezone (e.g.,LOC-10:45 18/01
). -
Line 2: UTC Time and Date
Shows the UTC equivalent of the local time (e.g.,UTC-05:15 18/01
). -
Line 3: Temperature and Humidity
Retrieves real-time environmental readings from the DHT11 sensor (e.g.,TEMP:28C HUM:62%
). -
Line 4: Weather Condition
Fetches weather data from the OpenWeather API and displays conditions likeSunny
,Cloudy
, etc.
How It Works
-
Setup Phase:
The device initializes all components, connects to WiFi, and fetches initial data from APIs. -
Loop Phase:
- Continuously updates time using the NTP client.
- Fetches temperature and humidity from the DHT11 sensor.
- Periodically queries the weather API for updates.
Conclusion
The VU3CFC Ham Clock Version 1.0 is a versatile device for monitoring time, weather, and environmental conditions. It’s perfect for amateur radio operators and weather enthusiasts alike. By following the steps above, you can easily replicate and customize this project to suit your needs. Happy building!