In this tutorial we will see how to make a weather station with esp32 and electronic ink display. We will analyze the source code, as well as see the connections of the electronic components, finally test the project with its operation. The printed circuit board is included completely free of charge.
You may be interested in projects in Arduino, pic, robotics, telecommunications, subscribe http://www.youtube.com/user/carlosvolt?sub_confirmation=1 videos with full source code and diagrams
Circuit
FEATURES of the ESP32-T module
Connectivity
The ESP32 module has all the wiFi variants:
- 802.11 b/g/n/e/i/n
- Wi-Fi Direct (P2P), P2P Discovery, P2P Group Owner mode and P2P Power Management
This new version includes low-power Bluethoot connectivity
- Bluetooth v4.2 BR/EDR and BLE
- BLE Beacon
In addition, you can communicate using SPI, I2C, UART, MAC Ethernet, Host SD protocols
Microcontroller features
The CPU consists of a Tensilica LX6 Model SoC with the following features and memory
- Dual 32-bit core with 160MHz speed
- 448 kBytes ROM
- 520kByteS SRAM
Have 48 Pins
- 18 12-bit ADC
- 2 8-bit DAC
- 10 pin contact sensors
- 16 PWM
- 20 Digital inputs/outputs
Power and consumption modes
For proper operation of the ESP32 it is necessary to supply a voltage between 2.8V and 3.6V. The energy you consume depends on the mode of operation. It contains a mode, the Ultra Low Power Solution (ULP),in which basic tasks (ADC, PSTN…) continue to be performed in Sleep mode.
TEMPERATURE and Humidity Sensor DHT11
This module consists of a DHT11 digital humidity and temperature sensor and a resistance of 1 ko. The DHT11 uses an internal thermistor and capacitive humidity sensor to determine environmental conditions, an internal chip is responsible for converting readings to a serial digital signal.
Operating voltage | 3.3V to 5.5V |
Humidity measurement range | 20% to 90% RH |
Humidity measurement accuracy | ± 5% RH |
Moisture measurement resolution | 1% RH |
Temperature measuring range | 0oC to 50oC [32oF to 122oF] |
Temperature measurement accuracy | ± 2oC |
Temperature measurement resolution | 1oC |
Signal transmission range | 20m |
Electronic ink display 4.3 Inch E-Paper 800×600
Overview
This is a serial interface E-Ink display module, 4.3 inches, 800 × 600 resolution, with built-in font libraries, ultra-low power consumption.
You don’t have to know anything about e-Paper’s complex underlying details, or the specific algorithms for displaying graphics, texts, and images. All you need is the serial interface, and all that matters is your creativity.
Features
- Easy to use, it displays any content through a serial interface, including geometric graphics, texts and images
- Embedded font libraries, supports Chinese 32-point, 48-point, and 64-dot GBK fonts and English fonts
- The built-in 128MB NandFlash allows source/image data to be stored on an external TF card or on the internal NandFlash
- 4-level gray display, resolution 800 × 600
- Adjustable serial interface baud rate, 115200 by default when turned on
- Powered from 3.3V to 5V, compatible with logical level.
- Ultra-low power consumption, resting current less than 5 mA
- Comes with host computer software, control it directly on your computer
Applications
- eBook
- POS Shopping Center
- Price tag
- Industry instrument
Pin Definitions
- VCC: 3.3V x 5.5V
- GND: GND
- DOUT: serial data output
- DIN: serial data in
- WAKE_UP: external alarm clock
- RST: external reset
Learn more about this screen in http://rogerbit.com/wprb/2019/01/tutorial-pantalla-de-tinta-electronica-de-4-3-pulgadas-por-dfrobot/
Source
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
// Canal de youtube http://www.youtube.com/user/carlosvolt?sub_confirmation=1 //Tik-Tok https://www.tiktok.com/@carlosvolt //https://www.instagram.com/carlosvolt_electronic_robotic #include <WiFi.h> #include <Wire.h> #include <NTPClient.h> #include "DHT.h" #include <epd.h>//Librería para el control del display // Descomenta le linea dependiendo del sensor que vallas a usar #define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT21 // DHT 21 //#define DHTTYPE DHT22 // DHT 22 #define DHTPin 23 //PIin del sensor DHT; DHT dht(DHTPin, DHTTYPE); float t; float h; char temp[32]; char hume[32]; String ip; String hora; const void * dir_ip; const void * horaUTC; int periodo = 10000; unsigned long Tiempo = 0; WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP); const char* ssid = "Tu_red_Wifi"; const char* password = "Tu_Clave_Wifi"; WiFiServer server(80); void setup() { Serial.begin(115200); dht.begin();//Inicializar el sensor DHT Serial.print("Conectando a la red WiFi"); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("Conectado con éxito a la red WiFi."); Serial.println("La dirección IP es: "); Serial.println(WiFi.localIP()); server.begin(); Serial.println("Servidor iniciado"); timeClient.begin();//Inicializa servidor NTP //Inicializamos el el display epd_init(); epd_wakeup(); epd_set_memory(MEM_NAND); delay(2000); } void loop() { timeClient.update();//Obtenemos la hora actulizada h = dht.readHumidity();//Lectura de la humedad t = dht.readTemperature();//Lectura de la temperatura //Adactamos los datos de temperatura y humedad, direción ip y hora UTC para mostrarlo en el display dtostrf(t, 8, 2, temp); dtostrf(h, 8, 2, hume); ip = String() + WiFi.localIP()[0] + "." + WiFi.localIP()[1] + "." + WiFi.localIP()[2] + "." + WiFi.localIP()[3]; hora = timeClient.getFormattedTime(); dir_ip = ip.c_str(); horaUTC = hora.c_str(); //////Se cumple esta condición cada 10 segundos if(millis() > Tiempo + periodo){ Tiempo = millis(); textoDisplay();//Llamamos a la función para mostrar datos en el display } WiFiClient client = server.available(); if (client)//Si se cumple la condición, mostramos dotos en el webserver { Serial.println("Cliente web conectado "); String request = client.readStringUntil('\r'); client.println("HTTP/1.1 200 OK"); client.println("Content-type:text/html"); client.println("Connection: close"); client.println(); client.println("<!DOCTYPE html><html>"); client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"); client.println("<link rel=\"icon\" href=\"data:,\">"); client.println("</style></head><body><h1>Servidor Web con esp32 y display E-Paper</h1>"); client.println("<h2>Tipo de sensor DHT11</h2>"); client.println("<h2>www.rogerbit.com</h2>"); client.println("<table><tr><th>Valores Leidos</th><th>VALUE</th></tr>"); client.println("<tr><td>Temp. Celsius</td><td><span class=\"sensor\">"); client.println(t); client.println(" *C</span></td></tr>"); client.println("<tr><td>Humedad</td><td><span class=\"sensor\">"); client.println(h); client.println(" %</span></td></tr>"); client.println("<tr><td>Ultima actualizacion Hora UTC</td><td><span class=\"sensor\">"); client.println(hora); client.println("</span></td></tr>"); client.println("</body></html>"); client.stop(); client.println(); Serial.println("Client disconnected."); Serial.println(""); } } void textoDisplay(void) { ////Estación meteorológica epd_set_ch_font(GBK64); epd_set_en_font(ASCII64); epd_disp_string("ESTACION-METEOROLAGICA", 0, 10); ////Temperatura epd_set_ch_font(GBK64); epd_set_en_font(ASCII64); epd_disp_string("Temperatura: ", 0, 80); epd_disp_string(temp, 350, 80); epd_disp_string("Grados C", 510, 80); ////Humedad epd_set_ch_font(GBK64); epd_set_en_font(ASCII64); epd_disp_string("Humedad: ", 0, 150); epd_disp_string(hume, 350, 150); epd_disp_string("Porciento", 510, 150); ////Hora UTC epd_set_ch_font(GBK64); epd_set_en_font(ASCII64); epd_disp_string("Hora UTC:", 0, 240); epd_disp_string(horaUTC, 350, 240); ////Dirección IP epd_set_ch_font(GBK64); epd_set_en_font(ASCII64); epd_disp_string("Direccion IP: ", 0, 310); epd_disp_string(dir_ip, 350, 310); epd_udpate(); } |
SUBSCRIBE TO OUR NEWSLETTERS, RECEIVE IN YOUR EMAIL THE MOST OUTSTANDING NEWS, JUST BY ENTERING YOUR EMAIL
[wysija_form id=”1″]
RECOMMENDED PROJECT