Atomic clock & weather

Introduction

Accurate time and weather data are useful for everybody. You can buy a weather station for 25-30 Euros, but only some of them have the time synchronized to an Atomic Clock. Not to speak about the weather: at best there is an outdoor sensor for temperature and humidity. From these information and an atmospheric pressure sensor, it can estimate the forecast weather? Why not let the specialists forecast the weather, and just check-out the results every hour! You only have to ask them, by internet, using you own made device, under Arduino IDE (Integrated Development Environment) .

This is not the first such project available on internet. We got inspired by:

The Purpose

It uses only reliable time and weather data. Sensors around the house are never in standard conditions (shadow, height to the ground, accuracy, etc.) and the values can be misleading. The weather forecast is professional and official. Time is adjusted every hour, thus can be expected a maximum error of 1s (not per month, not per year, but perpetual).

Components

  1. A WiFi enabled board. We used Geekworm Easy Kit ESP32-C1, based on ESP-WROOM-32 (https://www.banggood.com/ESP32-DevKit-ESP32-WiFiBluetooth-Development-Board-ESP-WROOM-32-Dual-Cores-Board-p-1138249.html?rmmds=myorder&cur_warehouse=CN) (price <6 Euros) for two reasons: It has three hardware SPI (Serial Peripheral Interface ) : one used for USB programming from Arduino IDE and another, used to communicate with the display.It has sufficient memory and was new to us (learn to program it). It is compatible with SparkFun ESP32 Thing.
  2. A Nextion 2.8" , resolution 320x240 (NEXTION 2.8") (price<20 Euros) for two reasons:It has a built-in advanced screen controller. Can change a picture from a set in memory according to the weather. Can scroll long text describing the weather, leaving to the main board other tasks.It has multiple pages. The weather for the next days,or other cities can be shown on the next pages: just touch the screen!
  3. A USB phone charger to supply 5 V to the USB port, when the project is ready
  4. A plastic box (2 Euros) in which a window is cut and a hole is made for the USB power cable.

1. First page . Scrolling weather data (low in yellow) 2. Second page (next two days)

The first image (left) shows the device in its box. In the center, the first screen has the time as HH:MM:SS, Day, date under it. Below left is a picture with a Sun (forecast for today), right is the temperature outside now, the estimated minimum and maximum temperatures of the day. Under it, are the sunrise and sunset hours, wind velocity and humidity. A scrolling line (unclear for this reason) with yellow text shows the description of the forecast for the next hours. At the bottom are the screen back-light slider (put your finger on the slider and change the back-light) and the "next" page button. If you press this button, the image on the right will appear: It shows for the next two days, the forecast (picture), extreme temperatures and humidity. Press the "back" button to return onto the first page. The required logo of the Weather Underground site is also visible.

Schematic

4. Schematic for the project (NEXTION was not available in FRITZING until now!)

You just need to connect 4 wires:

Geekworm ESP32 <--> Nextion

IO16 - TX

IO17 - RX

GND - GND

3.3V - (+5v) (Nextion works also with 3.3V)

Power the system by USB, from a universal charger providing 1A. You can choose any other power source. Beware of the necessary current: 250 mA during WiFi connection, but with important peaks. Powered by a weaker USB charger, it did not work even if the stated steady current was 350mA.

Arduino Code

The full Arduino codes are given in the next page (see below: Arduino code page).

Nextion setup

The two pages designed in NEXTION are shown below.

4.The two pages designed in NEXTION

On the first page are: text (t0), numeric boxes (n0,n1,n2) separated by two text boxes (t1, t2) for ":". Four text boxes on the next row are for time (t3 ...t6). The picture box (p0) contains the weather provider logo, but this picture is changed with one of the 7 pictographs for the weather (e.g p1, p2 on the second page). Once connected and updated, (p0) is replaced by the much smaller weather icon and makes visible (n3) numerical box showing the temperature outside (at the selected nearest weather-station)

In t11 and t12 will be shown the lowest and highest temperatures of the day. Under these boxes, a red line becomes green if the weather forecast was obtained after the last attempt to connect. Below are the wind speed and humidity of the moment, at the nearest (selected) weather station. Under this, is a red line which becomes green if the temperature above is updated after the last connection. Below are the rising and setting time of sun for the indicated day.

The slider (h0) allows one to control the display brightness: just press and slide!

The (bt0) button on the right-low corner is to shift to page 2.

On page 2 there are forecast icons (p1, p2) for the next two days, extreme temperatures (t20, t21, t26, t27), wind (t31, t32) and humidity (t22, t28). The (bt0) bings back to first page (page0).

User guide

Just plug the USB cable to a phone charger providing 5V/1A. If the connection is not established after 10s (the display is not updated), disconnect-reconnect the power.

After midnight, the Nextion enters a sleep condition and back-light goes off. After 6 AM the sleep is over, but the user has to touch the display to activate it. This is useful if you leave for several days!

Project New Contributions

- There are not many projects with ESP32 on the net, so this could be useful. It is like killing flies with a cannon! The ESP32 can be replaced by a much smaller board. Can be tried with the cheaper ESP8266 ESP-01.

- Nextion weather applications exist. This one is very compact and includes a scrolling text describing the forecast for the next hours.