Prerequisites
To build this setup, you will need:
- 1 ESP8266;
- 1 I2C 128×64 OLED screen;
- 1 LF33CV regulator (5v to 3.3v);
- 1 1kΩ resistor (pull-up);
- 2 4.7kΩ resistors.
Warning!
The code is in LUA and therefore requires the ESP8266 to have the nodemcu firmware.
Wiring

Code
Principle
The principle is as follows:
- The ESP creates an MQTT client with a unique id;
- It connects to the MQTT broker;
- The client subscribes to a specific topic where the desired data is published;
- The ESP displays the data on the screen for the first time;
- Then each time the MQTT broker receives new data on this topic, our client updates the data on the screen.
Result
