Adding SSD1306 OLED to ESP32_rtl433

A couple of days ago I deployed my first OMG device with ESP32 + CC1101 running esp32dev-rtl_433. Since I got an SSD1306 OLED in my parts bin, I was wondering if it would be possible to connect that to the system to display the messages that are also shown in the WebUI?
Since there are already devices with the same display, this should be fairly easy. Still, some pointers would be appreciated.

To answer myself:

  • Connect the SSD1306 to the ESP32 (display → ESP32):
    • VCC → 5V (or 3.3V, but on my board the 5V was more stabile)
    • GND → GND
    • SCL → pin 22
    • SDA → pin 21
  • Create a new environment into environments.ini:
[env:esp32dev-rtl_433-oled]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
  ${com-esp32.lib_deps}
  ${libraries.rtl_433_ESP}
  ${libraries.smartrc-cc1101-driver-lib}
  ${libraries.ssd1306}
build_flags =
  ${com-esp32.build_flags}
; *** OpenMQTTGateway Config ***
  ;'-UZmqttDiscovery'          ; disables MQTT Discovery
  '-DvalueAsATopic=true'       ; MQTT topic includes model and device
  '-DLOG_LEVEL=LOG_LEVEL_TRACE'
  '-DGateway_Name="OMG_rtl_433_ESP"'
; *** OpenMQTTGateway Modules ***
  '-DZgatewayRTL_433="rtl_433"'
  '-DZradioCC1101="CC1101"'
; *** rtl_433_ESP Options ***
;  '-DRTL_DEBUG=4'             ; rtl_433 verbose mode
;  '-DRTL_VERBOSE=58'          ; LaCrosse TX141-Bv2, TX141TH-Bv2, TX141-Bv3, TX141W, TX145wsdth sensor
;  '-DRAW_SIGNAL_DEBUG=true'   ; display raw received messages
;  '-DMEMORY_DEBUG=true'       ; display memory usage information
  '-DDEMOD_DEBUG=false'         ; display signal debug info
;  '-DMY_DEVICES=true'         ; subset of devices
  '-DPUBLISH_UNPARSED=false'    ; publish unparsed signal details
;  '-DRSSI_THRESHOLD=12'       ; Apply a delta of 12 to average RSSI level
;  '-DAVERAGE_RSSI=5000'       ; Display RSSI floor ( Average of 5000 samples )
  '-DSIGNAL_RSSI=true'         ; Display during signal receive
  '-DNO_DEAF_WORKAROUND=true'
; *** RF Module Options ***
  '-DRF_CC1101="CC1101"'       ; CC1101 Transceiver Module
;  '-DRF_MODULE_CS=5'          ; pin to be used as chip select
  '-DRF_MODULE_GDO0=12'        ; CC1101 pin GDO0
  '-DRF_MODULE_GDO2=27'        ; CC1101 pin GDO2
; *** RadioLib Options ***
;  '-DRADIOLIB_DEBUG=true'
;  '-DRADIOLIB_VERBOSE=true'
; *** Generic SSD1306 OLED Options **
  '-DZdisplaySSD1306="Generic_SSD1306"'
  '-DOLED_SDA=21'               ; SSD1306 pin SDA
  '-DOLED_SCL=22'               ; SSD1306 pin SCL
  '-DGenericSSD1306=true'
  '-DJSON_TO_OLED=true'
;  '-DLOG_TO_OLED=true'         ; Enable log to OLED
;  '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
;  '-DDISPLAY_IDLE_LOGO=false'
;  '-DDISPLAY_BRIGHTNESS=80'
;  '-DDISPLAY_METRIC=false'
;  '-DDISPLAY_FLIP=false'
  '-DDISPLAY_PAGE_INTERVAL=30'
custom_description = Gateway using RTL_433_ESP library, need CC1101. With OLED.
  • In ZdisplaySSD1306.ino, add additional display init into the OledSerial constructor using the new display identifier GenericSSD1306:
#  elif defined(GenericSSD1306)
  display = new SSD1306Wire(0x3c, OLED_SDA, OLED_SCL, GEOMETRY_128_64);
#  endif
  • Build and deploy. Now the messages shown in the WebUI window should be shown on the OLED, too. With the occasional screensaver image.
2 Likes

Nicely done @paulus!

While i don’t think we’d need an additional pre-defined environment for this, would you mind submitting a Pull Request for the ZdisplaySSD1306.ino addition and also create some documentation with the relevant environment additions in the PR for anyone wanting do do the same? Probably best fitting after the first paragraph of the built in Heltec and LilyGo displays on the Display pages, followed by the arguments applicable to all.

Hi @DigiH,

There’s now a PR with the one small code modification and some additional documentation. I didn’t add the new environment, but only the necessary diff if one wants to use a display.

The description is now at the end of displays.md since the control of the works the same way as with the other boards.

Thanks @paulus - I think this is a really nice addition for anyone wanting to add an SSD1306 OLED display to their ESP32 gateway for rtl_433 or BLE messages.