OLED Displays with ...
 
Notifications
Clear all

OLED Displays with Arduino - I2C & SPI OLEDs


DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 2 years ago
Posts: 1004
Topic starter  

OLED (Organic Light Emitting Diode) displays have a lot of advantages over LCD and traditional LED displays. Today we will learn how to use OLED displays with our Arduino projects. We’ll also build an OLED Temperature and Humidity Meter.

Article with code: https://dbot.ws/oled

OLED displays a bright, lightweight, and easy to read in almost any lighting condition. They come in all sizes, from huge wall-sized OLED televisions to thumbnail-sized status displays.

Today we will work with three small OLED displays:

- A 128x32 monochrome display that uses I2C
- A 128x64 dual-color display that also uses I2C
- A Waveshare 1.5 inch 128x128 monochrome display that can use either I2C or SPI

I’ll explain how an OLED differs from a regular LED and how it is ‘organic”. It doesn’t have anything to do with growing OLEDs without pesticides!

Next, we’ll look at some I2C OLEDs and experiment with them, using some excellent libraries from Adafruit.

After that, we will look at a very nice OLED display from Waveshare. It’s the largest display we’ll examine today and it can be used with either I2C or SPI. I will demo it in SPI mode using the demo code provided by Waveshare.

The example sketches provided with the libraries do a nice job of showing off the display's capabilities but they can be a little overwhelming to reverse-engineer for your own scripts. So to help I‘ve put together a very simple project to display simple text on the display, you can use it as the basis for your own Arduino OLED display projects.

The project is a temperature and humidity meter that uses the 128 x 64 dual-color OLED as a display. It uses an I2C temperature and humidity sensor so the wiring is super-easy. I'll go over the code for that in detail so you can see how it writes values to the OLED display.

Here is the Table of Contents for today's video:

00:00 - Introduction
02:20 - How OLEDs Work
06:19 - Look at OLED Displays
08:50 - OLEDs to Arduino with I2C
11:45 - Adafruit OLED Library
18:22 - I2C OLED Demos
24:27 - Waveshare OLED to Arduino with SPI
31:38 - OLED Temp & Humidity Meter

As always there is a detailed article on the DroneBot Workshop website that accompanies this video, you can find it at https://dbot.ws/oled. It covers everything in the video and you can also download the code for the temperature and humidity meter from the Resources box a the bottom of the article.

"Never trust a computer you can’t throw out a window." — Steve Wozniak


Quote
Magic Smoke
(@magic-smoke)
Active Member
Joined: 1 week ago
Posts: 7
 

I'm in the process of trying out a full colour OLED. Anyone want to point me in the direction of a decent tutorial.


ReplyQuote
DaveE
(@davee)
Estimable Member
Joined: 4 months ago
Posts: 137
 

Hi @magic-smoke,

  I don't have any 'hands-on' experience, but a quick Google suggested they are around. e.g. https://create.arduino.cc/projecthub/robocircuits/arduino-colored-oled-652ded

(assuming 65k colours is near enough to 'full colour')

You don't say which display model you are looking at, but if you haven't bought one, then I suggest you look at the usual suppliers like Adafruit, since they often provide libraries, support Arduino sketch code, videos, etc., so you have a good chance of getting the 'demo' to work.

It is usually easier to modify a working demo to do want you want, compared to starting the 'final' project from scratch.

Good luck with your research!


ReplyQuote
Magic Smoke
(@magic-smoke)
Active Member
Joined: 1 week ago
Posts: 7
 

@davee I bought an SSD1306 chip RGB OLED speculatively but there seems to be lots of opinion about which Arduino library to use and respective coding. There also the SSD1331 driver OLED and so it all gets a little confusing for those new to this. I was just wondering if forum members had any views or expereince with it.


ReplyQuote
DaveE
(@davee)
Estimable Member
Joined: 4 months ago
Posts: 137
 

Hi @magic-smoke,

   Isn't that the one Bill uses in the video above? Have you followed that?

  Also, maybe https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/ ?


ReplyQuote
Magic Smoke
(@magic-smoke)
Active Member
Joined: 1 week ago
Posts: 7
 

Sorry, my mistake.  I meant a SSD1331 RGB OLED. I'm confusing myself here, with so many options that I made a table to clarify.

I am beginning to think the RGB OLED itself is Kaput as I can't get any response.  My fault probably for buying cheap!

Screenshot 2021 09 11 at 11.21.16

ReplyQuote
DaveE
(@davee)
Estimable Member
Joined: 4 months ago
Posts: 137
 

Hi @magic-smoke,

  Sorry, I don't have any 1st hand experience of these displays, and of course a dodgy product is always possible, as quality control is usually the first 'economies' when price is the driver. So far the stuff I have received has generally been fine, but I guess we have to accept there will be the occasional dropout.

You have probably seen all the help on the web but in case you missed one ... I found this little video.





It shows the display being connected to an Arduino Uno, and when power is applied, the display appears to go through a self test routine before even discussing the Arduino software. Unfortunately, I can't check if this was due to the display having a built in self-test routine or the result of the presenter's Arduino already being programmed. Perhaps someone else on the forum can clarify?

I noted in the comments associated with the video, one person warned that the glassware is very fragile ... maybe the postal handling was too much for it?

I also spotted this write up .. https://create.arduino.cc/projecthub/robocircuits/arduino-colored-oled-652ded

Good luck!


ReplyQuote
Magic Smoke
(@magic-smoke)
Active Member
Joined: 1 week ago
Posts: 7
 

@davee Really appreciate your help with this. I'm putting it down for a little while to focus on something which actually works, then get back to it.

p


ReplyQuote
DaveE
(@davee)
Estimable Member
Joined: 4 months ago
Posts: 137
 

Hi @magic-smoke,

  Fair enough ... sometimes a short break is the best thing, as if you have made a small mistake, (and who doesn't from time to time), it is really hard to spot it when you are looking at it all the time ... check again carefully with 'fresh eyes' after the break.

  And maybe you have been unlucky with that particular display ... it might be faulty.

Better luck for the future ... take care.


ReplyQuote