ESP32 E-Paper Thermometer

64,365

298

33

Introduction: ESP32 E-Paper Thermometer

About: I am Nick Koumaris from Sparta, Greece. I'm extremely passionate about electronics, making things and design. I love teaching what I know and sharing my experiences with you. I put out new YouTube videos every…

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:

Optional Parts

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.

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!

1 Person Made This Project!

Recommendations

  • Microcontroller Contest

    Microcontroller Contest
  • Automation Contest

    Automation Contest
  • Make it Glow Contest

    Make it Glow Contest

33 Comments

1
ValeryLem
ValeryLem

1 year ago

Hello,
It looks good, but, unfortunately, it did not compile in this form.
Trying to reproduce this project, I get a huge number of messages "multiple definition ...." as a result of compilation, for example:
".......
libraries\GxEPD-master\GxGDEP015OC1\GxGDEP015OC1.cpp.o: In function `GxGDEP015OC1::fillScreen(unsigned short)':
C:\Program Files (x86)\Arduino\libraries\GxEPD-master\src\GxGDEP015OC1/GxGDEP015OC1.h:35: multiple definition of `GxGDEP015OC1::fillScreen(unsigned short)'
sketch\ESP32_Epaper.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\GxEPD-master\src/GxGDEP015OC1/GxGDEP015OC1.cpp:113: first defined here
libraries\GxEPD-master\GxGDEP015OC1\GxGDEP015OC1.cpp.o: In function `GxGDEP015OC1::init(unsigned int)':
GxGDEP015OC1.cpp:(.text._ZN12GxGDEP015OC14initEj+0x0): multiple definition of `GxGDEP015OC1::init(unsigned int)'
sketch\ESP32_Epaper.ino.cpp.o:ESP32_Epaper.ino.cpp:(.text._ZN12GxGDEP015OC14initEj+0x0): first defined here
......" etc...
So sorry, a lot of time was spent looking for errors that turned out to be just negligence:
This works if you replace the inclusion of ".cpp" with ".h" as shown below:
#include
#include
#include
!!!__the original text of the inclusions disappears, I don’t know the reason__!!!
just replace the .cpp extension with .h
Compile project for doit esp32 devkit v1 board
Good luck!

0
kamil47
kamil47

Reply 1 year ago

Hi,
try to replace extension .cpp by extension .h . It is in lines 8, 9, 10. Just in these three lines. Everything else should be OK.

0
educ8s
educ8s

Reply 4 months ago

I have uploaded a new, improved version of the code. Check it out.

0
kamil47
kamil47

Tip 1 year ago

Very nice project, I have tested the display is really miraculous.
But I spent some hours to compile it. There were many errors during compilation and I went through all code lines, disabling and enabling them and finally have found a problem. Three lines 8, 9, 10 with "include" command, extension .cpp should be replaced by extension .h. Than compilation was OK.

0
educ8s
educ8s

Reply 4 months ago

I have uploaded a newer version of the code which works with the latest version of all libraries.

0
hausofpayne17
hausofpayne17

11 months ago

Hi Nick:

I've wired my waveshare 1.54 bw display exactly like yours to my esp32 wroom-32.
I tried selecting both the esp32-dev board and the DOIT ESP32 Dev Kit V1 boards. It uploads in both cases and the temperatures display in the serial monitor at the correct 5 second interval. but NO DISPLAY on the e-paper. I've triple checked my wiring.

Any suggestions


Thank you for your tutorial Nick

Gord

0
CarlosP360
CarlosP360

Reply 10 months ago

Hi Gord,
I have the same problem, have you managed to solve the problem?

Regards
Carlos

0
hausofpayne17
hausofpayne17

Reply 10 months ago

Hi Carlos: Yes, I have solved the problem. My situation is using the 1.54" BW display.

1. Make sure you have the Latest version of the GxEPD2 library. Currently it's 1.2.8 but 1.2.6 fixed it for me.

There's a NEW definition for the 1.54BW display. Use this one:
GxEPD2_BW display(GxEPD2_154_D67(/*CS=5*/ SS, /*DC=*/ 22, /*RST=*/ 21, /*BUSY=*/ 4)); // GDEH0154D67 <----- THIS ONE

Notice the different pin definitions in the statement. The way you wire the pins to the ESP32 Dev Kit V1 is:

Display ESP32 DevKit V1
VCC 3.3V
GND GND
SDI 23
SCLK 18
CS 5
DC 22
RST 21
BUSY 4

That works for me and I'm able to use the basic display demo sketch for the GxEPD2 library. Just activate the display object definition line as above and set the pins in that statement as above.

Good luck!

0
CarlosP360
CarlosP360

Reply 10 months ago

Hello Gord,

Many thanks for your help, but I can't figured out how to transform to GxEPD2 library.
I will apreciate your help :)

here is the code:


/////////////////////////////////////////////////////////////////
// ESP32 E-PAPER THERMOMETER v1.00 //
// Get the latest version of the code here: //
// http://educ8s.tv/esp32-e-paper-thermometer //
/////////////////////////////////////////////////////////////////


#include <OneWire.h>
#include <DallasTemperature.h>

#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>

#include "BitmapGraphics.h"
#include <Fonts/FreeSansBold24pt7b.h>
#define ONE_WIRE_BUS 15
float tempC = 0;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

//GxIO_Class io(SPI, SS, 22, 21);
//GxEPD_Class display(io, 16, 4);


void setup() {

Serial.begin(9600);
display.init();
sensors.begin();

display.drawExampleBitmap(gImage_splash, 0, 0, 200, 200, GxEPD_BLACK);
display.update();
delay(3000);

display.drawExampleBitmap(gImage_gui, 0, 0, 200, 200, GxEPD_BLACK);
display.update();

display.drawExampleBitmap(gImage_gui, sizeof(gImage_gui), GxEPD::bm_default | GxEPD::bm_partial_update);
}

void loop() {

sensors.requestTemperatures();
tempC = sensors.getTempCByIndex(0);

showPartialUpdate(tempC);
printTemperatureToSerial();

delay(5000);
}

void showPartialUpdate(float temperature)
{
String temperatureString = String(temperature,1);
const char* name = "FreeSansBold24pt7b";
const GFXfont* f = &FreeSansBold24pt7b;

uint16_t box_x = 60;
uint16_t box_y = 60;
uint16_t box_w = 90;
uint16_t box_h = 100;
uint16_t cursor_y = box_y + 16;

display.setRotation(45);
display.setFont(f);
display.setTextColor(GxEPD_BLACK);

display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
display.setCursor(box_x, cursor_y+38);
display.print(temperatureString);
display.updateWindow(box_x, box_y, box_w, box_h, true);
}

void printTemperatureToSerial()
{
Serial.print(tempC);
Serial.print(" C");
Serial.print("\t");
}

0
hausofpayne17
hausofpayne17

Reply 10 months ago

HI Carlos.

I'm not sure my last reply took.

I gave up on the Gx_EPD library. I find everything I could possibly want to do, I can do with great refresh rate using the Gx_EPD2 library. The author of Gx_EPD did the '2' version to make it easier to work with.

Why not load up Gx_EPD2, wire up the board/epaper as per my instructions and try the Gx_EPD_Example sketch in the library.

Once you get that going, you can easily take the thermometer specific code out of your sketch, put it in the other and you're up and running!

Good luck Carlos! Keep at it!

Gord

0
CarlosP360
CarlosP360

Reply 10 months ago

Hi Gord,

Finaly, and with your fantastic help, Its working!!
I am so happy!
Thank you, thank you, thank you!!

Carlos

0
hausofpayne17
hausofpayne17

Reply 10 months ago

That's great Carlos! Bravo!
Now go make something wonderful!

0
hausofpayne17
hausofpayne17

Reply 10 months ago

Hi Carlos:

I see what you mean.

In truth, this sketch is pretty simple and you can take bits of it and incorporate it into a Gx_EPD2 sample sketch like
the Gx_EPD2_Example sketch, the first one in the list in the Examples for the Gx_EPD2 libary.

You'll be able to see how graphics work and putting text on the paper including full and partial updates.

I frankly gave up on Gx_EPD and the writer of that library intentionally created Gx_EPD2 as a simplified way to interact with e-papers. It's still an extremely powerful set of features and it's a one-line object definition and then you can get into the programming.

My I suggest you set this temperature demo aside for a few hours. install Gx_EPD2, wire up the epaper as I suggest and defining the pins in the GX_EPD2_Example sketch and see if you can get your epaper to start displaying stuff. Then you could move across the temperature sensor code from the other sketch and get your temperature sketch working.

I understand your frustration Carlos. I got my first e-paper displays in October and didn't get the Black and White one working until February when I updated the Gx_EPD2 library and found the new wiring plan, which I only discovered by chance and blind searching. It was really disheartening. I actually thought my two black and white screens from two different manufacturers were both defective. But now I'm able to proceed with some great features of the e-paper and I'm very happy with the performance.

Good luck and keep at it!

Gord

0
JosefZ1
JosefZ1

3 years ago

Very nice ... I watch your projects!
My Wifi Weather Station with ePaper 2.9 + ESP Adafruit HUZZAH ESP8266 + DHT22 runs
on one charge for a month! :-)

DSC_2444.JPGEPD_29_OK_PCB.JPG
0
educ8s
educ8s

Reply 3 years ago

This is very cool! Thanks for sharing. Please post an Instructable about it. It is very interesting!

0
kamil47
kamil47

Reply 1 year ago

Ahoj Jozef, je to perfektné, kedy to zverejníš? Nemas viac podrobnosti k Wifi Weather Station? Najviac ma zaujíma ako sa vyrvorí bitmap pre E-paper display, tie návody sú nejasné. Ďakujem

0
kamil47
kamil47

Question 1 year ago

I would like to know some more about display, how to control pixels, how to modify text on display, how to create bitmap file for it and so on. All available details are not very clear. Have you any ideas?

0
esp32
esp32

1 year ago on Step 7

Hi,
nice project. I also tried to run a e-paper project on the ESP32 (with a Waveshare 2.9 e-paper).
So I would like to recharge my battery (with is driving the ESP32 and the epaper) as less as possible. Therefore I also ordered a Firebeetle ESP32 (which should have a power consumption in µA range while in deep sleep - which is (up to my knowledge and my experiments - not possible with the "normal" ESP32 boards).

But I find a big problem when using the Firebeetle instead of a "regular" ESP32 board, and I wonder if you have also seen that:
When using the "partial Update /partial refesh" feature of the small Waveshare e-papers (which is a great feature for quick update without flicker) on a normal board (not Firebeetle ESP32) in combination with the deep sleep mode) it works well.
Using the Firebeetle ESP32 board instead the partial updated places in the display getting blurring.
Only Full Update works (but I even want to avoid this mode).

Any ideas?