This is an old revision of the document!
[pczekalski]Finish it!
This scenario presents how to use the OLED display. Our OLED display is an RGB (16bit colour, 64k colours) 1.5in, 128×128 pixels. The OLED chip is SSD1351, and it is controlled over the SPI interface using the following pin configuration:
As usual, there is no need to program SPI directly; instead, it should be handled by a dedicated library. In addition to the protocol communication library and display library, we will use a graphic abstraction layer for drawing primitives such as lines, images, text, circles, and so on:
lib_deps = adafruit/Adafruit SSD1351 library@^1.2.8
Note that the graphics abstraction library (Adafruit GFX) is loaded automatically because of the
lib_ldf_mode = deep+
declaration in the platformio.ini
. You can also add it explicitly, as below:
lib_deps = adafruit/Adafruit SSD1351 library@^1.2.8 adafruit/Adafruit GFX Library@^1.11.9
To generate an array of bytes representing an image in 565 format, it is easiest to use an online tool, e.g.:
Draw a text on the OLED display and an image of your choice (small, to fit both text and image).
Perhaps you will need to use an external tool to preprocess an image to the desired size (we suggest something no bigger than 100×100 pixels) and another tool (see hint above) to convert an image to an array of bytes.
Check if you can see a full OLED Display in your video stream. Book a device and create a dummy Arduino file with void setup()…
and void loop()…
.
Prepare a small bitmap and convert it to the byte array for 16-bit colour settings.
Sample project favicon you can use is present in Figure 1:
Remember to include the source array in the code when drawing an image. The corresponding generated C array for the logo in Figure 1 is too extensive to present here in the textual form, so below it is just the first couple of pixels represented in the array, and full contents you can download here: ZIPed archive with a C file containing all pixel data of the image .
const uint16_t epd_bitmap_logo_60 [] PROGMEM = { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xf7be, 0xbdd7, 0x8430, 0x5aeb, 0x39c7, 0x2104, 0x1082, 0x0020, 0x0020, 0x1082, 0x2104, 0x39c7, 0x5aeb, 0x8430, 0xbdd7, 0xf7be, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, .... .... 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; // Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 3616) const int epd_bitmap_allArray_LEN = 1; const uint16_t* epd_bitmap_allArray[1] = { epd_bitmap_logo_60 };
Describe activities done in Step 1.
…
Describe activities done in Step n.
You should see the image and the text in the video stream.
This section is to be extended as new questions appear.
When using the printed version of this manual, please refer to the latest online version of this document to obtain the valid and up-to-date list of the FAQ.
Provide some FAQs in the following form:
Question?: Answer.
This Intellectual Output was implemented under the Erasmus+ KA2.
Project IOT-OPEN.EU Reloaded – Education-based strengthening of the European universities, companies and labour force in the global IoT market.
Project number: 2022-1-PL01-KA220-HED-000085090.
Erasmus+ Disclaimer
This project has been funded with support from the European Commission.
This publication reflects the views of only the author, and the Commission cannot be held responsible for any use that may be made of the information contained therein.
Copyright Notice
This content was created by the IOT-OPEN.EU Reloaded consortium, 2022,2024.
The content is Copyrighted and distributed under CC BY-NC Creative Commons Licence, free for Non-Commercial use.