Saturday, May 16, 2020

ESP8266 (NodeMCU/ESP8266 DevKitC) + SSD1306 I2C OLED, Platform IO.

NodeMCU + SSD1306 I2C OLED

Steps to new a PlatformIO project, for NodeMCU board of Arduino framework, using library and example of ESP8266_SSD1306, to display on I2C SSD1306 OLED display. Tested on Windows 10/VirtualBox.


- Connect NodeMCU to I2C SSD1306 OLED:


- Refer to previous post to Install VS Code/PlatformIO IDE on Ubuntu 20.04.

- Make sure the library ESP8266_SSD1306 is installed.


- Create a new project using NodeMCU board and Arduino framework.

- Open PlatformIO - Libraries page, copy example of ESP8266_SSD1306 library to our main.c.

- Edit platformio.ini to specify upload_port.

- Finally, Build and Upload. Done.


Espressif ESP8266 DevKitC + SSD1306 I2C OLED

Then I tried to test it on Espressif ESP8266 DevKitC, with module ESP-WROOM-02D.

It's found from ESP-WROOM-02D/02U Datasheet, I2C is assigned to IO14 (SCL), IO2 (SDA).


So I re-connect accordingly.

ESP8266 DevKitC <-> I2C SSD1306 OLED
3V3 - VCC
GND - GND
IO2 - SDA
IO14 - SCL

And edit main.c, change the code:

from:
SSD1306Wire  display(0x3c, D3, D5);

to:
SSD1306Wire  display(0x3c, 2, 14);


Re-build, and upload...done.


Next:
ESP8266 (NodeMCU) - Get current weather data from OpenWeatherMap, using ArduinoJson


No comments:

Post a Comment