Home

Awesome

4.3 inch e-Paper Display

Scripts to display vector shapes, BMP images and texts on WaveShare 4.3 inch e-paper display module via command-line instead of the Windows-only tools provided by the manufacture.

epd.py is based on the Arduino/C++ library provided by the manufacture.

4_level_gray_4bpp_BMP_converter.py is the solution to my question on StackExchange about converting images for the e-paper display. It relies on imagemagick for preprocessing the pixels and pipe into the converter as input.

Execute ./convert_to_grayscale.sh <source_image> to convert the source image to BMP format.

The outcome is a BMP image with the following attributes:

Interact With the e-Paper Display

>>> from epd import *
>>> help()              # prints help message which details all available functions
...
>>> epd_connect()       # must initiate a connection first, and then send commands to EPD
> EPD connected
> EPD handshake
...                     # whatever you want to do with EPD
>>> epd_disconnect()    # a clean finish after use

Enabling WiFi Communication

The original e-paper display does not have WiFi support. I added an ESP8266 module to it as a TCP-serial relay and it works pretty well. epd_connect() will try TCP connection first, else falls back to serial port. All function calls are the same for TCP or serial connection, except I have not implemented read-reply via TCP. i.e. no VERBOSE mode for TCP/IP connection.

The baud rate should not be changed while connected via TCP/IP, as the WiFi module defaults to 115200 bps which does not change with the e-paper display.

In wifi-relay folder you will find the firmware and scripts to be deployed onto the ESP8266 WiFi module.

Enabling ESP8266

ESP8266 module does not work with 5V.

I suggest you get a cheap USB serial adapter from ebay, which supports 3.3V power output.

You will need to connect a 4.7k or 10k Ohm resistor across VCC and CH_PD to enable the module (in other words, to make it run). I have soldered a resistor in-place permanently.

Flashing Firmware

  1. Power off the module
  2. Connect GPIO0 and GND
  3. Power on

Now it is in flash mode and will take new firmware. You can now disconnect GPIO0 and GND.

esptool.py is the simplest and best tool I could find to flash firmware into ESP8266. It's up to you to download that single file script, and execute as below:

python esptool.py --port /dev/tty<YOUR_SERIAL_INTERFACE> write_flash 0x00000 nodemcu-master-10-modules-2016-01-22-12-53-39-float.bin

Note that NodeMCU default baud rate is 9600 bps.

Uploading Lua Script

I use ESPlorer to connect and upload lua scripts to ESP8266. It's up to you to download and run it. Again, the initial baud rate is 9600. Once you upload init.lua and restart the ESP8266 WiFi module, it will use 115200 bps as specified in init.lua.

Do not change this rate, because it is the default baud rate of the EPD. Or they won't talk to each other.

Wiring Up

Power Supply

ESP8266 can only tolerate up to 3.6V, and the EPD can work with minimal voltage of 3.3V. So I used a DC-DC step down module to convert 5V from USB to 3.3V for both ESP8266 module and the EPD. It is basically one AMS1117 3.3v regulator with a few capacitors to smooth the voltage output. You can use 2x AA batteries or other means of power supply as long as you don't burn your ESP8266 module!

Serial Pins

This is intuitive - connect RX and TX on the EPD to TX and RX on the WiFi module, so one end transmits and the other end receives. The EPD and WiFi module should use the same power supply so we don't need to worry about different voltages in transmitting/receiving.

                                                            +-----------------------------------------------+
                                                            |                                               |
+-----------------------------------------------------+     |                                               |
|                                                     |     |                                               |
|                                                     |     |  +--------------------+                       |
|                                                  V+ +-----+--+                 V+ +----------+            |
|                                                     |        |   3.3V Regulator   |            5V USB     |
|                                                  V- +-----+--+                 V- +----------+            |
|                                                     |     |  +--------------------+                       |
|                                                     |     |                                               |
|                        EPD                          |     |                                               |
|                                                     |     +-------------------------+                     |
|                                                     |                               |                     |
|                                                     |           +---------------+   |                     |
|                                                  RX +-----------+TX          GND+---+                     |
|                                                     |           |    ESP8266    |                         |
|                                                  TX +-----------+RX          VCC+-------------------------+
|                                                     |           +---------------+
+-----------------------------------------------------+

Notes on File Management

The manufacture's manual isn't very clear about this. I consulted their technical support regarding how to remove the preloaded files, but the answer he gave some isn't the fact by my experiments. So here's my conclusion:

# Example: to import images
# insert SD card
> epd_set_memory_sd()
> epd_import_pic()
> epd_set_memory_nand()
# remove SD card

Error Codes

0       Invalid command
1       SD card initiation failed
2       Invalid arguments
3       SD card not inserted
4       File not found
20      Validation failed
21      Invalid frame
250     Undefined error