OLED Displays with ...
 
Notifications
Clear all

OLED Displays with Arduino - I2C & SPI OLEDs

25 Posts
6 Users
4 Reactions
3,716 Views
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1108
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)
Member
Joined: 3 years ago
Posts: 10
 

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)
Member
Joined: 3 years ago
Posts: 1852
 

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)
Member
Joined: 3 years ago
Posts: 10
 

@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)
Member
Joined: 3 years ago
Posts: 1852
 

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)
Member
Joined: 3 years ago
Posts: 10
 

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)
Member
Joined: 3 years ago
Posts: 1852
 

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.

 https://www.youtube.com/watch?v=CYkGRtVv3Ls 

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)
Member
Joined: 3 years ago
Posts: 10
 

@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)
Member
Joined: 3 years ago
Posts: 1852
 

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
(@andre-alm10)
Member
Joined: 12 months ago
Posts: 13
 

Hi, i'm new to Arduino but I have got very interested. I'm designing a sip&puff control system for electric wheelchair. It's for my personal use. I need a small display that is readable outside when its sunshine and also dark and indoors. The small display in the video is a good size but I need one that the brightest can be controlled. I planning to have a light sensor to know what level to set the brightest on the display. 

Any tips of a display would be great. I prefer to work with Arduino IDE.

Thanks, André. 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2554
 

@andre-alm10 

If you don't need a fast response, then ePaper might work well for you. It's very good in sunlight because it makes the display MORE readable, unlike many LED or LCD types.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7591
 

@andre-alm10 @will I was going to also suggest ePaper but maybe the first step is to look for a comparison chart to see what if any shortcomings apply to Paper. In your case I can't think of any but it's been a while since I looked at the data.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2554
 

@zander 

They are typically slower to update the screen than other display types. That's one (possibly significant) difference.

Anything seems possible when you don't know what you're talking about.


   
Ron reacted
ReplyQuote
(@andre-alm10)
Member
Joined: 12 months ago
Posts: 13
 

 I have looked at ePaper and I think the response time would be okey. There is not much information that will change on the display. But when reading about ePaper it said that you UV light will damage the display. Maybe that was just for that model. How is ePaper when it's dark? I need to be able to see the display info when it's quite dark. I think OLED with controllable brightness would be a good solution. I haven't tested so I can be wrong. Thanks for the input. 😀 


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1852
 

Hi @andre-alm10,

    I note you have also posted in the Introductions section with an inspiring opening paragraph, so I'll start with saying welcome to the forum, and hope you receive some useful information.

I am sorry that I don't have any experience with OLEDs at present, but as Bill (@dronebot-workshop) points out, they are available over a wide range of sizes, albeit some sizes may be difficult to obtain in one-off quantities in the 'open' market. He also notes their high brightness, which obviously helps in the challenging environment of bright sunlight.

Your intended usage is outside of most people's experience, whilst you are already designing a solution, so I wondered if you could suggest the range of display sizes you think would be suitable, in the hope that would trigger an idea for someone. Maybe you could suggest suitable ranges for:

  • Display size  X * Y  in mm
  • Display Size  x * y  in pixels
  • Would 'monochrome' (ie two colours) be sufficient, or do you need a full colour range
  • Any other details or requirements that are necessary or useful

Sorry, this is a question, rather than an answer, but sometimes asking a more precise question results in an answer .. no guarantees of course, but it's usually worth a try.

Best wishes to you and good luck with your project, Dave


   
ReplyQuote
Page 1 / 2