OLED Displays with Arduino - I2C & SPI OLEDs

1,107,636
0
Published 2019-02-16
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: dronebotworkshop.com/oled-arduino/
More articles and tutorials: dronebotworkshop.com/
Join the conversation on the forum: forum.dronebotworkshop.com/
Subscribe to the newsletter and stay in touch: dronebotworkshop.com/subscribe/

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 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.

While you are there please sign up for the DroneBot Workshop Newsletter. It’s not a sales letter, it’s my way of keeping in touch with you to let you know about what's coming up in the workshop.

Lots of changes coming up in the workshop soon so if you haven’t subscribed to the YouTube channel yet please do so you don’t miss out on anything.

Hope you enjoy the video!

Bill

All Comments (21)
  • @laidman2007
    Your video lectures could serve as examples to instructors in ALL fields. You're right up there with the very best!
  • You are a great teacher because you repeat yourself frequently. You guide us through the process like a manual. You also don't confuse learners because you don't over exaggerate. Thank you.
  • @MorrWorm8
    I just want to take a moment to say your channel is amazing! When you are trying to learn something everyone always skips over things that’s are actually important. Not this channel. It’s soo good! It explains everything. Every stone is turned over. I love it.
  • @brandontechnerd
    I love that you got over 40 minutes out of this topic, and even used a temperature / humidity sensor.
  • I'm getting addicted to your channel. My "LED's" up there have been blinking like crazy since I tuned into it. What a nice way to "waste" my retirement time (and money)
  • @tkzcreations631
    As and ex video producer 27 years i have to say i love your production value. The average change of angle is 6 seconds our brain gets bored after that, Especial for a single presenter. Yes keep it up. Anybody can run a camera but editing is an art form don't change a thing. This is how you produce educational videos so students do not fall asleep. Top rating for you. Love it.
  • @datpudding5338
    Finally, someone who explains it for mere humans! May the gods bless him 🙏
  • @jlucasound
    You are awesome. I learned a lot. Your delivery is exemplary. Your knowledge is paramount. Thank You. I am 56. Just ordered more (MM) jumpers and an AM2320 sensor AND an AM2302 sensor module. I have Arduino, breadboards, OLED displays, and power. Thank you for explaining the code so well. You make no assumptions as to how much any individual knows. I would rather say "already know that" than "Oh, what did I miss?". Thanks.
  • You may have read somewhere that changing camera position keeps a video interesting, but I'd suggest that it is interesting because of your content. May have said that the two camera switching thing is a bad idea, and I agree if you switch without it having a meaning. If you need to switch, put a graphic or closeup. Switching between cameras can be used to tell the audience that you've got a side note to add for example, but switching for the sake of it tells them nothing. Camera angle is as much a part of your visual communication as you actual presentation. That said, thanks for the information. Very informative.
  • @richardbell8814
    There isn't a lesson you put out that I don't learn something from. Thanks for taking the time.
  • @Giblet535
    SPI is a bus protocol. You don't need two SPI ports to run two displays. It's possible to run lots of SPI displays from an Arduino, as long as the display has a CS connection, you have a free GPIO pin to select the display, and the display library differentiates display objects by the CS pin value you defined. They can even be different display types with different clock (SCK) speeds and resolutions. On the 32 bit boards e.g., Teensy, it's possible to animate as many as four 320x200 displays, separately, at the same time with acceptable results, using one SPI port.
  • @jerryl7173
    Another amazing video, Bill. Thank you so much for sharing your knowledge with the rest of the world. This channel is what YouTube should be. I teach Special Education, so it’s nice to come onto your channel and try to get some ideas. I’m hoping to make some adaptive equipment or some cool games that the kids might enjoy. Your channel is like nourishment for the brain!
  • @BenStrano
    I have been having fun with programming and microprocessors for a few months now, but I have never really grasped a lot of what I was doing. This video drove home so many concepts. I'm going through all of your videos now, because even if they seem beyond my skillset, I know you're going to present them in an approachable way. Kudos!
  • I enjoyed the instructional video and I am so thankful that you do not have background music. So many presenter’s videos have stupid background music that detracts from the information. You cannot always tell when they are going to play the music so I miss some of the talking after I mute the sound. If I want to listen to music I have my own library. Thanks again for the great video and no music.
  • @charly4594
    I am so impressed with this channel as you have helped me immensely in keeping up with Arduino technology and sensors. I recommend you to all of my fellow engineers as well as hobbyists. Your lectures and demos are super clear and precise, with no distractive fluff. Thank You !!!!
  • @stuartofblyth
    Another interesting video. I was presented with an OLED driven by an ESP8266 by my No. 2 Son, and it displayed a suitable Father's Day message. I transferred the components to a breadboard whereupon it stopped working. Thinking I'd blown up the OLED (they're unforgivably polarity-sensitive, apparently) I bought a second one and plugged it into the breadboard. Again, it didn't work. Investigation showed that the pin connections to the two OLEDS were different, so this may be worth bearing in mind - different manufacturers may use different pin arrangements. I thought I'd blown up this second one, too, because of the wrong connections, but closer examination revealed that the negative jumper lead from the ESP8266 to the OLED was open circuit! When this was replaced both displays worked fine. So two lessons learned - always check the pinouts, and don't assume the complicated stuff will fail and overlook basic troubleshooting techniques.
  • @fusion-ux1zz
    man i like how this guy explain , he though of everyone , slowl earners , not English speakers and what not, you are amazing
  • @DJGainmaster
    I never ever watched a explanation or "how to" video of this quality. Not even mine. Great Job
  • @JosephStates
    Thank you for your command of the English language! Thank you for showing every step! Today is my first day diving in with a nano as I have put it off learning about adrino for months. Now I must get educated to move forward on an invention my wife came up with. I lost a lot of time trying to understand the other guys' videos. I am hoping to get enough info from your videos to not have to watch the others. So thankful!
  • @celracing4425
    Hi Bill, nice to find your site. I too was struggling to unpack Adafruit's example for a SSD1306 driven OLED. Its very comprehensive, making it a bit complex for someone just starting. I used your example as a starting point and I'm integrating Adafruit's elaborations one at a time to understand them better. First time I've been able to get one working for my uses. I kept going back to their example originally just to see I had the hardware working, but was having a tough time modifying it without blowing up the sketch. Finding your example helped me to see how to drive it effectively. I do have to mention that I think your example seems to have one extra " void setup() { ". It seemed odd, so I commented it out, everything worked as expected. Thanks for the help.