Help with programming 4.2 inch e-Paper module

I'm trying to send some data to a 4.2 inch e-Paper module. I can't get it to work properly. I'm using the e-Paper library (GitHub - waveshare/e-Paper). I already programmed this:

#include <SPI.h>
#include <mcp_can.h>

#include "epd4in2b_V2.h"
#include "imagedata.h"
#include "epdpaint.h"

#define COLORED     0
#define UNCOLORED   1

Epd epd;

void setup() {
  // put your setup code here, to run once:
  if (epd.Init() != 0) {
    Serial.print("e-Paper init failed");

void loop() 
  Serial.print("begin loop");
  unsigned char image [1500];
  Paint paint(image, 400, 28);
  Epd epd;
  int minvolt = 147;
  String een = String(minvolt) + "milliVolts";
  char const *voltmin = een.c_str();

  int maxvolt = 245;
  String twee = String(maxvolt) + "milliVolts";
  char const *voltmax = twee.c_str();

  int gemvolt = 197;
  String drie = String(gemvolt) + "milliVolts";
  char const *voltgem = drie.c_str();
  paint.DrawStringAt(7, 0, voltmin, &Font16, COLORED);
  epd.SetPartialWindowBlack(paint.GetImage(), 0, 60, paint.GetWidth(), paint.GetHeight());

  paint.DrawStringAt(7, 0, voltmax, &Font16, COLORED);
  epd.SetPartialWindowBlack(paint.GetImage(), 0, 100, paint.GetWidth(), paint.GetHeight());

  paint.DrawStringAt(7, 0, voltgem, &Font16, COLORED);
  epd.SetPartialWindowBlack(paint.GetImage(), 0, 140, paint.GetWidth(), paint.GetHeight());



If I send this code to the Arduino Uno nothing shows up on the screen. If I send the code like this (without the milivolts) it however does work:

int gemvolt = 197;
String drie = String(gemvolt);
char const *voltgem = drie.c_str();

Anyone able to help me out?

I would guess you are running out of memory. You are creating some large arrays and an UNO does not have very much ram.... This library even calls this out.

It may be much better to switch to a STM32 based unit with more memory.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.