Using Waveshare 4.3″ E-paper Display with Arduino
Screen technologies have evolved over the years since the cathode ray tube was first demonstrated in 1897, we have moved from plasma to LCDs, followed by LEDs, OLEDs, and more recently e-paper which is what we will look into today. Electronic paper/e-paper displays are display devices which were created to mimic the appearance of ink on a common paper. Unlike the other kind of displays which emit light, e-paper displays reflect light just like an ordinary paper. This gives e-paper displays a wider viewing angle, ensure they consume less power and makes looking at them easier as it gives the same feel as looking at an ordinary paper without the glare that comes from looking at a screen. The coolest feature of this display is its ability to display the last text or graphics uploaded to it even when it is not connected to power. This helps save a lot of power and is the key feature for most applications for which e-paper displays are deployed.
The popularity of e-paper displays is on the rise (used in Amazon’s Kindle) due to the unique features mentioned above, that’s why, for this tutorial, we will look at how to use e-paper displays in Arduino projects, to give the projects an extra layer of sophistication and coolness.
E-paper displays come in different sizes like every other kind of display, but for this tutorial, we will use the Waveshare 4.3″ e-paper display. Some of the features of this display are listed below.
- Easy to use, display any content via one serial interface, including geometric graphics, texts, and images
- Embedded font libraries, supports 32, 48 and 64 dot matrix GBK Chinese fonts and English fonts
- Built-in 128MB NandFlash, allows the font/image data to be stored in either an external TF card or the internal NandFlash
- 4 grey level displaying, 800×600 resolution
- Adjustable serial interface baud rate, 115200 by default when power up
- Powered from 3.3V to 5V, compatible with 3.3v/5v logic level.
- Ultra low power consumption, sleeping current lower than 5mA
Our basic goal with this project will be to display basic text and graphics on the e-paper display, by doing this, we will be able to cover the functions that may be needed for you to use the e-paper display in your own custom projects.
The following components are required to build this project;
As usual, the exact version of the components used for this tutorial can be bought via the links attached to each of them. The link attached to the e-paper display above takes you to the page where you can acquire the 4.3″ e-paper display but any other display size can be used for this tutorial.
E-paper display generally uses UART protocol for communication with microcontrollers. The display has five pins including;
- Din (data in pin)
- Do (data out pin)
- Wake up pin
Connect the display to the Arduino as shown in the schematics below. Depending on the accessories that come with your own display, you may need to use a breadboard or not.
To make the connections easier to follow, the pin connection between the Arduino and the e-paper display is further described below.
Display – Arduino
VCC - 5v GND - GND DIN - RX(D0) DOUT - TX(D1) Wake - D2
Just like the schematics, the code for this project is equally easy. For this project, we will use the e-paper display library provided by Waveshare. The library can be downloaded from the download section towards the end of this post. To demonstrate the abilities of the e-paper display, we will use the demo code provided along with the library. The demo code provides commands needed to display images and text on the e-paper display. Due to the low refresh rate of this particular e-paper display, it cannot be used to display animations, but this may be possible with other e-paper displays which have better refresh rates.
To briefly explain the demo code, as usual, we start by including the libraries that will be used in the code, in this case, the epd.h library to enable easy communication with the e-paper display.
Next is the base_draw function which contains the functions to draw a different kind of shapes from lines to the rectangle,
The next function is the draw text function. Like the base_draw() function, this function has all that is needed to display different text formats.
The next function is the draw_bitmap function. Just like most of the other displays we have worked with on this website, to display an image on the e-paper display, the image has to be in a bitmap format. The draw_bitmap function contains the commands to be used for displaying images on the e-paper display.
Next, is the setup function. We start the function by declaring the led connected to pin 13 on the Arduino. This led is used as a user initialize LED to confirm communication between the Arduino and the display. With this done, we then initialize the display, activate the wakeup… and set the memory which we want the display to use. The display can either use the onboard NAND memory or an SD card.
The tasks being performed by the void loop function are simple. All it does is to call the functions that were created above one after the other.
The complete code can be downloaded alongside the library from the download section of this tutorial.
Before uploading the code for this project, disconnect the Din and Dout pins of the display from pins D0 and D1 of the Arduino. This is to allow a smooth upload of the code as those particular pins will also be used by the Arduino to communicate with the computer. Connect the pins back after uploading the code to the Arduino, and wait a few secomds. You should see the display come up with different images and text.
That’s it for this tutorial guys, what cool thing will you build with this display, feel free to share ideas under the comment section below.
The youtube version of this tutorial can be watched here.