Features and python setup guide to the Seeed Studio 2.13 inch Triple colour e-ink display on the Raspberry Pi Zero W
There are few e-ink, e-paper, displays available for the Raspberry Pi of varying sizes but the controller boards they connect to have different features and connections.
Seeed Studio have a range of e-ink displays for the Raspberry Pi and Ardunio boards. For this guide I have chosen the 2.13 inch 3 colour display and controller board which fits snugly on the Raspberry Pi Zero/W.
E-Ink displays are are low powered as they only require power to change the image. Once the image it is on the screen it does not need power to keep it there. So you can disconnect the screen and still see the image, which makes them popular as electronic name badges or seating name plates and even on shelf price labels. If you are using a battery to power you RPi then the low power consumption compared to LCD display would be an advantage.
e-ink displays don't need a backlight like LCD displays do and are easily readable in bright sunlight. They also have a wide viewing angle so the image looks the same from the side as it does from the front unlike LCD displays that have a limited viewing angle.
2.13 inch e-ink display on a Raspberry Pi zero/w
The disadvantage compared to LCD and displays is they are usually only 2 or 3 colours and it can take about 6-8 seconds for black and white image to update and around 15 seconds for a 3 colour display to update. Though this is a long time for an image to be displayed, they are not designed to be used where the display will change often. It's recommended that if the screen is to change frequently then it should be about 3 minutes apart. Though short bursts of changes can be done within a few seconds of each image changing.
The 3 colour displays are available in black & yellow or black & red with the third colour being white, effectively no image. These take longer to update than the black and white displays because of the way they update. The image is displayed in two stages, first the black parts of the image is displayed and then the coloured parts of the image are displayed. Which is why they take twice as long to update.
This animation shows how the display updates. The text is black and red and the Hydra Dragons picture contains red in the eyes so they update in two stages. The image of the Earth is only Black so updates quicker.
The e-ink Display Controller Hat:
The screen and the controller board are not connected in the box. The screen has a sticky backing to hold it permanently to the controller board but you will need to maneuver the connector cable through a hole in the board and into the connector before you stick the screen down.
The controller board connects to the Raspberry Pi Zero/W via the GPIO port or through a Grove connector used for modular electronics setups and Seeed Studios's small Grove shield for the Raspberry Pi zero and full size Grove shield for the Raspberry Pi's 4,3,2,1 . Communication is through 4 wire SPi using the GPIO port or I2C through the Grove port.
It has two buttons that are connected to the GPIO BCM pins 20 and 21 so you can program them directly via the GPIO port. These could be used to switch between two images or used as a convenient off switch for the Raspberry Pi. The input voltage can be either 3v3 or 5v as there is a built in voltage converter which can be changed by use of a switch mounted next to the Grove port.
Programming:
The screen can be programmed using C using Seeed Studios e-ink driver for the Raspberry Pi. There is a demo that will display the Seeed Studio logo.
It can also be programmed with Python using modified drivers from WaveShare. The WaveShare install instructions for the c and python library are here including the instructions on installing the additional broadcom libraries required, initial setup and demos.
Another resources is from https://github.com/soonuse/epd-library-python
There are different drivers for different screen sizes and models. I received the 2.13 inch e-paper B screen which uses the b or bc driver.
For the screen to work you need a driver file which will have a name like epd2in13bc.py and the config file named epdconfig.py in the lib folder or epdiff.py if you are using the soonuse libraries.
These drivers need to be modified to work with the Seeed e-ink driver board. This is because the gpio pin assignments need altering. If you edit the epdconfig or epdiff files in a text editor you will see a pin assignment section like this
#Pin definition
- RST_PIN = 17
- DC_PIN=25
- CS_PIN=8
- BUSY_PIN=24
These need to be changed to;
#Pin definitions
- RST_PIN = 13
- DC_PIN=6
- CS_PIN=5
- BUSY_PIN=19
The screen uses SPi which uses pins 10 & 11. Make sure that the SPi driver has been enabled in the Raspberry Pi Configuration menu. The two buttons on the controller board use GPIO bcm pins 20 & 21.
Once you have the driver files and modified config file in a folder you can then add your own python3 program to bring the screen to life. You can also now use the demos that come with the drivers.
The screen requires two images to make the final image. One needs to represent black and other for red. These should be a 2 colour bmp files of 212 x 104 pixels. They can be created by hand in a image editor and saved to your program folder or created on the fly using pythons Pillow graphics library. This is the simplest option if you intend to use text as Pillow can be used to convert text into an image as well as build the required image from multiple elements.
Using modified python code of epd_2in13bc_test.py with the WaveShare drivers, this is a basic python program to load the two images and display them:
#!/usr/bin/python import epd2in13b from PIL import Image,ImageDraw,ImageFont epd = epd2in13b.EPD() #driver file epd.init() #Initiate Screen before starting HBlackimage = Image.open('hydra-dragon-B.bmp') #load black image HRedimage = Image.open('hydra-dragon-R.bmp') #load red image #send images to the e-ink display epd.display(epd.getbuffer(HBlackimage.rotate(180)), epd.getbuffer(HRedimage.rotate(180))) epd.sleep() #power off screen
This example displays the text shown in the video and images.
#!/usr/bin/python import epd2in13b from PIL import Image,ImageDraw,ImageFont epd = epd2in13b.EPD() #driver file epd.init() #initiate the screen epd.Clear() #clear the screen HBlackimage = Image.new('1', (epd2in13b.EPD_HEIGHT, epd2in13b.EPD_WIDTH), 255) # 212*104 HRedimage = Image.new('1', (epd2in13b.EPD_HEIGHT, epd2in13b.EPD_WIDTH), 255) # 212*104 drawblack = ImageDraw.Draw(HBlackimage) #create a blank image for Black drawred = ImageDraw.Draw(HRedimage) #create a blank image for Red font14 = ImageFont.truetype('/usr/share/fonts/truetype/freefont/FreeSans.ttf', 14) #Load Font font20 = ImageFont.truetype('/usr/share/fonts/truetype/freefont/FreeSans.ttf', 20) #Load Font #Draw a line of text starting 20 pixels from the left and 86 from the top in Red with font size 14 drawred.text((20, 86), 'RaspberryConnect.com', font = font14, fill = 0) drawblack.text((15, 0), 'Seeed Studio E-Ink', font = font20, fill = 0) drawblack.text((15, 18), '2.13 inch 212 x 104 Pixels', font = font14, fill = 0) #draw a red rectangle. Top left at 20 pixels left 40 pixels from top. #Bottom right 200 pixels from left and 84 from top. The rectangle is an outline. use Fill to make it solid drawred.rectangle((20, 40, 200, 84), outline = 0) drawblack.text((40,41), 'Raspberry Pi', font = font20, fill = 1) drawblack.text((40,60), 'Zero W', font = font20, fill = 2) #Display the images on the e-ink display epd.display(epd.getbuffer(HBlackimage.rotate(180)), epd.getbuffer(HRedimage.rotate(180))) #Power off the diaplay epd.sleep()
Conclusion:
The display is good quality and works well. Seeed Studio supply a drive for c programmers. As I program in python I initially couldn't find a driver for python that worked with the screen. Until i discovered the pin assignments needed changing in the python drivers first. Once the simple modifications are done, it works as good as other display hats on the market but has the additional features of 2 GPIO buttons, a 3v3 to 5v switch and the option to use a Grove connector instead of the Raspberry Pi GPIO. Though intended to fit nicely on a Raspberry Pi Zero the e-ink display works fine on the Raspberry Pi 4 and the other larger models.
With good visibility outside in bright sunlight and indoors, if you need to use a display that updates after intervals of 3 minutes or more then the Seeed Studio Triple Colour 2.13 e-ink display is a good option.
The Seeed Studio Triple Colour 2.13 e-ink display's are available in Black and Red or Black Yellow which fit perfectly on the Raspberry Pi Zero's they have available. There is also a 4 button 2.7 inch e-ink display for the larger Raspberry Pi's 4,3 & 2.
I have built an International Space Station tracker using this e-ink display. The guide to programming it can be found here: python-project-with-e-ink-display-iss-global-tracker
Note: Seeed Studio has supplied the display and controller board for this article but I have express my own views on the display.
It took me a while to get it working until I found a reference to the pins. Glad it was helpful.