OLED stands for Organic Light Emitting Diode or Organic electroluminescent diode, OLED displays have a series of thin films between two conductors. The film is made up of an organic compound that emits light in response to an electric current. Out of the two conductors usually one of them is transparent. This technology is majorly used to create digital displays in electronic devices like television screens, smartphones, portable gaming consoles etc.
About the module
The module is available in both SPI as well I2C communication protocol, however the display, which uses an I2C protocol is comparatively easier to use and we will be using the same here. The module is a 0.96 inch, 4 pin, monochromatic display with a regulator, meaning it can operate on 5V DC voltage, whereas the display without the regulator operates on a 3.3V DC voltage. The module consists of an SSD 1306 display controller with a resolution of 128x64 pixels. Usually the board uses an I2C address of 0x3C however, we can find the I2C with the help of a code which will be shared here. One of the major advantages of an OLED display over an LCD display is that the OLED display module does not require a backlight and has a high contrast which makes it easier to use. We can adjust the font size of the text, change the font and even change the color of the text non-monochromatic displays.
How to use the Module?
• Since the module uses I2C protocol it uses only 4 pins, that is VCC, GND, SCL/SCK and SDA.
• Connect the VCC pin of the module to the 5V pin of the Arduino.
• Connect the GND pin of the module to the GND of the Arduino.
• Connect the SCL/SCK pin of the module to the SCL pin of the Arduino UNO board, which is A5.
• Connect the SDA pin of the module to the SDA pin on the Arduino UNO board, which is A4.
Follow the given instructions and use the circuit diagram given below to connect the module to the Arduino, after uploading the code the OLED display will be ready for use. The Arduino UNO has another I2C bus which has the pins located above the AREF pins which can also be used to interface with the module.
Before we begin writing the code we need to install 2 libraries which are available on the Arduino IDE, namely the Adafruit GFX library and the Adafruit SSD1306 library, after the installation of these libraries we can program the Arduino to interface with the OLED display. The first task that we need to accomplish is to find the I2C address of the module, for this purpose, we will connect the module to the Arduino and upload the following code to the board which will display the I2C address on the serial monitor. Make sure to use the correct baud rate (115200) while viewing the address on the serial monitor. The I2C address of this module is 0x3C which we found using the above code, now we will write another code to interface with the module. We can also use an example code to test the module by uploading the example from ssd1306 library (the I2C 128x64 version).
Now we will print “Hello World Welcome to the OLED Tutorial”
We will include the above four libraries in the code, in the setup section we will initialize the display and enter the I2C address and then clear the display. In the loop section we will use the display.setTextSize function to alter the text size as we see fit, the display.The SetTextColor function to change the font color, however, in a monochromatic display we can only set the text color to white which is what we have done here. We will use the display.setCursor function to set the starting position of the cursor on the display. display.display() is the most crucial function of the code as it enables us to see the text or the change in the text of the display. In the above code the display reads “Hello World Welcome to the OLED Tutorial” for 5 seconds, after which the screen goes blank for 2 seconds and the code runs on a loop.
• Automation projects
• Robotic projects to display error messages
• Washing machines
• Portable machines and cameras
• Digital thermometers