Newby question. Posting images to ESP8266 -> Waveshare e-ink

Good day.

This is basically my first interaction with Arduino in general (not with programming though), so I'm basically still learning the environment and finding pieces of code that would work for my taste.

The project is similar to what I read here GxEPD2 ESP32 7.3" 7Color send image from server to E-Ink, - posting information screens/images to the e-ink display.

For this I have a separate project with temp and related data, hosted on a Odroid H3 device. I am using Java (as I have worked professionally with it for quite a few years) to process the data from sensors, and most likely use JavaFX to prepare the image and post it to the screen.

I have found GxEPD2 examples and even succeeded to upload a generated (by means of image2cpp project) image to the screen.

So now I'm looking for a way to actually have a dynamic image on that screen.

Must confess that I have yet to read the entirety of GxEPD2 and similar, simply because it's a bit overwhelming to get through all of this at, basically, day 3 of me first time interacting with Arduino (zero experience).

My original idea was to prepare the image on Java's side and send it as byte array. But I quickly came to a conclusion that the result of image2cpp even in terms of array size is quite different from a regular reading of the file as byte array.

Then I saw the

showBitmapFrom_HTTP_Buffered("192.168.178.31", "/", "remote_file.bmp", 1, 1, 1); // not working,

and now I'm thinking that maybe this would be a better choice.

Can someone please point me in the right direction with this? Thanks.

Hi @draakz
welcome to the arduino-forum.

There is a very basic and very important rule:

always and if I write always I mean always post the complete sketch.
Without seeing the rest of the code it will be very hard to analyse anything.

welcome to the arduino-forum.
I'm pretty sure that you agree and will follow the way how to solve your problem mimimum 200 minutes faster.
This requires to invest 20 minutes of your precious time to read how to speedup solving your problems.

Directly after registering you got presented informations how to speed up solving your problem.
You should really read it.

best regards Stefan

Hi.
Yes, you are right. Sorry about that. Will go and read it now.

For the hardware. It's a Waveshare ESP8266, coupled up with Waveshare's 7.5" V2 E-Ink display.

There's not much code at the moment.

I followed an example found here https://www.youtube.com/watch?v=CMNuMOcvpFM

With the code being

Спойлер
#define ENABLE_GxEDP2_GFX 0
#include <GxEPD2_BW.h>
#include "file.h"

// GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=15*/ 5, /*DC=4*/ 2, /*RST=2*/ 12, /*BUSY=5*/ 4)); // GDEW075T7 800x480, EK79655 (GD7965)
GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW075T7 800x480, EK79655 (GD7965)
// GxEPD2_BW < GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT / 2 > display(GxEPD2_583_T8(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0583T8 648x480, EK79655 (GD7
// GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW075T7 800x480, EK79655 (GD7965)
// GxEPD2_BW < GxEPD2_750_GDEY075T7, GxEPD2_750_GDEY075T7::HEIGHT / 2 > display(GxEPD2_750_GDEY075T7(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEY075T7 800x480, UC8179 (GD7965)

void setup() {
  Serial.println("a");
  Serial.begin(115200);
  Serial.println("b");
  display.init(115200, true, 2, false); //
  Serial.println("c");
  draw(test11123123);
  Serial.println("d");
}

void loop() {
  // put your main code here, to run repeatedly:

}

void draw(const unsigned char *img) {
  Serial.println("Starting to draw");
  display.setRotation(0);
  display.setFullWindow();
  
  display.firstPage();
  Serial.println("Drawing..");
  
  do {
    Serial.print(".");
    display.fillScreen(GxEPD_WHITE);
    display.drawInvertedBitmap(160, 0, img, 514, 480, GxEPD_BLACK);
  } while (display.nextPage());
  Serial.println("Done drawing");
}

The image is a byte array, which was generated by means of image2cpp

I do not understand what you want to say with that.

My original idea was to prepare the image on Java's side and send it as byte array

How exactly are you gonna send the byte-array?
Post the code that does that

But I quickly came to a conclusion that the result of image2cpp even in terms of array size is quite different from a regular reading of the file as byte array

Why should an array created by image2cpp have a different size than a byte-array that is read from a file?

I claim: if they have the same number of pixel the arraysize will be exact the same.
You will have to elaborate in detail why you think this will be different.

You only linked to a youtube-video
The text below the youtube-video has links to code.

I looked up one code on Github
this one

This code uses different functions
it uses

drawBitmaps(ACROBOTIC_LOGO);

where the bitmap is an array of unsigned char
and the function is handed over the pointer to this array

void drawBitmaps(const unsigned char *bitmap) {
  // Configure the display according to our preferences
  display.setRotation(0);
  display.setFullWindow();
  // Display the bitmap image
  display.firstPage();
  do {
    display.fillScreen(GxEPD_WHITE);
    display.drawInvertedBitmap(0, 0, bitmap, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  } while(display.nextPage());
}

ACROBOTIC_LOGO is defined as

const unsigned char ACROBOTIC_LOGO [] PROGMEM = {

Your code uses

showBitmapFrom_HTTP_Buffered("192.168.178.31", "/", "remote_file.bmp", 1, 1, 1); // not working,

Where did you get this from?
You will have to provide a lot of more and much more precise information if somebody shall analyse this

This one I found in a similar topic to this - GxEPD2 ESP32 7.3" 7Color send image from server to E-Ink

I haven't tried it yet, just found it when I was typing the name for this topic and got an auto-suggestion.

My original idea (before the upper mentioned topic with showBitmapFrom_HTTP_Buffered) was to use the functionality of a webserver and do something like (also from an example I found)

 server.on("/upload", HTTP_POST, [](){

and to post the image from a java app.

But, basically, with something like a

curl -i -X POST -H "Content-Type: multipart/form-data" 
-F "data=@test.img" ...

Assuming that is a possibility.

From what I've started to read (and already starting to have a headache from jumping between articles and githubs), the input image is processed, something like 4:1.

I used a BW image, which I tried reading from Java

File f = new File("f:/pl_full.png");
        byte[] bytes = Files.readAllBytes(f.toPath());

        System.out.println("3: "+bytes.length);

        for (int i = 0; i<bytes.length; i++) {
            if (i % 12 == 0) System.out.println("");
            System.out.print(String.format("%x", bytes[i]) + ", ");
        }

with addition of taking the exact same image to that resource (which is used in that video), simply copypasted it and read the array size
System.out.println("1: "+c.length);

And this is what I got:

1: 4884 (array size from image2cpp)

3: 472 (reading the bytes from the file)

At the moment of writing I saw that the file was PNG. Maybe this is the cause.

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