E-ink display+ ESP32

Všetko čo sa týka mikropočítačov + Sekcia Arduino

Moderátori: psichac, Moderátori

Tommyk
Stály člen
Stály člen
Príspevky: 174
Dátum registrácie: 26 Jan 2011, 00:00
Bydlisko: Troubky
Vek: 30
Kontaktovať používateľa:

E-ink display+ ESP32

Príspevok od používateľa Tommyk » 29 Nov 2023, 16:13

Ahoj,

nemáte někdo zkušenosti s tímto displejem? Rád bych ho provozoval na ESP32.
https://www.buydisplay.com/red-4-2-inc ... spberry-pi

Už nějakou dobu si na něm lámu zuby. Vyzkoušel jsem několik různých knihoven, různých zapojení s ESP32 a nemůžu ho rozchodit.
Fungoval mi pouze na Arduino Mega s nějakým vzorovým kódem tuším, že byl z webu výrobce.

Díky za rady a tipy :)
0
Když nepomůže hrubá síla, pomůže ještě hrubší.

Používateľov profilový obrázok
jirka.jirka.
Ultimate člen
Ultimate člen
Príspevky: 1538
Dátum registrácie: 17 Okt 2008, 00:00
Bydlisko: Uherské Hradiště
Kontaktovať používateľa:

Re: E-ink display+ ESP32

Príspevok od používateľa jirka.jirka. » 29 Nov 2023, 16:53

Fungoval mi pouze na Arduino Mega s nějakým vzorovým kódem tuším, že byl z webu výrobce.
Funkční je. To sis ověřil.

No tak teď to chce otevřít datasheet a napsat si vlastní driver. Inspirace z funkční knihovny by byla, takže nemusíš vařit z vody. :thumbup: Na ty no name knihovny se zrovna vy*er. Protože většinu času pak budeš řešit, že to má někde nacpaný nějaký delay, že ti to nejede jak chceš. Když si to napíšeš sám, pochopíš samotný display a dokonce i tu sběrnici, co mezi mcu a displejem je.

EDIT: Super na tom máš, že stáhneš tu knihovnu s kterou ti to chodilo a začneš postupně kopírovat a zkoumat ten kód. Optimalizovat pěkně pro tvé řešení. :thumbup: A když se na něčem zastavíš, tak se zde najde nějaký arduinista nebo zkušený programátor, který tě navede. :agree:
0

Tommyk
Stály člen
Stály člen
Príspevky: 174
Dátum registrácie: 26 Jan 2011, 00:00
Bydlisko: Troubky
Vek: 30
Kontaktovať používateľa:

Re: E-ink display+ ESP32

Príspevok od používateľa Tommyk » 29 Nov 2023, 17:29

čoveče, nevím jestli jsem tak dobrej, abych tohle zvládl :D
0
Když nepomůže hrubá síla, pomůže ještě hrubší.

Používateľov profilový obrázok
jirka.jirka.
Ultimate člen
Ultimate člen
Príspevky: 1538
Dátum registrácie: 17 Okt 2008, 00:00
Bydlisko: Uherské Hradiště
Kontaktovať používateľa:

Re: E-ink display+ ESP32

Príspevok od používateľa jirka.jirka. » 29 Nov 2023, 17:32

čoveče, nevím jestli jsem tak dobrej, abych tohle zvládl :D
Když to nezkusíš, tak jak to chceš zjistit? 8O
Ale ok, no problema. Za 1000Kč na hodinu ti to udělám. Je to ta správná motivace? :biggrin:
0

Tommyk
Stály člen
Stály člen
Príspevky: 174
Dátum registrácie: 26 Jan 2011, 00:00
Bydlisko: Troubky
Vek: 30
Kontaktovať používateľa:

Re: E-ink display+ ESP32

Príspevok od používateľa Tommyk » 29 Nov 2023, 17:36

Ale ok, no problema. Za 1000Kč na hodinu ti to udělám. Je to ta správná motivace? :biggrin:
Nebuď blázen, řekni si aspoň o dva :D :D
1
Obrázok 1
Když nepomůže hrubá síla, pomůže ještě hrubší.

epto
Stály člen
Stály člen
Príspevky: 151
Dátum registrácie: 09 Nov 2012, 16:23
Bydlisko: Seňa

Re: E-ink display+ ESP32

Príspevok od používateľa epto » 04 Dec 2023, 09:16

Ta kniznica od vyrobcu je vsetko co potrebujes.
Dokazom je, ze na Arduino MEGA to funguje.
Na obycajnom UNO to nerozchodis, bude malo pamate (RAM) pre buffer.
ESP s tym nebude mat problem. Pozor trba dat na spravnu inicializaciu SPI zbernice a spravne pripojenie pinov, tie s vyssim cislom su iba vstupne.
Doporucujem pozriet ako je pripojeny hocijaky obycajny TFT display cez SPI a pouzit rovnake piny pre riadiace signaly.

Este skus pozriet kniznicu GxEPD
https://github.com/ZinggJM/GxEPD

v zozname podporovanych displejov je aj jeden 4.2" b/w/r
popripade kontaktuj autora kniznice so ziadostou o podporu tvojho dospleja. Mam vsat taky pocit, ze to bude fungovat.
0

Tommyk
Stály člen
Stály člen
Príspevky: 174
Dátum registrácie: 26 Jan 2011, 00:00
Bydlisko: Troubky
Vek: 30
Kontaktovať používateľa:

Re: E-ink display+ ESP32

Príspevok od používateľa Tommyk » 11 Dec 2023, 16:13

Zkusil jsem tu knihovnu GxEPD. A tento vzorový kod, tento řádek jsem odkomentoval, abych vybral typ displeje.

Kód: Vybrať všetko

#include <GxGDEW042Z15/GxGDEW042Z15.h>    // 4.2" b/w/r
Zapojení:

ESP32 ---- Display

3V3 ----- VDD
GND ----- VSS
D23 ----- SDA
D18 ----- SCL
D5 ----- /CS
TX2 ----- D/C
RX2 ----- /RST
D4 ----- BUSY

Po nahrátí se na displeji nic neděje. A konzole vyhodí tohle:

Kód: Vybrať všetko

setup
Busy Timeout!
Power On : 20000922
update : 1
Power Off : 1
Power Off : 1
setup done

Kód: Vybrať všetko



// mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board
// NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD
// BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V

// include library, include base class, make path known
#include <GxEPD.h>

// select the display class to use, only one
//#include <GxDEPG0150BN/GxDEPG0150BN.h>    // 1.50" b/w
//#include <GxGDEP015OC1/GxGDEP015OC1.h>    // 1.54" b/w
//#include <GxGDEH0154D67/GxGDEH0154D67.h>  // 1.54" b/w 200x200, SSD1681
//#include <GxGDEW0154T8/GxGDEW0154T8.h>    // 1.54" b/w 152x152 UC8151 (IL0373)
//#include <GxGDEW0154M09/GxGDEW0154M09.h>  // 1.54" b/w 200x200 JD79653A
//#include <GxGDEW0154M10/GxGDEW0154M10.h>  // 1.54" b/w 152x152 UC8151D
//#include <GxGDEW0154Z04/GxGDEW0154Z04.h>  // 1.54" b/w/r 200x200
//#include <GxGDEW0154Z17/GxGDEW0154Z17.h>  // 1.54" b/w/r 152x152
//#include <GxGDEH0154Z90/GxGDEH0154Z90.h>  // 1.54" b/w/r 200x200 SSD1681
//#include <GxGDEW0213I5F/GxGDEW0213I5F.h>  // 2.13" b/w 104x212 flexible
//#include <GxGDE0213B1/GxGDE0213B1.h>      // 2.13" b/w
//#include <GxGDEH0213B72/GxGDEH0213B72.h>  // 2.13" b/w new panel
//#include <GxGDEH0213B73/GxGDEH0213B73.h>  // 2.13" b/w newer panel
//#include <GxGDEM0213B74/GxGDEM0213B74.h>  // 2.13" b/w 128x250 SSD1680
//#include <GxGDEW0213Z16/GxGDEW0213Z16.h>  // 2.13" b/w/r
//#include <GxGDEH0213Z19/GxGDEH0213Z19.h>  // 2.13" b/w/r UC8151D
//#include <GxGDEW0213T5D/GxGDEW0213T5D.h>  // 2.13" b/w 104x212 UC8151D
//#include <GxDEPG0213BN/GxDEPG0213BN.h>    // 2.13" b/w 128x250, SSD1680, TTGO T5 V2.4.1, V2.3.1
//#include <GxGDEH029A1/GxGDEH029A1.h>      // 2.9" b/w
//#include <GxGDEW029T5/GxGDEW029T5.h>      // 2.9" b/w UC8151 (IL0373)
//#include <GxGDEW029T5D/GxGDEW029T5D.h>    // 2.9" b/w UC8151D
//#include <GxGDEM029T94/GxGDEM029T94.h>    // 2.9" b/w
//#include <GxDEPG0290BS/GxDEPG0290BS.h>    // 2.9" b/w Waveshare variant, TTGO T5 V2.4.1 2.9"
//#include <GxGDEW029Z10/GxGDEW029Z10.h>    // 2.9" b/w/r
//#include <GxGDEH029Z13/GxGDEH029Z13.h>    // 2.9" b/w/r UC8151D
//#include <GxGDEW026T0/GxGDEW026T0.h>      // 2.6" b/w
//#include <GxDEPG0266BN/GxDEPG0266BN.h>      // 2.66" b/w 152x296, SSD1680, TTGO T5 V2.66, TTGO T5 V2.4.1
//#include <GxGDEW027C44/GxGDEW027C44.h>    // 2.7" b/w/r
//#include <GxGDEW027W3/GxGDEW027W3.h>      // 2.7" b/w
//#include <GxGDEY027T91/GxGDEY027T91.h>    // 2.7" b/w
//#include <GxGDEW0371W7/GxGDEW0371W7.h>    // 3.7" b/w
//#include <GxGDEW042T2/GxGDEW042T2.h>      // 4.2" b/w
#include <GxGDEW042Z15/GxGDEW042Z15.h>    // 4.2" b/w/r
//#include <GxGDEW0583T7/GxGDEW0583T7.h>    // 5.83" b/w
//#include <GxGDEW075T8/GxGDEW075T8.h>      // 7.5" b/w
//#include <GxGDEW075T7/GxGDEW075T7.h>      // 7.5" b/w 800x480
//#include <GxGDEW075Z09/GxGDEW075Z09.h>    // 7.5" b/w/r
//#include <GxGDEW075Z08/GxGDEW075Z08.h>    // 7.5" b/w/r 800x480

#include GxEPD_BitmapExamples

// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>


#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>

#if defined(ESP8266)

// for SPI pin definitions see e.g.:
// C:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\variants\generic\common.h

GxIO_Class io(SPI, /*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io, /*RST=D4*/ 2, /*BUSY=D2*/ 4); // default selection of D4(=2), D2(=4)
// Heltec E-Paper 1.54" b/w without RST, BUSY
//GxEPD_Class display(io, /*RST=D4*/ -1, /*BUSY=D2*/ -1); // no RST, no BUSY
// Waveshare e-Paper ESP8266 Driver Board
//GxIO_Class io(SPI, 15, 4, 5);
//GxEPD_Class display(io, 5, 16);

#elif defined(ESP32)

// for SPI pin definitions see e.g.:
// C:\Users\xxx\Documents\Arduino\hardware\espressif\esp32\variants\lolin32\pins_arduino.h

GxIO_Class io(SPI, /*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16); // arbitrary selection of 17, 16
GxEPD_Class display(io, /*RST=*/ 16, /*BUSY=*/ 4); // arbitrary selection of (16), 4
// for LILYGO® TTGO T5 2.66 board uncomment next two lines instead of previous two lines
//GxIO_Class io(SPI, /*CS=5*/ SS, /*DC=*/ 19, /*RST=*/ 4); // LILYGO® TTGO T5 2.66
//GxEPD_Class display(io, /*RST=*/ 4, /*BUSY=*/ 34); // LILYGO® TTGO T5 2.66

#elif defined(ARDUINO_ARCH_SAMD)

// for SPI pin definitions see e.g.:
// C:\Users\xxx\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\variants\mkr1000\variant.h
// C:\Users\xxx\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.19\variants\mkrzero\variant.h

GxIO_Class io(SPI, /*CS=*/ 4, /*DC=*/ 7, /*RST=*/ 6);
GxEPD_Class display(io, /*RST=*/ 6, /*BUSY=*/ 5);

#elif defined(ARDUINO_GENERIC_STM32F103C) && defined(MCU_STM32F103C8)

// STM32 Boards(STM32duino.com) Generic STM32F103C series STM32F103C8
// for SPI pin definitions see e.g.:
// C:\Users\xxx\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c\variant.h
// C:\Users\xxx\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c\board\board.h

// new mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill"
// BUSY -> A1, RST -> A2, DC -> A3, CS-> A4, CLK -> A5, DIN -> A7

GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 3, /*RST=*/ 2);
GxEPD_Class display(io, /*RST=*/ 2, /*BUSY=*/ 1);

#elif defined(ARDUINO_GENERIC_STM32F103V) && defined(MCU_STM32F103VB)

// STM32 Boards(STM32duino.com) Generic STM32F103V series STM32F103VB
// for SPI pin definitions see e.g.:
// C:\Users\xxx\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103vb\variant.h
// C:\Users\xxx\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103vb\board\board.h

// Good Display DESPI-M01
// note: needs jumper wires from SS=PA4->CS, SCK=PA5->SCK, MOSI=PA7->SDI

GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ PE15, /*RST=*/ PE14); // DC, RST as wired by DESPI-M01
GxEPD_Class display(io, /*RST=*/ PE14, /*BUSY=*/ PE13); // RST, BUSY as wired by DESPI-M01

#elif defined(ARDUINO_AVR_MEGA2560)

// for SPI pin definitions see e.g.:
// C:\Users\xxx\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega\pins_arduino.h

// select one, depending on your CS connection
GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 8, /*RST=*/ 9); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
//GxIO_Class io(SPI, /*CS=*/ 10, /*DC=*/ 8, /*RST=*/ 9); // arbitrary selection of 8, 9, CS on 10 (for CS same as on UNO, for SPI on ICSP use)

GxEPD_Class display(io, /*RST=*/ 9, /*BUSY=*/ 7); // default selection of (9), 7

#else

// for SPI pin definitions see e.g.:
// C:\Users\xxx\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\standard\pins_arduino.h

GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 8, /*RST=*/ 9); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
GxEPD_Class display(io, /*RST=*/ 9, /*BUSY=*/ 7); // default selection of (9), 7

#endif


void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");

  display.init(115200); // enable diagnostic output on Serial

#if defined(__AVR) || false
  display.drawPaged(drawHelloWorld);
#elif (defined(_GxGDEW075Z09_H_) || defined(_GxGDEW075Z08_H_)) && (defined(ESP8266) || defined(ARDUINO_ARCH_STM32F1))
  display.drawPaged(drawHelloWorld);
#elif defined(_GxGDEW075Z09_H_)
  display.drawPaged(drawHelloWorld);
#else
  drawHelloWorld();
  display.update();
#endif
  display.powerDown();

  Serial.println("setup done");
}

void loop() {};

const char HelloWorld[] = "Hello World!";

void drawHelloWorld()
{
  //Serial.println("drawHelloWorld");
  display.setRotation(1);
  display.setFont(&FreeMonoBold9pt7b);
  display.setTextColor(GxEPD_BLACK);
  int16_t tbx, tby; uint16_t tbw, tbh;
  display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  // center bounding box by transposition of origin:
  uint16_t x = ((display.width() - tbw) / 2) - tbx;
  uint16_t y = ((display.height() - tbh) / 2) - tby;
  display.fillScreen(GxEPD_WHITE);
  display.setCursor(x, y);
  display.print(HelloWorld);
  //Serial.println("drawHelloWorld done");
}

void drawHelloWorldForDummies()
{
  // This example function/method can be used with full buffered graphics AND/OR paged drawing graphics
  // for paged drawing it is to be used as callback function
  // it will be executed once or multiple times, as many as needed,
  // in case of full buffer it can be called directly, or as callback
  // IMPORTANT: each iteration needs to draw the same, to avoid strange effects
  // use a copy of values that might change, don't read e.g. from analog or pins in the loop!
  //Serial.println("drawHelloWorldForDummies");
  const char text[] = "Hello World!";
  // most e-papers have width < height (portrait) as native orientation, especially the small ones
  // in GxEPD rotation 0 is used for native orientation (most TFT libraries use 0 fix for portrait orientation)
  // set rotation to 1 (rotate right 90 degrees) to have enough space on small displays (landscape)
  display.setRotation(1);
  // select a suitable font in Adafruit_GFX
  display.setFont(&FreeMonoBold9pt7b);
  // on e-papers black on white is more pleasant to read
  display.setTextColor(GxEPD_BLACK);
  // Adafruit_GFX has a handy method getTextBounds() to determine the boundary box for a text for the actual font
  int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
  display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
  // center bounding box by transposition of origin:
  uint16_t x = ((display.width() - tbw) / 2) - tbx;
  uint16_t y = ((display.height() - tbh) / 2) - tby;
  display.fillScreen(GxEPD_WHITE); // set the background to white (fill the buffer with value for white)
  display.setCursor(x, y); // set the postition to start printing text
  display.print(text); // print some text
  //Serial.println("drawHelloWorldForDummies done");
}
0
Když nepomůže hrubá síla, pomůže ještě hrubší.

epto
Stály člen
Stály člen
Príspevky: 151
Dátum registrácie: 09 Nov 2012, 16:23
Bydlisko: Seňa

Re: E-ink display+ ESP32

Príspevok od používateľa epto » 12 Dec 2023, 09:58

V prvom rade si zmen zapojenie pinov
ESP32 ---- Display

3V3 ----- VDD
GND ----- VSS
D23 ----- SDA
D18 ----- SCL
D5 ----- /CS
TX2 ----- D/C
RX2 ----- /RST
D4 ----- BUSY

aby korespondovalo s definiciou SPI ked sa inicializuje:
GxIO_Class io(SPI, /*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io, /*RST=D4*/ 2, /*BUSY=D2*/ 4); // default selection of D4(=2), D2(=4)

urcite nepouzivat Tx2 a Rx2 pre display. a pozri si v datasheete na ktore pinu je vyvedene SPI (MISO, MOSI, CLK)
standartne pinu pre SPI su:

VSPI MOSI 23, MISO 19, SCLK 18, CS 5
HSPI MOSI 13, MISO 12, SCLK 14, CS 15

teraz neviem, ktoru SPI zbernicu kniznica pouziva ale skus obidve riesenie.Zvysne riadiace signaly zapojit a nastavit v kode rovnako.
Display ti evidentne nekomunikuje.
0

joliekeva
Okoloidúci
Okoloidúci
Príspevky: 1
Dátum registrácie: 12 Jan 2024, 04:29

Re: E-ink display+ ESP32

Príspevok od používateľa joliekeva » 12 Jan 2024, 04:34

jirka.jirka. napísal:
29 Nov 2023, 16:53
Fungoval mi pouze na Arduino Mega s nějakým vzorovým kódem tuším, že byl z webu výrobce.
Funkční je. To sis ověřil watermelon game

No tak teď to chce otevřít datasheet a napsat si vlastní driver. Inspirace z funkční knihovny by byla, takže nemusíš vařit z vody. :thumbup: Na ty no name knihovny se zrovna vy*er. Protože většinu času pak budeš řešit, že to má někde nacpaný nějaký delay, že ti to nejede jak chceš. Když si to napíšeš sám, pochopíš samotný display a dokonce i tu sběrnici, co mezi mcu a displejem je.

EDIT: Super na tom máš, že stáhneš tu knihovnu s kterou ti to chodilo a začneš postupně kopírovat a zkoumat ten kód. Optimalizovat pěkně pro tvé řešení. :thumbup: A když se na něčem zastavíš, tak se zde najde nějaký arduinista nebo zkušený programátor, který tě navede. :agree:
Ďakujem. Vyskúšam to a dám vedieť výsledok
0

Napísať odpoveď
  • Podobné témy
    Odpovedí
    Zobrazení
    Posledný príspevok