Weather Station & Clock
A clock with a weather station. Click down on the Rotary Encoder and you can get the options to see what the weather is going to be like. From the high and low temperature, to 7 day and 24 hour forecast!
Supplies
Circuits:
- Arduino Uno R3 or Nano
- Arduino Nano $3 USD
- WIFI Module (WEMOS D1 Mini ESP8266)
- Can be found cheaper on wish (Part linked costs about $5 USD)
- LCD 16x2
- I'm using a 16 pin LCD (NOT the I2C board)
- (2) 250 kΩ Potentiometer
- Comes in many Arduino sensors kits
- 220Ω Resistor
- Comes in many Arduino sensors kits
- RTC (Real Time Clock)
- Comes in some Arduino sensors kits ~$1 USD
- Rotary Encoder
- Comes in many Arduino sensors kits
Wires:
- 1 Standard Breadboard
- Single Standard Breadboard (Usually comes in Arduino kits.) ~$3 USD
- 1 Mini Breadboard (for ESP8266)
- Cheap Option (Usually comes in Arduino kits.) ~$2 USD
- (9) Male-Female header wires
- Amazon (Usually comes in Arduino kits.) ~$6 USD
- (~23) Male-Male header wires
- Really Good wires I use (Keeps bent shape better) ~$5 USD
- USB charging cable's for both the Arduino and the ESP8266
- We will only need to use the one for the Arduino to power the whole system at the end.
API:
- Weather API - Open-Meteo
- Only change the settings for your location!
- Settings for weather are already in the URL
- Scroll down to "API URL (Open in new tab)" and paste the URL in the ESP8266's code
- Remove "https://api.open-meteo.com" from the string
ESP Board installation for the Arduino IDE:
- Go to Preferences
- In "Additional Boards Manager URLs"
- Paste: https://arduino.esp8266.com/stable/package_esp8266com_index.json
- Now you can compile and upload code to the ESP8266
- Make sure you select "Generic ESP8266" in the Tools>Boards Manager
Libraries:
╔═══════════════╗
║ ESP8266WiFi ║
╠═══════════════╣
║ WiFiClient ║
╠═══════════════╣
║ ArduinoJson ║
╠═══════════════╣
║ Wire ║
╠═══════════════╣
║ TimeLib ║ //Might not be used
╠═══════════════╣
║ DS1307RTC ║
╠═══════════════╣
║ LiquidCrystal ║
╠═══════════════╣
║ RTClib ║ //Might not be used
╚═══════════════╝
*Links are for visual reference. Many components can be found much cheaper or in sensors kits! I purchased many of mine from Wish and Ebay
ESP8266 Set Up
Install the board manager for the ESP8266
- Go to Preferences
- In "Additional Boards Manager URLs"
- Paste: https://arduino.esp8266.com/stable/package_esp8266com_index.json
- Now you can compile and upload code to the ESP8266
- Make sure you select "Generic ESP8266" in the Tools>Boards Manager
ESP Code
- Download and open the code "ESPCode.ino"
- Visit Open-Meteo, set your location. Scroll down to your API URL and copy it
- In the code, paste your URL into the URL variable
- Remove "https://api.open-meteo.com" at the start of the URL
- Upload the code to the ESP8266
Downloads
Arduino Set Up
- Make sure to put the board to Arduino Uno or Nano (Depending on what you have)
- On a side note, I've found that they are interchangeable
- Upload your code to the Arduino board and unplug everything
- See warning on step 4 before completely closing everything out!!
ArduinoCode.ino is the original working code, however the memory usage is very high and the arduino may not work as intended after a while. The ArduinoCodeUpdated just stores most of the constant variables to program memory but may have unexpected bugs.
Wiring - RTC
╔═════════════════════╗
║ RTC ║
╠═════╦═══════════════╣
║ DS ║ Not Connected ║
╠═════╬═══════════════╣
║ SCL ║ Analog Pin 6 ║
╠═════╬═══════════════╣
║ SDA ║ Analog Pin 5 ║
╠═════╬═══════════════╣
║ VCC ║ 5V Rail ║
╠═════╬═══════════════╣
║ GND ║ Ground ║
╚═════╩═══════════════╝
WARNING!!!
You may want to set the time on your RTC before using it!!!
(Code is attached to automatically set the time based on when the compiler was run)
Don't forget to reupload the previous Arduino code
Downloads
Wiring - Rotary Encoder
╔═════════════════════╗
║ Rotary Encoder ║
╠═════╦═══════════════╣
║ + ║ 5V Rail ║
╠═════╬═══════════════╣
║ Gnd ║ Ground ║
╠═════╬═══════════════╣
║ CLK ║ Digital Pin 7 ║
╠═════╬═══════════════╣
║ DT ║ Digital Pin 8 ║
╠═════╬═══════════════╣
║ SW ║ Digital Pin 9 ║
╚═════╩═══════════════╝
Wiring - ESP8266
╔══════════════════════════╗
║ ESP8266 ║
╠═════╦════════════════════╣
║ 5V ║ 5V Rail ║
╠═════╬════════════════════╣
║ G ║ Ground ║
╠═════╬════════════════════╣
║ RST ║ Digital Pin 6 ║
╠═════╬════════════════════╣
║ TX ║ Arduino RX (Pin 0) ║
╚═════╩════════════════════╝
Wiring - LCD Display (BOSS LEVEL)
╔═════════════════════════════════╗
║ LCD Display ║
╠═════╦═══════════════════════════╣
║ GND ║ Ground ║
╠═════╬═══════════════════════════╣
║ VCC ║ 5V Rail ║
╠═════╬═══════════════════════════╣
║ V0 ║ [Contrast] Potentiometer ║
╠═════╬═══════════════════════════╣
║ RS ║ Digital Pin 12 ║
╠═════╬═══════════════════════════╣
║ RW ║ Ground ║
╠═════╬═══════════════════════════╣
║ E ║ Digital Pin 11 ║
╠═════╬═══════════════════════════╣
║ D0 ║ ║
╠═════╬═══════════════════════════╣
║ D1 ║ ║
╠═════╬═══════════════════════════╣
║ D2 ║ ║
╠═════╬═══════════════════════════╣
║ D3 ║ ║
╠═════╬═══════════════════════════╣
║ D4 ║ Digital Pin 5 ║
╠═════╬═══════════════════════════╣
║ D5 ║ Digital Pin 4 ║
╠═════╬═══════════════════════════╣
║ D6 ║ Digital Pin 3 ║
╠═════╬═══════════════════════════╣
║ D7 ║ Digital Pin 2 ║
╠═════╬═══════════════════════════╣
║ A ║ [BackLight] Potentiometer ║
╠═════╬═══════════════════════════╣
║ K ║ Ground ║
╚═════╩═══════════════════════════╝
Test
After all the mess, hook up your Arduino to a USB port and let the magic happen!
Extra Steps (Optional)
- Re-enter WIFI credentials.
- Unplug the TX wire as well as the 5V and GND pins
- Apply appropriate settings and then upload the code
- Reattach the wires
- ESP8266 error when uploading code
- If the compiling process takes more than 20 seconds then an error may come up because the ESP went into deep sleep. To overcome this, just click [and let go of] the reset button to keep it awake until compiling is finished. Repeat pressing it but try not to press it while its uploading or it will give an error.
- Setting the RTC time again
- Unplug the TX wire from the ESP8266
- Apply appropriate settings and then upload the code from step 4
- Reupload the other Arduino's code
- Reattach the wires