In this tutorial we will learn how to use a 0.96” monochrome OLED display (based on the SSD1306 chip) with an ESP8266 module and more specifically the ESP-01 module. We will use the 2 GPIO ports available on the ESP-01 to connect the SS1306 OLED display using the I2C bus.
To illustrate this article, we will realize a small WiFi scanner project that connects to a WiFi network and displays the ip address assigned to the ESP-01 as well as the strength of the WiFi signal on the OLED screen. In a next project, we will realize a small box by 3D printing to make our Wifi scanner portable and autonomous.
If you’re new to ESP8266, you might also be interested in these articles
Materials required for this project
To carry out the assembly of this project you will need the following equipment
|ESP-01 module (ESP8266)|
|ESP-01 adaptor with tension regulator 5V to 3.3V (better)|
||FDTI module or cable|
|OLED I2C 0.96” monochrome display (SSD1306)|
|Button for Reset (optional)|
|Resistor 220 ohm (optional)|
Circuit and procedure for installing the code on the ESP-01
The management of the display on the OLED screen of this project is based on the work of. The WiFi part is managed thanks to the ESP8266Wifi library (Github).
The first step of this project is to put your ESP-01 module in bootload mode. Perform the following wiring.
Retrieve the project code from the DIY Projects Github. Open the file ESP01-OLED.ino and change the <ssid> and <password> variables according to your WiFi network. Download now the ESP8266Wifi library on Github and install there by going to the menu Sketch -> Include a library -> Add library .ZIP
Choose the Generic ESP8266 Module board and select ArduinoISP as programmer.
Now turn on your ESP8266 and press Upload. If your wiring is correct, downloading starts after compiling the program.
Connect the SSD1306 OLED display and start the WiFi scanner on the ESP-01
Now that the program is installed on the ESP8266, turn off the power to the module.
To use an OLED screen on an ESP-01 we will use the 2 GPIOs available on the module to connect them to the I2C bus that equips the SSD1306. The connection is very simple. Remove the cable connecting the GPIO0 to the GND and connect the OLED I2C screen as follows:
SDA <-> GPIO0
SCK <-> GPIO2
GND <-> GND
VCC <-> 3.3V
You can reverse the wiring. In this case, change the settings in the program and reinstall the program.
Now turn on the ESP-01. The WiFi scanner will first connect to the WiFi network and then retrieve the ip address assigned to the ESP-01 as well as the signal strength. After a few seconds, you should get this: