Skip to content

This repository describes a detailed approach (in the form of hardware and software) to interface a 1.3" OLED display with NodeMCU ESP8266 module in SPI and I2C modes. Several websites are motivation for the present work. Shortly the video will be uploaded

License

Notifications You must be signed in to change notification settings

DrKRR/esp8266_1.3inchOLED_SPI_I2C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esp8266_1.3inchOLED_SPI_I2C

This repository describes a detailed approach (in the form of hardware and software) to interface a 1.3" OLED display with NodeMCU ESP8266 module in SPI and I2C modes. Following website is the motivation for the present work.

[(https://github.com/rene-mt/esp8266-oled-sh1106)]

In this project I am going to present hardware software to interface 1.3"OLED with NodeMCU ESP8266 in both SPI and I2C modes. In an attempt to do this, software is developed to display different shapes and graphics on OLED. The front and back sides of OLED are shown below:


It is clear from the above figure that, the OLED has seven pins: GND, Vcc, CLK, MOSI, RES, DC, CS. In the I2C mode, the first four pins are used for I2C communication. Neverthless, other pins have to be either HI or LO. Thus, for I2C make RES=1, DC=CS=0. All seven pins are used in SPI mode. Further, by visual inspection of the backplane, one can see that the board comes with a 4k7 resistor connected across the SPI bridge, and the R8 bridge in OPEN condition. For I2C, (i). the 4k7 resistor has to be removed from SPI bridge and soldered across the I2C bridge, (ii). the R8 resistor position (bridge) shorted as shown in the third figure above

Interfacing 1.3" OLED with NodeMCU ESP8266 in I2C Mode

HARDWARE:>
The 1.3" 128x64 OLED uses SH1106 driver IC for handling the pixels. Commands used with SH1106 are different from that of the commands used with SSD1306. Also the constructors used in the software are different. The figure given below shows interfacing OLED with NodeMCU ESP8266 in I2C mode:

It is clear from the above first figure that the SCL pin of NodeMCU is connected to CLK of OLED and the SDA pin of NodeMCU to MOSI of the OLED. Pull-up resistors (4k7 or 3k3) are used on both of these pins. After successful execution, the program is dumped on to NodeMCU, and the system is powered by power bank, which can be seen in the third figure above. The second figure shows the display of ASCII characters, and the third one shows the display of graphics on the 1.3" OLED in I2C mode, with SH1106 driver.
SOFTWARE:>
All programs are developed in Arduino Integrated Development Environment (IDE). For the current work, u8g2 library is installed in the program execution path. It's indeed a great library! Installation of u8g2 library is accomplished from the following website:

[(https://github.com/olikraus/u8g2)]

Method of downloading and adding it to the Arduino path, choosing of the board etc., are not explained here, because the procedure is well explained in different blogs and websites. Here, I am considering examples for which algorithms and program listings are given. When we consider I2C, its address is important. One among the following websites can be used to obtain the I2C address:

[(https://github.com/gryzli133/ESP8266-I2C-Scanner-with-OLED-SH1106-Display/blob/master/I2C_Scanner.ino)]

[(https://www.instructables.com/ESP8266-I2C-PORT-and-Address-Scanner/)]

I have used the second website to obtain the I2C address of the 1.3" OLED used in the present work. The Arduino program is included here. The output on the Serial Monitor is available here. The I2C address for my display is 0x3C. But, for certain displays, it is mentioned that DC>>GND-->I2C addrees=0x3D. One should test and ascertain the I2C address before its use. The following pictures show the I2C address displayed on OLED and a graphic output using I2C interface.


I will now turn my attention towards description on interfacing 1.3" OLED module (the same above module) in SPI mode

Interfacing 1.3" OLED module with NodeMCU ESP8266 in SPI Mode:

HARDWARE:>

The following circuit shows the interfacing OLED display with NodeMCU ESP8266 in SPI mode. Other photos show the display of characters and graphics.

SOFTWARE:>
Program listing in the form of .ino file is given for displaying the above center photo Erratum: In the above program ESP9266 should be corrected as ESP8266.

About

This repository describes a detailed approach (in the form of hardware and software) to interface a 1.3" OLED display with NodeMCU ESP8266 module in SPI and I2C modes. Several websites are motivation for the present work. Shortly the video will be uploaded

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages