|
Post by papa on Oct 20, 2022 20:04:48 GMT
ESP32 Node with OLED Display, IntroductionA 0.96 inch SSD1306 OLED display is a nice ESP32 board accessory. The I2C method is used to communicate with the OLED via an SDA pin & a SCL pin. The easiest way may be to get an ESP32 board with hard-wired OLED, like HiLetgo OLED ESP32. On this board, SDA is pin 5 & SCL is pin 4. This is the board I have. Or get an separate OLED with I2C communication protocol to connect to your ESP32 Board. Such an OLED has four pins to connect: Vin (ESP32 3.3v), GND (ESP32 GND), SDA, & SCL. If pins 4 & 5 are usable on your board, connect OLED SDA to ESP32 pin 5 & SCL to pin 4. See here for other possible pins. Disclosure: I have a hard-wired OLED, not a separate OLED board.
Next, Software & Initial Customization
|
|
|
Post by papa on Oct 20, 2022 20:11:34 GMT
ESP32 OLED Node Software & Initial Customization Use this thread for the latest software & initial customization. Also the Arduino IDE needs to load an OLED software library.... In Arduino IDE, open Tools/Manage Libraries... Search for & install "ESP8266 and ESP32 Oled Driver for SSD1306 display" Next, ESP32 OLED Node Customization
|
|
|
Post by papa on Oct 20, 2022 20:18:18 GMT
ESP32 OLED Node CustomizationIn the software sketch, deactivate #define lines from previous nodes (have // at line's start). Change the nodeId if you have another node with that ID. In the software sketch, find & activate these #define lines (delete // at the start): // #define ENABLE_SSD1306 // #define I2C_ SDA 5 // #define I2C_ SCL 4 If you connect SDA & SDL to different pins, change the 2nd & 3rd lines accordingly. Upload the customized software to the ESP32 board. Next, Expected results
|
|
|
Post by papa on Oct 20, 2022 20:22:05 GMT
ESP32 OLED Node, Expected resultsFor topics, the IDE Serial Monitor will show only RSSI & the board's IP address.
Note, like many computer things, OLED display coordinates start counting up from zero.
When the node boots up, the first OLED screen will show: msg01 = "OLED 0.0"; // OLED screen 1, line 0 msg02 = "OLED 0.1"; // line 1, IP address for a while, then blank Then the next screen will show: msg05 = "OLED 1.0"; // line 0 msg06 = "OLED 1.1"; // Screen 2, line 1 msg07 = "OLED 1.2" ; // Screen 2, line 2 msg08 = "OLED 1.3" ; // line 3 Then the OLED display alternates between the first & second screens. To see how the OLED programming works, search for ifdef ENABLE_SSD1306 Next, ESP32 & OLED, Other Possibilities
|
|
|
Post by papa on Oct 20, 2022 20:25:33 GMT
ESP32 & OLED, Other PossibilitiesOther customization you might do for now: Put your own text into msg02 & msg05-msg08. Pay attention to the length of those variables. Options to be documented later:
- openHAB can command different messages for the OLED display.
- PIR presence status can be shown on the OLED display.
|
|