Simple ePaper Character Display
13th November 2026
This is a simple character display based on a Waveshare 400x300 Red/Black/White ePaper display controlled by a Raspberry Pi Pico. To minimise the amount of RAM needed by the application the program treats the display as a character terminal, with graphics characters for drawing simple diagrams and flowcharts:

The Simple ePaper Character Display, based on a Waveshare 400x300 Red/Black/White ePaper display, used for a Recipe Book application.
I designed this for a digital Recipe Book, but the project isn't limited to this, and you could use it for any application that needs low power but doesn't need fast screen updates, such as a home automation information display, weather station, news display, or network activity display.
Introduction
This project started with the idea of converting all my handwritten recipes to a simple home display device that could sit on the kitchen counter, and display a recipe on demand. The Waveshare 400x300 Red/Black/White ePaper display seemed ideal as it has a high enough resolution for this application, and the display is persistent, so the device can be portable and battery powered without problems.
To make prototyping the project easier I bought the version of the Waveshare 400x300 Red/Black/White ePaper display that allows you to plug a Raspberry Pi Pico into a carrier on the back of the display, but eventually I plan to drive it from an AVR processor. I got my display from The Pi Hut in the UK [1]. It's also available direct from Waveshare [2].
The usual way to drive ePaper displays is to allocate a RAM buffer on the processor being used to drive the display. You then perform graphics operations on the RAM buffer, which is then transferred to the display to update the displayed image.
However, a 400x300 Red/Black/White display requires a 15Kbytes buffer for each colour, making a total of 30Kbytes, which is a substantial overhead for many smaller processors. For example, the AVR DA series processors have a maximum of 16Kbytes of RAM, and so would be unable to drive such a display.
I was therefore interested in trying the different approach of having a character display of 66x33 characters based on a 6x8 pixel character set. The display buffer would then only need to be 66x33=2178 bytes. The program will convert the character definitions into pixels on the fly, as they are written to the display. This also makes it easier to design the recipe pages, as they can be written as a series of C literal strings.
Specification
Here's the specification of my prototype:
- 66 x 33 character display, with character graphics capable of displaying boxes and connecting lines.
- Black or red characters on a paper-white background, using the top bit of the characters to identify red characters.
- Double-size characters, using the same character set with smoothing, for headings.
- A full screen refresh time of 15 seconds.
- A self-contained program in a single file with no additional libraries required, apart from the Arduino core.
Recipe Book application
My original motivation for designing the ePaper Character Display was to build a digital Recipe Book.
My flowchart-style recipe design
I've developed a style for writing recipes designed to make cooking easier. I found that when following a recipe in a typical cookery book it would often say something like: Fry the garlic until brown, then add one onion, finely chopped. At this point I would be frantically chopping the onion while the garlic burned.
My solution is to write out recipes with boxes showing all the ingredients you need to prepare in advance. The boxes are linked by lines showing the procedure and timing. The ePaper Recipe Book implements this flowchart-style recipe design.
Defining a recipe
Here's the definition of the sample recipe shown at the start of the article:
uint8_t Terminal[ROWS][COLUMNS+1] = {
{ " _P_a_e_l_l_a_ _w_i_t_h_ _c_h_i_c_k_e_n_ _a_n_d_ _s_e_a_f_o_o_d " },
{ " " },
{ " Serves 2 " },
{ " " },
{ "|-----------------------------| |----------------| " },
{ "| 6 saffron threads | | | Add: " },
{ "|-----------------------------| | |-----------------------------| " },
{ " | Soak in | | 250g tomatoes skinned and | " },
{ " | boiling water. | | chopped | " },
{ "|-----------------------------| | | 1/2 tsp paprika | " }, // 10
{ "| 4 tbsp olive oil | | | 450ml water | " },
{ "| 1/2 chicken in pieces | | |-----------------------------| " },
{ "|-----------------------------| | | Boil 5 mins. " },
{ " | Fry until | | Simmer 10 mins " },
{ " | browned. | | covered. " },
{ " | Add: | | Add: " },
{ "|-----------------------------| | |-----------------------------| " },
{ "| 60g chorizo slices | | | 60g peas | " },
{ "| 1/2 red pepper sliced | | | Prawns (if raw) | " },
{ "| 1/2 green pepper sliced | | |-----------------------------| " }, // 20
{ "|-----------------------------| | | Simmer 10 mins " },
{ " | Fry until | | covered. " },
{ " | caramelised. | | Season. " },
{ " | Add: | | Add: " },
{ "|-----------------------------| | |-----------------------------| " },
{ "| 2 squid rings | | | Prawns (if cooked) | " },
{ "| 160g Bomba or paella rice. | | |-----------------------------| " },
{ "|-----------------------------| | | Cover with " },
{ " | Fry until | | cloth. " },
{ " | transparent. | | Leave 10 mins. " }, // 30
{ " ------------------ | Serve! " },
{ " --- " },
{ " " }, // 33
};
To make it easy to edit a recipe in the Arduino IDE the boxes and lines are drawn with '-' and '|' characters, and the double-size characters in the heading are defined with '_' characters. These are automatically converted to the correct characters by the program.
I've included several sample recipes with the program which can be read from flash memory to illustrate the Recipe Book.
The program
The program is based on the contributed Arduino example epd4in2b_V2 on GitHub [3]. The example is designed to cater for both old V1 displays and the current V2 displays; for simplicity I've removed the legacy code, so you need a V2 display to use my program.
Updating the display
After initialising the display the procedure to update the display is effectively to send 300 rows of 50 bytes, where 50x8 bits gives the horizontal pixel resolution of 400:
void loop() {
for (int i = 0; i < 2; i++) {
int command = (i == 0) ? 0x24 : 0x26;
SendCommand(command);
for (int y=0; y<300; y++) {
for (int h=0; h<50; h++) {
uint8_t byte = Picture(i, h, y);
SendData(byte);
}
}
}
DisplayFrame();
delay(1000);
Sleep();
}
where the command 0x24 selects the black image plane, and 0x26 selects the red image plane. The function Picture(colour, h, y) returns the next row of 8 pixels in row y in the appropriate colour i.
The final Sleep() command turns off power to the display, to minimise wear to it.
Character terminal
My display driver uses a character display defined by the array Terminal[row][column]. With a character set using 6x8 pixel characters, and a leading of 9 pixels, there are 300/9 or 33 rows, and 400/6 or 66 columns.
So the definition of Picture(colour, h, y) could be written something like this for one of the colour planes:
uint8_t Picture (uint8_t i, int h, int y) {
uint8_t byte = 0;
for (int bit=0; bit<8; bit++) {
int x = h*8 + bit;
uint8_t row = y/LEADING;
uint8_t col = x/CHARWIDTH;
uint8_t c = Terminal[row][col];
uint8_t pixel = (CharMap[(c & 0x7f)-CHAR0][x%CHARWIDTH] >> (y%LEADING)) & 1;
byte = (byte<<1) | pixel;
}
return byte;
}
For each pixel in a row of 8 pixels the program looks up the character in Terminal[row][column], looks up the corresponding pixel in CharMap[character][col], and then shifts that pixel into byte.
Red characters
The program allows you to display any character in red by setting its top bit. This is implemented by the Red macro:
#define RED 0x80 #define Red(c) ((c) | RED)
Double-size characters
The program allows you to display text in double-sized characters, produced by doubling the existing character definitions to 12x16.
To write text in double-size characters prefix each character with a '_' underscore character, and leave spaces on the next line to make room for the bottom half of each double-size character. For example:
{ " _S_p_a_g_h_e_t_t_i_ _w_i_t_h_ _p_a_n_c_e_t_t_a_ _a_n_d_ _p_e_a_s" },
{ " " },
The double-size characters should start in an even row; otherwise the characters will not display correctly.
Here's the code that performs the doubling:
bool line1 = c == '_';
bool line2 = row>0 && Terminal[row-1][col] == '_';
bool line2a = row>0 && col>0 && Terminal[row-1][col-1] == '_';
uint8_t parity = 0;
if (line1 || line2 || big > 0) {
if (line1) {
c = Terminal[row][col+1];
big = CHARWIDTH;
parity = (x/6) % 2;
} else if (line2) {
c = Terminal[row-1][col+1];
big = CHARWIDTH;
parity = (x/6) % 2;
} else if (big > 0) {
if (line2a) c = Terminal[row-1][col];
big--;
parity = (x/6 + 1) % 2;
}
c = Red(c);
pixel = Pixel2(c, x, y, parity);
}
where Pixel2(c, x, y, parity) returns the pixel at (x , y) for character c in a double-size character:
uint8_t Pixel2 (uint8_t c, int x, int y, uint8_t parity) {
return (CharMap[(c & 0x7f)-CHAR0][((x+6*parity)%(CHARWIDTH*2))/2]
>> ((y%(LEADING*2))/2)) & 1;
}
The variable parity is 0 if the double-size text starts on an even column and 1 if it starts on an odd column.
Currently the program automatically displays double-size text in red.
Smoothing double-sized characters
To make the double-sized characters look as smooth as a custom 12x16 character set, the routine incorporates automatic smoothing as described in my earlier article Smooth Big Text.
The smoothing works by checking whether one of the following two situations A or B occur anywhere in the double-resolution character:

If they do, two extra pixels are added as shown in the second diagrams.
Here's the code to add the smoothing:
if (pixel == 0) {
uint8_t xp = (x % (CHARWIDTH*2)) & 1;
uint8_t yp = (y % (LEADING*2)) & 1;
int8_t dx = xp ? 1 : -1;
int8_t dy = yp ? 1 : -1;
if (Pixel2(c, x + dx, y, parity) == 1 && Pixel2(c, x, y + dy, parity) == 1
&& Pixel2(c, x + dx, y + dy, parity) == 0) pixel = 1;
}
Graphics boxes
The program includes graphics characters to allow you to draw boxes, and horizontal or vertical connecting lines, for use in diagrams, flowcharts, and information displays.
To make drawing a diagram easier you can draw the boxes and connecting lines using '|' and '-' characters, and the program converts these into the appropriate box and line graphics characters. I used this to draw the recipes for my Recipe Book application.
Here's the code that does the conversion:
if (c == '|' || c == '-') {
bool left = col>0 && Terminal[row][col-1] == '-';
bool right = Terminal[row][col+1] == '-';
bool above = row>0 & Terminal[row-1][col] == '|';
bool below = Terminal[row+1][col] == '|';
if (c == '|') {
if (right && left && above && below) c = Red(CROSS);
else if (right) c = (above && below) ? Red(TEERIGHT)
: above ? Red(BOTTOMLEFT) : Red(TOPLEFT);
else if (left) c = (above && below) ? Red(TEELEFT)
: above ? Red(BOTTOMRIGHT) : Red(TOPRIGHT);
else c = Red(VERTICAL);
} else {
if (right && left && above && below) c = Red(CROSS);
else if (above) c = (right && left) ? Red(TEEINVERTED)
: right ? Red(BOTTOMLEFT) : Red(BOTTOMRIGHT);
else if (below) c = (right && left) ? Red(TEE)
: right ? Red(TOPLEFT) : Red(TOPRIGHT);
else if (right || left) c = Red(HORIZONTAL); // Don't translate a single '-'
}
}
It allows you to use either '|' or '-' for the corners of boxes, and it knows not to convert a '-' used on its own, such as to hyphenate a word. Also, I've made the boxes and lines displayed in red, but obviously that's optional.
Also, because the graphics characters are 6x8 and the leading is 9, there would be a gap between successive vertical graphics characters. The following code fills in the gaps to make the lines continuous:
if ((c == Red(VERTICAL) || c == Red(TOPLEFT) || c == Red(TOPRIGHT) || c == Red(TEE) || c == Red(TEELEFT) || c == Red(TEERIGHT) || c == Red(CROSS)) && y%LEADING > 7 && (x%CHARWIDTH == 2 || x%CHARWIDTH == 3)) pixel = 1;
Here's another example showing the use of the graphics characters:

Another sample recipe from the recipe Book application, based on a
Waveshare 400x300 Red/Black/White ePaper display.
Running the program
Install the Raspberry Pi Pico/RP2040 core
- Add the following URL to the Additional Boards Manager URLs list in the Arduino IDE Preferences dialog box:
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
- In the Arduino IDE search for the Raspberry Pi RP2040 core in Boards Manager and install it.
I tested this with core version 5.0.0 which uses the new certified 200 Mhz clock.
- Select Raspberry Pi RP2040 from the Board menu, and Raspberry Pi Pico from the submenu.
You can leave all the other options at their defaults.
- Mount the Raspberry Pi Pico to the back of the Waveshare ePaper display, and connect the USB port to the computer.
- Select the Raspberry Pi Pico board from the Port menu.
- Click Upload to upload the program.
You should then see the demo recipe display appear after the 15s refresh time.
Resources
Here's the full program of the ePaper Character Display: Simple ePaper Character Display Program.
Three sample recipes: Recipe Book Examples.
Also see the Datasheet for the ePaper 4.2 B (V2) display on Waveshare.com.
Further suggestions
- My next objective is to provide a menu of recipes, to allow you to step with the two buttons provided on the Waveshare board, using faster partial updating to highlight each recipe in turn and select one.
- Eventually I plan to write a program that takes the recipe description in a structured text format, and then automatically converts it to an appropriate character representation for the display.
- It should be relatively simple to modify this program to work with the Waveshare ePaper 4.2 400x300 4-greyscale display [4]. Although this doesn't provide red text or graphics, it does have a faster 5s refresh rate.
- ^ 4.2" ePaper Display Module for Raspberry Pi Pico - Red/Black/White (400x300) on The Pi Hut.
- ^ 4.2" ePaper Display Module for Raspberry Pi Pico - Red/Black/White (400x300) on Waveshare.com.
- ^ epd4in2b_V2 on the GitHub waveshareteam e-Paper repository.
- ^ 4.2" ePaper Display Module for Raspberry Pi Pico - 4 greyscale (400x300) on Waveshare.com.
blog comments powered by Disqus
