Introduction: ESP32 E-Paper Thermometer
Dear friends welcome to another project video! Today, we are going to use this small e-paper display with the ESP32 board and build a simple thermometer! It is a very easy project to build. It won’t take us more than 5 minutes so let’s get started!
As you can see, I have connected a small e-paper screen to an ESP32 board. At the screen, we display the temperature which is being measured by this temperature sensor the DS18B20. The temperature reading on the screen is updated every 5 seconds. The cool thing is that we don’t refresh the whole screen which is very slow, only part of the screen which is fast and low-power!
Great, the project is working fine but let’s now see how to build it!
Step 1: Get All the Parts
The parts needed are the following:
- An ESP32 Board ▶ http://educ8s.tv/part/ESP32
- A 1.5 Inch E-Paper Display ▶ http://educ8s.tv/part/EPaper154
- A DS18B20 Sensor ▶ http://educ8s.tv/part/DS18B20
- A breadboard ▶ http://educ8s.tv/part/SmallBreadboard
- Some wires ▶ http://educ8s.tv/part/Wires
Optional Parts
- Powerbank ▶ http://educ8s.tv/part/Powerbank
- Firebeetle Board ▶ http://educ8s.tv/part/FireBeetle
The total cost of the project is around 30$.
Step 2: The ESP32 Board
This is the second project I ever build with the new ESP32 chip.
If you are not familiar with it, the ESP32 chip is the successor of the popular ESP8266 chip we have used many times in the past. The ESP32 is a beast! It offers two 32 processing cores which operate at 160MHz, a massive amount of memory, WiFi, Bluetooth and many other features with a cost of around 7$! Amazing stuff!
Please watch the detailed review I have prepared for this board. I have attached the video on this Instructable. It will help understand why this chip will change the way we make things forever!
One of the most exciting things about the ESP32 is that even though it is so powerful, it offers a deep-sleep mode which requires only 10μΑs of current. This makes the ESP32 the ideal chip for low power applications.
Step 3: The 1.54" E-Paper Display
Let's now take a look at the E-Paper Display.
This display is small, it is 1.54inch, and it is relatively inexpensive. It costs around 15$. I can hear you ask, is it really inexpensive? It costs 15$ and it is so small! You are right, it is very expensive for a tiny display like this, but you have to take in consideration that it is an e-paper display, and e-paper displays are expensive. For example a 4.3-inch e-paper display I reviewed a few years ago costs around $50!
For the first time, we now have access to smaller and cheaper e-paper displays. So, we can now build low-cost projects which will use e-paper displays! I am really excited about this. But why use an e-paper display in a project?
E-Paper or Electronic paper are displays that unlike traditional LCD or OLED displays does not emit light but reflect light. It is like the ink on the paper. This characteristic makes e-paper displays very comfortable to read, and they have excellent readability under direct sunlight. Another great thing about e-paper displays is that they can hold static text and images for months without electricity! Yes, that’s correct, the display can show text and images even when it is off! That makes e-paper displays ideal for low powered projects!
Unfortunately, there are some disadvantages as well. The price of e-paper display is still very high. Another significant disadvantage is that e-paper displays take a lot of time to update, as much as 2-3 seconds. So, they are only helpful for static text and images and not animations. This display supports partial screen update which is so cool!
Let’s now see how to use this small e-paper display with Arduino. The display offers a resolution of 200x200 pixels which is great and it uses the SPI interface.
Step 4: The DS18B20 Sensor
The DS18B20 is a digital thermometer that accurately measures temperature in the range -10°C to +85°C and also includes alarm functions and trigger points.
It is a very easy sensor to use because it uses the One-Wire interface. So, we only need to connect one wire to make it work! I have used this sensor a lot in the past, and I am going to use it a lot in the future as well because of its ease of use and accuracy. The cost of the sensor is around $2.
Step 5: Connect All the Parts
The E-Paper screen uses the SPI interface to communicate with the ESP32 board so we must connect it to the hardware SPI pins of the ESP32 board we use. It took me some time to find out which pins are the SPI pins on this board searching online. After I discovered them, I designed this, to save you some of your precious time. You can find the pinout diagram of this ESP32 board in the description below.
Now that we know the pins we need all we have to do is to connect the display and the sensor to the ESP32 according to this schematic diagram. Luckily all the SPI pin are placed on the same side of this ESP32 board so we can use a breadboard to test our project. After connecting all the parts together all we have to do is to power up the project.
At first, the project displays a splash screen for 3 seconds and then it shows the temperature icon. A few moments later the temperature reading appears. The temperature reading is updated once every 5 seconds. I have also prepared a version of the code with the temperature displayed in degrees Fahrenheit for the friends of the channel living in the United States.
Step 6: The Code of the Project
The code of the project is relatively simple.
We use the great GxEPD library to drive the display and a library for the temperature sensor.
- E-Paper Display Library: https://github.com/ZinggJM/GxEPD
- DS18B20 Library: https://github.com/milesburton/Arduino-Temperature-Control-Library
At first we display the splash screen which is a bitmap file designed in Photoshop.
display.drawExampleBitmap(gImage_splash, 0, 0, 200, 200, GxEPD_BLACK);<br>display.update(); delay(3000);
Then we display another bitmap which is the main GUI of the project.
display.drawExampleBitmap(gImage_gui, 0, 0, 200, 200, GxEPD_BLACK);<br>display.update();</p><p>display.drawExampleBitmap(gImage_gui, sizeof(gImage_gui), GxEPD::bm_default | GxEPD::bm_partial_update);
The Wiki of the screen has detailed instructions on how to load bitmap graphics on this screen.
https://www.waveshare.com/wiki/1.54inch_e-Paper_Module
In the loop function, we read the temperature every five seconds and we print the temperature we read on the display. We don’t refresh the whole display because it takes a lot of time, only the temperature part using the partial screen update function.
void loop() { sensors.requestTemperatures(); tempC = sensors.getTempCByIndex(0); showPartialUpdate(tempC); printTemperatureToSerial(); delay(5000); }
As always you can find the code of the project attached to this Instructable.
Step 7: Final Thoughts & Improvements
The project works fine, and it looks great. The e-paper display is ideal for a project like this because it offers great readability and extremely low-power consumption. When the screen is not updating it needs only 0.02mAs of current! The ESP32 board needs around 60mA of current when operating.
In the next Instructable, I will try to reduce the power consumption of the project. The goal is to make this project able to run on batteries for months. To achieve that I am going to learn how to put the ESP32 to sleep to conserve power and I am going to use another ESP32 board, the Firebeetle ESP32 by DFrobot. The creators of the board claim that this board requires only 12μΑ of current in sleep mode. So, in theory, the DFrobot Firebeetle board with an E-Paper display will need only 0.03mA in sleep mode! This means that we can easily make this project last on batteries for over a year! I can’t wait to try it and share my results with you.
I would love to hear your opinion about this project. Are you going to build any project with an ESP32 and an e-paper display? Please post your ideas in the comments section below; I love reading your thoughts!