ESP8266 Weather Station Clock

Introduction: ESP8266 Weather Station Clock

This project is a nice way of displaying the time and weather in a small convenient package. I will explain the project, how it works and show the code here.

You can press different buttons to show the current weather in a set location as well as temperature and pressure. The default view is the time which is pulled from an NTP server.

There is no need to set the time as the time is synchronised from the NTP server and is very accurate. In this configuration I have the time and the local IP address. You can change the code to include date, weather, pressure and temperature to display on the main screen or on the buttons.

Step 1: The Schematic

The schematic is relatively straightforward and easy to

follow. There is a gerber file if you wish to spin your own PCB. The whole circuit is driven by 5V coming from a micro USB connection. This makes the circuit simple and easy to power. The 5V is fed into a Low Dropout 3.3V Regulator an LM 3940 which gives 3.3V to the ESP8266. There is a USB connector on the ESP8266 however, I chose not to use it in general because the 5V is driving the LCD too.

3.3V must be used with the ESP8266, you can’t drive it directly with 5V as it will kill the board.

The two tactile switches are connected to D5 and D6 and are configured in the code to bring up different information on the screen. I have these set to Temperature/Pressure and Forecast.

All the components are easily hand soldered onto perfboard or the gerber is available in my GitHub at https://github.com/allenelectronics/esp8266weatherstation

Step 2: The Code

https://github.com/allenelectronics/esp8266weatherstation

The code is compiled in the Arduino IDE and needs some configuration to work

Firstly, you need to install the ESP8266 Board to the IDE in order to upload code to it.

Comprehensive instructions on how to do this are here: https://randomnerdtutorials.com/how-to-install-esp8266-board-arduino-ide/

To get the weather functionality, I chose to use RemoteMe which collects the weather data direct from API and generates code which can be inserted into your code. You will need to register and set up the data stream on their website: https://remoteme.org

Documentation about RemoteMe can be found here: https://remoteme.org/public/documentation/sources/#introduction

There are some specific definitions that are unique to your setup that you will need to complete before upload:

#define WIFI_NAME "SSID GOES HERE"

#define WIFI_PASSWORD "PASSWORD GOES HERE”

#define DEVICE_ID 1

#define DEVICE_NAME "OBTAIN FROM REMOTEME.ORG"

#define TOKEN "OBTAIN FROM REMOTEME.ORG"

The definitions here need to be set by you based on your wifi details and the token you get from RemoteMe.

You need to make sure all these libraries are installed and included in the code. I have included links to the ones that are more difficult to get.

#include //https://github.com/remoteme/RemoteMeArduinoLibrary

#include

#include

#include

#include

The last part that needs changing is your location as this project does not use GPS. You need to modify the “LOCATION” string:

else if(buttonState2 == LOW && prevButtonState2== HIGH){

Serial.print("LOCATION\n");

Serial.println(fc);

lcd.clear();

lcd.print("LOCATION");

lcd.setCursor(0,1);

lcd.print(fc);

lcd.setCursor(0,0);

delay(5000);

prevButtonState2 = buttonState2;

Step 3: The Build

The Build

At the time I did not have access to a 3d printer, this was my last project using an off the shelf case. I used a readily available alarm panel case which is designed for the 16x2 LCD.

Link: https://www.ebay.co.uk/itm/86-Plastic-project-box-enclosure-case-for-diy-LCD1602-meter-tester-with-buttGA/363214674235?hash=item549148193b:g:IvQAAOSwNXpcFFrv

Everything is stuffed inside the case, the 16x2 LCD display is glued to the front panel with the circuit board hot-glued in place.

Step 4: Conclusion

Conclusion

This is a neat project for a desktop digital clock that needs no adjustment or setting, it takes the time from an NTP server and displays it on a clear backlit LCD.

This is not for a complete beginner as there is some configuration to the code required and data streams need to be set up too. If you have any questions or comments, please feel free to leave me a comment.

Anything Goes Contest

Participated in the
Anything Goes Contest

Be the First to Share

    Recommendations

    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest
    • Puzzles Challenge

      Puzzles Challenge
    • Lamps Challenge

      Lamps Challenge

    Comments