PlatformIO Community

Recommendation for I2C display with solid software support

I’m looking for a display to connect to a microcontroller board, e.g. ESP32-CAM, Raspberry Pi Pico or Seeeduino Xiao, for testing purposes when the board runs standalone, i.e. I can’t use the serial monitor on my PC. Text display capabilities are a must, graphics is a plus. It can be small, but having an option to choose from many different models would be a plus. The main requirement is a solid software support, MicroPython in addition to C/C++ would be nice. I2C interface is probably the most sensible, but other options, e.g. serial, would be fine since it’s present on all the boards I listed. The display doesn’t have to be very cheap, I just need one for testing and will reuse it.

1 Like

In my opinion, the most used I²C display, which hence also has the best software support and most libraries written for it, is the SSD1306 OLED I²C display.

https://github.com/adafruit/Adafruit_SSD1306 supports this display on Arduino for all boards that have Wire support (so, practically all).

SSD1306 is also one of the two displays with built-in Micropython support: micropython/ssd1306.py at master · micropython/micropython · GitHub. The other one being a far more complicated LCD.

1 Like

Is SSD1306 one of the targets for Adafruit GFX library? Would Adafruit GFX library be a good choice on high software level for simple graphics and text?

I added Adafruit SSD1306 to the project:

[env:pico]
platform = raspberrypi
board = pico
framework = arduino
monitor_speed = 115200
lib_deps = 
	mikalhart/Streaming@^1.0.0
	adafruit/Adafruit SSD1306@^2.5.4
build_unflags = -std=gnu++11
build_flags = -std=gnu++2a

Building an example with these headers:

#include <Arduino.h>
#include <Streaming.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <iostream>

I’m getting this error:

Compiling .pio/build/pico/libc44/Adafruit SSD1306/Adafruit_SSD1306.cpp.o
Compiling .pio/build/pico/FrameworkArduinoVariant/double_tap_usb_boot.cpp.o
.pio/libdeps/pico/Adafruit SSD1306/Adafruit_SSD1306.cpp:42:10: fatal error: pgmspace.h: No such file or directory

******************************************************************
* Looking for pgmspace.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:pgmspace.h"
* Web  > https://registry.platformio.org/search?q=header:pgmspace.h
*
******************************************************************

   42 | #include <pgmspace.h>
      |          ^~~~~~~~~~~~
compilation terminated.
*** [.pio/build/pico/libc44/Adafruit SSD1306/Adafruit_SSD1306.cpp.o] Error 1
In file included from /home/paul/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/rp2040/hardware_regs/include/hardware/platform_defs.h:12,
                 from /home/paul/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/rp2_common/pico_platform/include/pico/platform.h:12,
                 from /home/paul/.platformio/packages/framework-arduino-mbed/cores/arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/common/pico_base/include/pico.h:19,
                 from /home/paul/.platformio/packages/framework-arduino-mbed/variants/RASPBERRY_PI_PICO/double_tap_usb_boot.

The four options provided by PlatformIO Registry seem to be unrelated. What is the solution?

Same as per Pico `build_flags = -I pgmspace.h` Doesn't affect build - "pgmspace.h: No such file or directory" – the library is written for the Arduino-Pico core, not ArduinoCore-mbed.

Alternatively use the Arduino-Pico per https://github.com/platformio/platform-raspberrypi/pull/36.

1 Like

I’m using Raspberry Pi Pico. I can’t figure out the compiler flag needed. None of these works:

build_flags = -Iinclude/pgmspace.h
build_flags = -Iinclude/ pgmspace.h
build_flags = -Iinclude pgmspace.h

Only

build_flags = -Iinclude

is needed but the pgmspace.h file needs to be placed in the include folder of the project.

2 Likes

Thank you, it builds now.