Wetterstation mit E-Paper Display und WLAN-Anbindung - AZ-Delivery

The following article was made available to us by the guest author Niklas Heinzel.

After a while, it was time again: a new project was on and the choice fell on a project, which in the end should be a finished weather station with a WLAN connection.

In forums, YouTube videos, or blogs like this, you mostly decided on a variant from TFT display (touch/non-touch), OLED display, monochrome display, or other popular display technologies.

This project, however, should be about the use of an e-paper display. More precisely that 4.2 “400 × 300 EPAPER DIFFORM Module With SPI interface of Waveshare in combination with the ESP32 from the AZ-Delivery Shop.

First of all, I made myself the cabling of the two components, very comfortable if you don't have to connect another periphery, such as sensors, voltage converters, etc.

On this one that Connecting diagram, remains the same for all display sizes due to the standardized SPI communication:

Circuit diagram


Source Code

After all the connections have been successfully established (do not be surprised with the display when soldering the jumper cable, this can take some time because the display on the back has a copper layer that derives the heat of the soldering iron very well and cools the piston), we can now start programming the ESP32.

To do this, I use the excellent library called “ESP32-e paper-Weather display“By David Bird, an excellent maker from Great Britain. He helped me adapt the library, which means that it is now possible to correctly display everything adapted to the roof region. At the end of the blog, I will provide the code and supplementary files for the “main code” for download.

Here is a link to his Github repository:

https://github.com/G6EJD/ESP32-e-Paper-Weather-Display

It is only necessary to adapt a few lines of code for the individual application/location. We are now going through this below:

First, we'll see them owm_crediales.h File.

// Change to your wifi credentials
const char* SSID     = "WLAN SSID";
const char* password = "WLAN password";

// use your own API key by signing up for a free developmentoper account at https://openweathermap.org/
String Apikey       = "Enter the API key here!";                      // Lake: https://openweathermap.org/
const char server[] = "api.openweathermap.org";
//http://api.openweathermap.org/data/2.5/forecast?q=Melksham,UK&APPID=your_OWM_API_key&mode=json&units=metric&cnt=40
//http://api.openweathermap.org/data/2.5/weather?q=Melksham,UK&APPID=your_OWM_API_key&mode=json&units=metric&cnt=1
// Set Your Location According to OWM Locations
String City             = "Name of the hometown";                      // your home city lake: http://bulk.openweathermap.org/sample/
String Country          = "De";                            // your _ISO-3166-1_TWO-LETTER_CODETRY_CODE COUNTY CODE, on OWM Find your Nearest City and the Country Code is displayed
                                                           // https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
String Language         = "De";                            // Note: Only the Weather description is translated by OWM
                                                           // Examples: arabic (ar) czech (cz) English (en) Greek (el) Persian (Farsi) (Fa) Galician (GL) Hungarian (HU) Japanese (yes)
                                                           // Korean (kr) Latvian (la) lithuanian (LT) Macedonian (MK) Slovak (SK) Slovenian (SL) Vietnamese (VI)
String Hemisphere       = "North";                         // Or "South"
String Unit            = "M";                             // use 'm' for metric or i for imperial 
const char* Timezone    = "CET-1CEST, M3.5.0, M10.5.0/3";  // Choose your time zone from: https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv 
                                                           // Lake Below for Examples
const char* ntpserver   = "0.europe.pool.ntp.org";                  // or, choose a time server close to you, but in most cases it's best to use pool.ntp.org to find an ntp server
                                                           // Then the NTP System Decides e.G. 0.pool.ntp.org, 1.Pool.ntp.org as the ntp syem tries to find the closest Available server
                                                           // EU "0.Europe.pool.ntp.org"
                                                           // us "0.north-arica.pool.ntp.org"
                                                           // Lake: https://www.ntppool.org/en/                                                           
intimately   GMTOFFSET_SEC     = 0;    // UK normal time is GMT, so GMT OFFSET IS 0, for us (-5hrs) is typicalally -18000, au is typical (+8HRS) 28800
intimately  daylightoffset_sec = 3600; // In the UK DST IS + 1HR OR 3600-SECs, other Countries May Use 2HRS 7200 OR 30mins 1800 OR 5.5HRS 19800 AHAD OF GMT Use + Offset Behind-Offset

// Example time zones
// Const char* Timezone = "Met-1metdst, M3.5.0/01, M10.5.0/02"; // Most of Europe
// Const Char* Timezone = "CET-1CEST, M3.5.0, M10.5.0/3"; // Central Europe
// Const char* Timezone = "Est-2metdst, M3.5.0/01, M10.5.0/02"; // Most of Europe
// Const Char* Timezone = "Est5edt, M3.2.0, M11.1.0"; // EST USA
// Const char* Timezone = "CSt6cdt, M3.2.0, M11.1.0"; // CST USA
// Const Char* Timezone = "MSt7mdt, M4.1.0, M10.5.0"; // MST USA
// Const Char* Timezone = "NZST-12NZDT, M9.5.0, M4.1.0/3"; // Auckland
// Const char* Timezone = "Eet-2Eest, M3.5.5/0, M10.5.5/0"; // Asia
// Const char* Timezone = "ACST-9: 30Acdt, M10.1.0, M4.1.0/3": // Australia

With these outsourced lines of code, almost all settings that are necessary for successful operation can be used. I have prescribed all important parameters. The yellow stored specification must be hit by them. First, the WLAN SSID and the password must be entered. Then the API key yours http://www.openweathermap.org Enter Accounts, which enables you to access weather data via the freely accessible API. Afterward, it is only important to define the name of your city/place and to enter them in capital letters.

With the help of this outsourced information, the ESP32 is now possible to access the API from OpenWeatherMap via your WLAN and thus obtain the required weather data.

Now let's turn to the Arduino code, in which hardly any changes will be necessary in most cases. In addition to the pre-installed libraries and the integrated files, the code needs owm_crediales.h and Lang_gr.H (Language library I adapted) only the Libraries U8G2_FOR_ADAFRUIT_GFX, adafruit_gfx, and Gxepd2that you can install through the library management.

(Please note that different definitions in the code are necessary depending on the version. The code shown here builds on the latest versions at the time of publication.)

#include "owm_crediales.h"  // See 'owm_crediales' Tab and Enter Your Owm Api Key and Set the Wifi Ssid and Password
#include <Arduinojson.H>       // https://github.com/bblanchon/ArduinoJson
#include <Wifi.H>              // Built-in
#include "Time.H"              // Built-in
#include <Spi.H>               // Built-in
#define  Enable_gxepd2_display 0
#include <Gxepd2_bw.H>
#include <Gxepd2_3c.H>
#include <U8G2_FOR_ADAFRUIT_GFX.H>
#include "epaper_fonts.h"
#include "Forecast_Record.H"
//#include "long.h"
//#include "Lang_cz.H" // Localization (Czech)
//#include "Lang_fr.H" // Localization (French)
#include "Lang_Gr.H"                // Localization (German)
//#include "Lang_it.H" // Localization (Italian)
//#include "Lang_nl.h" // Localization (Dutch)
//#include "Lang_pl.h" // Localization (polish)

#define Screen_Width  400.0    // Set for Landscape Mode, Don't Remove the Decimal Place!
#define Screen_height 300.0

If you do not follow the connection diagram, changing the connections from the display to the ESP32 in the .ino file is also possible.

// Connections for e.G. Lolin D32
static const uint8_t EPD_Busy = 4;  // to EPD Busy
static const uint8_t EPD_CS   = 5;  // to EPD CS
static const uint8_t Epd_rst  = 16; // to EPD RST
static const uint8_t EPD_DC   = 17; // to EPD DC
static const uint8_t EPD_SCK  = 18; // to EPD CLK
static const uint8_t EPD_MISO = 19; // master-in slave-out not used, as no data from display
static const uint8_t Epd_mosi = 23; // to epd din

Sketch download

Housing from the 3D printer

This would create all the prerequisites for the successful start of the display! All diagrams, labels, and routines are inevitable and do not have to be changed.

There is also the possibility to connect a battery to the ADC of the ESP32. The battery level is then displayed on the top right of the display. Due to the Deep Sleep mode of the ESP32 and the update rate of 30 minutes, the battery operation is highly recommended, as this creates the device with smaller battery capacities (<1000mAh) for several weeks.

In my case, I chose the operation with a small 5V power supply, since a battery operation in terms of location in terms of location would be not very sensible right next to a socket.

In order to give the project a nice dwelling, I started with Autodesk Fusion 360 on the design of a 3D print housing, and the following design was created:

3D design

It is made up of a kind of “picture frame” for the e-paper display including recesses for the cables to remove the cables and a box for the ESP32. The housing is arched so that it is not vertically on the table or the like. Holes for threaded inserts are integrated into the front part so that the two parts can be simply screwed.

After printing the parts, I have now put together the components and everything is ready. Unfortunately, due to time constraints, I was only able to use the 3D printer during my operation, but it has to deal with strong warping, which is why I excuse the bent housing parts.

finished display

Finished display 2

Download 3D print files

And we already have a finished e-paper weather station with ESP32, which is clearly presented at any time of the day and night. I hope you will have fun with the project and I look forward to the comments and potential adaptations. : D

Best regards

Niklas Heinzel

Annotation:

Also look at the blog series on e-paper display (Part 1, Part 2)


DisplaysEsp-32Projekte für anfängerSmart home

58 comments

Jürgen

Jürgen

Hi,
wiedermal ein tolles Tutorial von Dir! Vielen Dank dafür!
Da ich schon einige Zeit ein 4,2 400×300 ePaper Display Modul zu liegen hatte, habe ich mich mal mit einem ESP-WROOM-32 an die Umsetzung gemacht und die GPIO’s entsprechend verändert. Das kompilieren ist allerdings immer bei #include hängen geblieben (file not found!?). Nach der Änderung (trial and error ,-) ) in #include “common.h” hat’s dann geklappt.
Vom Display selbst bin ich ein wenig enttäuscht. Mein 1,54inch-Display lässt sich um einiges besser ablesen. Eine Idee woran das liegen könnte?

Ingo

Ingo

Hallo Andreas, vielen Dank für den interessanten Artikel! Kannst Du mir sagen welches Display es genau ist, dass hier verwendet wird oder gibt es ggf. Alternativen?

Danke und Gruß

Ingo

Juergen

Juergen

Bei der Wetterstation.ino erhalte ich folgende Fehlermeldung: ‘obtain_wx_data’ was not declared in this scope. Zeile if (RxForecast == false) …. in void setup().
Ich verwende die Arduino IDE 1.8.16.
MfG
Juergen

Juergen

Juergen

Ich habe die genannte Datei in der Zwischenzeit gefunden.
Hinweis in der Datei: platformio.ini.
MfG
Juergen

Juergen

Juergen

Wo kann ich denn die Datei “M5CoreInk.h” finden ?
Diese Datei wird z.B. für die Beispieldatei "M5_CoreInk.ino benötigt.
Verwendet habe ich: ESP-e-Paper_Weather-Display-master.zip.
MfG
Juergen

Michael Obe

Michael Obe

Hallo,

bei mir reklamiert das Programm die und

Eine Idee, was ich übersehen habe?

Danke

Stefan

Stefan

Cooles Projekt! Schaut klasse aus! Warum gibts denn im Shop keine e-Paper Displays?

Tom

Tom

Hallo,
ich musste lt Pkt. 4 in der README.md auf GitHub die Zeile:
display.init(115200, true, 2, false); durch display.init(); ersetzen.
Erst dann erwachte mein 4,2 Zoll Waveshare Display.
Vielleicht hilft dies ja auch jemanden.
Gruß Tom

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. ESP32 jetzt über den Boardverwalter installieren - AZ-Delivery
  2. Internet-Radio mit dem ESP32 - UPDATE - AZ-Delivery
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1 - AZ-Delivery
  4. ESP32 - das Multitalent - AZ-Delivery