Weather Station & Clock

by NeoEmberArts in Circuits > Arduino

690 Views, 3 Favorites, 0 Comments

Weather Station & Clock

Seven Dollar Dohicky
IMG_20230120_155757833.jpg

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:

Wires:

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

Board.png
Type.png

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

Ard.png
  • 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

image_2023-01-20_165947390.png
╔═════════════════════╗
║ 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

image_2023-01-20_165208963.png
╔═════════════════════╗
║ Rotary Encoder ║
╠═════╦═══════════════╣
║ + ║ 5V Rail ║
╠═════╬═══════════════╣
║ Gnd ║ Ground ║
╠═════╬═══════════════╣
║ CLK ║ Digital Pin 7 ║
╠═════╬═══════════════╣
║ DT ║ Digital Pin 8 ║
╠═════╬═══════════════╣
║ SW ║ Digital Pin 9 ║
╚═════╩═══════════════╝

Wiring - ESP8266

image_2023-01-20_170448928.png
╔══════════════════════════╗
║ ESP8266 ║
╠═════╦════════════════════╣
║ 5V ║ 5V Rail ║
╠═════╬════════════════════╣
║ G ║ Ground ║
╠═════╬════════════════════╣
║ RST ║ Digital Pin 6 ║
╠═════╬════════════════════╣
║ TX ║ Arduino RX (Pin 0) ║
╚═════╩════════════════════╝

Wiring - LCD Display (BOSS LEVEL)

image_2023-01-20_171313972.png
╔═════════════════════════════════╗
║ 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