plouc68000
Published © GPL3+

4.3" e-paper picture frame, working with latest IDE

There a several projects of this picture frame around, 5-6 years old, no-one working with recent IDE. Here with correct wiring and code !

IntermediateProtip4 hours295
4.3" e-paper picture frame, working with latest IDE

Things used in this project

Hardware components

Arduino Pro Mini 328 - 5V/16MHz
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
PTS 645 Series Switch
C&K Switches PTS 645 Series Switch
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 100k ohm
Resistor 100k ohm
×1
waveshare 4.3 inch e-Paper UART Module
×1
Battery Holder, AA x 3
Battery Holder, AA x 3
×1
AA Batteries
AA Batteries
×1
Flash Memory Card, SD Card
Flash Memory Card, SD Card
×1

Story

Read more

Custom parts and enclosures

BMP converter to Gray4 2BPP

Image for SD card I1.BMP

Image for SD card I2.BMP

EPD Lib

Wiring

Schematics

Schematics

Code

Code for Pro Mini 5V or UNO

C/C++
Upload code with IDE 1.8 or above
// revised code 02/04/2024 by plouc68000@gmail.com

// add Pro Mini Hardware Reset via pin 7 after last picture
// remove RST to pin 7 connection for upload

// use epd Lib from https://github.com/sabas1080/LibraryEPD 
// because this one makes wake_up and reset redefinable, other Libs use fixed pin 2,3
// this is needed because wakeup interrupt pin MUST be 2 or 3

// correct also attachinterrupt with new syntax

// pins 5 and 6, wake_up and reset must be wired to e-Paper display !!!!!


#include "LowPower.h"

#include "epd.h"

const int res = 7; 

const int wake_up = 6; 

const int reset = 5; 

const int lcd_on = 4;

const int button = 3;

int refreshRate = 2; // 16 seconds for testing, replace by 10800 for 24h  
//10800; //time between loading images. number you enter * 8 = seconds between refresh (10800 = 24h)

int counter = 1;

int refreshCounter = 0;

int ByteReceived;

bool errorFlag = false;

bool picSend = false;

bool picLoaded = false;

bool buttonP() {

  if (digitalRead(button) == HIGH) {

    delay(500);

    return true;

  } else {

    return false;

  }

}

void setup(void)

{

  pinMode(lcd_on, OUTPUT);

  pinMode(13, OUTPUT);

  digitalWrite(7, HIGH);
  pinMode(7, OUTPUT);

  pinMode (buttonP, INPUT);

  digitalWrite(13, LOW);

  //attachInterrupt(1, buttonPr, RISING);// old syntax
  attachInterrupt(digitalPinToInterrupt(button), buttonPr, RISING);// JLG
}

void loop(void) {

  DrawPic();

  counter++;

}

void buttonPr() {

  refreshCounter = refreshRate;

  wakeUp();

}

void wakeUp() {

  refreshCounter++;

  if (refreshCounter < refreshRate ) enterSleep();

}

void DrawPic() {

  digitalWrite(13, LOW);

  //delay(2000);

  digitalWrite(lcd_on, HIGH);

  delay(300);

  epd_init(wake_up,reset); 

  epd_wakeup(wake_up);

  epd_set_memory(MEM_TF);

  epd_clear();

  digitalWrite(13, HIGH);

  //int index = 7;

  String indexStr = String(counter);

  String str = 'I' + indexStr + ".BMP ";

  char character[str.length()] ;

  str.toCharArray(character, str.length());

  epd_disp_bitmap(character, 0, 0);

  epd_udpate();

  epd_enter_stopmode();

  while (1) {

    ByteReceived = Serial.read();

    if (ByteReceived == 13) {

      picSend = true;

    }

    if (ByteReceived == 69) {

      errorFlag = true;

      //if(!picSend && counter == 1) noSDcard();

      //if(picSend && counter == 1) noPic();

      //if(picSend  && counter != 1) noPic();

//      resetFunc();

  epd_clear();

      counter = 0;

      Serial.flush();

      digitalWrite(7, LOW); // Hard Reset

      break;

    }

    if (ByteReceived == 75 && picSend && picLoaded) {
      
      break;

    }

    if (ByteReceived == 75 && picSend) {

      picLoaded = true;

    }

  }

  //if(!picLoaded  && counter != 1) noPic();

  digitalWrite(13, LOW);

  digitalWrite(lcd_on, LOW);

  picLoaded = false;

  errorFlag = false;

  picSend = false;

  refreshCounter = 0;

  enterSleep();

}

void enterSleep() {

  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

  wakeUp();

}

Credits

plouc68000

plouc68000

9 projects • 121 followers

Comments