How to connect and use an SPI OLED Display
OLED Displays are great in many ways. They use very little power, are bright, easy to read with large viewing angle and have high resolution considering their small size.
The OLED we will use today is .96″ inch in size, features 128×64 pixels and uses the SPI Bus.
We will use the u8glib library to communicate with our display. This library has many available parameters, we will use some of them to display a bitmap image and to display some text.
If you would like to experiment and learn more about this library, you can go to the Wiki: U8GLIB Wiki.
In this tutorial we will use the DHT11 Temperature and Humidity sensor and display those value on the OLED Display.
Our OLED display uses the SPI Bus.
Since the SPI Bus is faster than I2C, this will make our display very responsive.
Of course there’s a tradeoff, the SPI Bus uses more pins on our UNO (5 compared to 2).
But for our project this is not a problem.
The OLED is connected to pins 9 through 13 and the DHT11 is connected to pin A0.
We used a breadboard to connect the VCC and Ground to both modules from our UNO.
We are using 2 libraries in this tutorial: u8glib for the OLED display and the dhtlib for the DHT11 sensor.
We also used a little program to convert our bitmap image into hexadecimal to display it on the display.
Again, please watch our tutorial video for more information
Copy and paste the above code in the Arduino IDE to program your Arduino.
Download LCDAssistant software: LCDAssistant.zip
Download the U8GLib library here: https://bintray.com/olikraus/u8glib/Arduino/1.17
Download the DHT library here: https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib
Once downloaded, just extract the content of the zip files inside your “arduino/libraries” folder.