Download PDF Parts List View on YouTube Download Code

Introduction

There are a number of options for displaying text or graphics in your project. LEDs and LCDs are the traditional choices but in recent years another type of display has been getting a lot of attention – the OLED.

OLED’s are used in display applications large and small, from giant television screens to tiny smartwatch displays.  They are bright, easy to see in a variety of lighting conditions and they consume very little current.

And they are organic as well!

How are these “Organic”?

OLED is an abbreviation for “Organic Light Emitting Diode” which would seem to indicate that these devices are somehow related to traditional LED’s but differ in the sense that they are “organic”.  This is actually true on both accounts.

The term “organic” to most people is used when describing the production of food but in this case, it has an entirely different meaning.

Using OLED Displays with Arduino

The “organic” in OLED refers to the organic molecules used in creating these devices. Organic molecules are simply molecules that are based around lines or rings of carbon atoms. Examples of organic molecules include common items such as sugar, gasoline, alcohol, wood, and plastics.

Your OLED wasn’t grown without the use of pesticides!

How OLEDs Work

Electroluminescence is a big word (I confess, I had to spell-check it!) that describes the phenomena of a material emitting light when an electric current is passed through it.  Standard LEDs and EL panels make use of this phenomena.

OLED History

In the 1950s it was discovered that some organic compounds exhibited the phenomena of electroluminescence. At the time this was not much more than a laboratory curiosity.

Twenty years later Alan Heeger, Alan MacDiarmid, and Hideki Shirakawa discovered organic semiconductors, a feat which would earn them a Nobel Prize in Chemistry in 2000.

In 1987 Ching Tang and Steven VanSlyke developed the first practical OLED at the research labs at Eastman Kodak.

Kodak was also the first company to release a commercial device using OLEDs. Its EasyShare LS633 camera was released in March 2003 and used an OLED display screen.

Samsung has used OLED technology in its televisions since 2013.  Sony has had some OLED TVs available since 2007 in limited areas.

OLEDs vs LEDs

As with a standard LED, an OLED emits light photons of a specific frequency when an electrical current is passed through it.

How OLEDS Work - LED and OLED Differences

A standard LED consists of two layers of semiconductor material, n-type and p-type. They are as follows:

  • Cathode
  • Anode

The two layers are arranged to have a slight gap and when current flows through the device electrons “jump” across this gap. As they cross the gap they release photons.

How OLEDS Work - LED and OLED Layers

An OLED consists of several layers, a standard OLED has six:

  • Seal (the outside seal or the “screen” that is actually viewed by the user)
  • Cathode
  • Emissive Layer
  • Conductive Layer
  • Anode
  • Substrate (the material that the OLED is “printed” onto)

How OLEDS Work - LED and OLED Construction

When a current is passed through the OLED the Emissive Layer emits photons.

How OLEDS Work - Emit Light

OLED Advantages & Disadvantages

OLED displays have many advantages over LED and LCD displays:

  • They are lighter and thinner than displays made with LEDs or LCDs.
  • They are flexible, allowing the production of curved video displays.
  • OLEDs are brighter than traditional LEDs.
  • OLEDs do not require a backlight as LCDs do.
  • They have a true black background, which makes for a more accurate video display.
  • They can be refreshed much faster than LCDs, making them suitable for high-speed and high framerate video.
  • They can be made very large.
  • OLEDs have a very wide field of view, approaching 170 degrees. This allows users to enjoy the video display without needing to sit directly in front of it.
  • OLEDs can be seen in a variety of lighting environments, both indoor and outdoor.

There are also a few disadvantages to OLED displays:

  • Early OLED displays had lifespan problems. This has been improved, however blue OLEDs still have a shorter life expectancy than their traditional LED equivalents.
  • Currently, OLEDs are more expensive to manufacture. This will likely change as more factories produce them. Eventually, they will rival or beat LCDs in value, but right now they are more expensive.
  • OLEDs can be damaged by water. This excludes them from many outdoor applications.

Personally, I think the advantages outweigh the disadvantages, especially considering that as the technology improves the disadvantages should be mostly, if not completely, resolved.

Future Applications of OLEDs

There are many types of OLEDs, not all of them are used for video or panel displays.

White OLEDs are being developed to be used in home and industrial lighting environments, to replace traditional fluorescent or LED lights.

Transparent OLEDs can be made up to 85% as transparent as their substrate (the material they are printed on) is.  This will improve and has a lot of potential for heads-up displays.

Foldable OLEDs are perhaps the most intriguing of them all. These OLEDs have already been used in curved video displays and will find a lot of use in the design of phones with bendable screens.

But the real exciting aspect of foldable OLEDs is that they can be printed onto cloth. This creates the possibility of a new generation of wearable electronics. Imagine a t-shirt that is also a video display.

As corny as it sounds I just have to say it – the future looks bright for OLEDs!

Connecting OLEDs to the Arduino – I2C

So now that we know a bit about OLEDs how do we get one connected to an Arduino and start displaying wonderful things?  There are actually a couple of ways.

OLED displays typically come with either an SPI or an I2C interface. Some even have both interfaces, one of the ones we will look at today works like that.

Three OLED Displays

To display data on an OLED you will first load it into the OLED buffer and then give it a command to write to the display. There are several libraries available for the Arduino that will simplify this, I’ll be showing you one from Adafruit that is very versatile.

As the OLED display is really a matrix of OLEDs you’ll need to address them individually to control them. The Adafruit library simplifies this, as do the other OLED libraries.  

You can use font files to display characters, your library may also have these built-in.

I2C OLED Displays

We will start by working with a couple of very common I2C OLED displays. These displays are based on the SSD1306 OLED driver chip so they can use the same software libraries.

The difference between the two displays is their size. OLED displays are a matrix of pixels and are described as such.

One of my displays is 128×32. It is a very simple I2C display with no provision for changing its I2C address. Mine came configured for I2C address 0x3C, which is probably the most common OLED address.

The unit has four connections:

  • GND – The Ground connection.
  • VCC – The power supply, 5 VDC.
  • SCL – The I2C Clock.
  • SDA – The I2C Data line.

The second display is 128×64, twice as many lines as the first one. It is actually a bicolor display, the top 16 pixels are yellow and the bottom 32 are blue.  This type of display is often used as an indicator for devices like FM radios and MP3 players.

The larger display has the same connections as its smaller counterpart, it also has provisions for changing its I2C address. The address change involves moving a surface-mount resistor from one set of solder pads to another. Not quite as simple as using a jumper wire or solder bridge!

Set I2C Address on OLED Display with Resistor Jumper

My device came configured with the same I2C address as my small one, 0x3C.

The instructions that follow should work with any sized OLED based upon the SSD1306 OLED driver chip. Make sure you check your I2C address as it may not be the same as the one I used, you can just change it in the sketches.

Arduino with I2C OLED Hookup

As long as you keep your OLED and Arduino reasonably close you should just be able to connect them directly without any other components. If you experience errors try adding pull-up resistors, I didn’t find that to be necessary myself.

OLED Hookup with Arduino using I2C

The power and ground connections to the display are pretty obvious. Most of these displays have an onboard regulator to supply power to the OLEDs and to the “charge pump” used to drive them.

The SCL connection goes to Arduino pin A4. The SCL connection goes to A5. If your Arduino Uno has a separate set of SDA and SCK connections (usually located near the AREF pin) you can use those instead, they are actually the same connection.

Adafruit Library for OLED displays

As I have already mentioned I’ll be using an Adafruit library to work with the OLED display. Actually, I’ll be using two Adafruit libraries.

Obtaining the Adafruit Libraries

We will be using the following two Adafruit libraries:

  • Adafruit GFX – This is a graphics library that will be used to draw shapes on the POLED display.
  • Adafruit SSD1306 – The library for the SSD1306 monochrome OLED display. It was originally designed for an Adafruit-specific display but has been enhanced to work with any display based upon the SSD1306 driver chip.

Both Adafruit libraries are available at GitHub, but it is much easier to install them using the Library Manager in the Arduino IDE.  You can do that as follows:

  1. Open your Arduino IDE.
  2. Click on the Sketch menu item at the top
  3. Click on the Include Library item. This will open up a submenu.
  4. Look for Manage Libraries at the top of the submenu and select it.
  5. The Library Manager will open.
  6. Use the search box in the Library Manager to find the two libraries.
  7. When you find the library highlight it. An Install button will appear on the right side of the listing if you don’t already have it.
  8. Click the Install button to install the library.
  9. Repeat for the other library.
  10. Close the Library Manager when you are finished.

Now that you have the two libraries we can use them to run some demo sketches.

Demo Sketches

The Adafruit SSD1306 library also installed four demo sketches. You can find them by clicking on the File menu, choosing Examples and scrolling down to Adafruit SSD1306. Open that menu item and you’ll see four sketches:

  • 32 Line I2C
  • 32 Line SPI
  • 64 Line I2C
  • 64 Line SPI

As I am starting with my 32 Line display using I2C I’ll load the first sketch.

Al the sketches are similar, in fact, they use the same credits in each one. They both use the graphics library to go through a number of demonstration routines. Interestingly, the last routine (falling snowflakes) goes on infinitely, so the entire sketch is run in the setup routine,. Nothing is in the loop as it never gets to the loop.

One thing to note is that you should check your I2C address and adjust the sketch to match. The 64 line sketch has a different I2C address, I had to change it to run on my display.

Here is the demonstration on a 32 Line display:

128x32 OLED Display Demo

And here is the same demonstration on the bicolor 64 Line display:

128x64 OLED Display Demo

For fun, I connected two 32 Line displays up to the Arduino, by running them in parallel on the I2C bus. Normally you would never connect two I2C devices with the same address onto one I2C bus but in this case, it actually works.

2 32-Line OLEDs in parallel

It works because displays only receive data, they don’t return any to the host Arduino. Both displays have the same address so they simply respond to the data for that address.

This could be a good technique to use when you need a display on the front and back of an enclosure for your project.

Using the Waveshare OLED Display – SPI

The Waveshare 1.5 inch display module is a monochrome 128 x 128 OLED display that can use either an I2C or SPI interface.  Connections can be made to the module using an included cable that mates with a connector on the module itself. There are also holes for header pins to make the same connections if you prefer.

Waveshare OLED with Cable

A surface-mount resistor can be moved between solder pads to select either the I2C or SPI connection. When the connection mode changes so do the functions of certain interface pins, a diagram is printed on the back of the module that illustrates this.

Waveshare OLED Display - Reverse Dide

Arduino Hookup

I used the supplied cable to hook up the OLED display to my Arduino, you can also solder header pins to the module and plug it into a breadboard if you prefer. Either way the connections are the same, as follows:

Waveshare OLED Arduino Hookup with SPI

As the cable is supplied with female ends I used a bunch of short jumper wires to make the connection to the Arduino.

Demo Sketch

With the device connected it is now time to run a sketch to test it out.

You can’t use the Adafruit demos with this display, even when wired in SPI mode. The Waveshare 1.5 inch OLED display uses the SSD1327 driver, which is a different beast than the SSD1306 driver used in the I2C displays we looked at previously.

So you’ll need a different sketch or library to work with this display.

I visited the Waveshare Wiki for the 1.5 inch OLED Module to get some sample software.  They sent me to the (amusingly misspelled) 1.5inch OLED Moudle download page.  I downloaded and unzipped the file.

The file contains folders for the Arduino as well as the Raspberry Pi and STM32 boards. Naturally, I opened up the Arduino folder.

This folder contains three additional folders:

  • EXT_RAM – Sample software that requires external RAM be added to your Arduino.
  • INT_RAM – Sample software that uses the Arduino internal RAM.
  • lib – Library files

Without adding extra memory to your Arduino you can’t really do any animation on the display as there won’t be enough memory to hold the display buffer – remember, this is a 128 x 128 display.  But as I don’t really want to add extra RAM to my Arduino Uno I restricted myself to the ”internal memory” sketch.

You’ll need to install the sketch and the library files manually. Here is how you do that:

  1. You’ll need to locate your Arduino sketchbook folder, the one that holds the Arduino sketches from the Arduino IDE on your computer. Locate and open that folder, it’s probably called Arduino.
  2. Open the libraries folder in your Arduino folder. Save this place.
  3. Open the lib folder on the unzipped Waveshare download. You see a Fonts folder.
  4. If your Arduino libraries folder does not already have a Fonts folder just copy the whole folder in. If there is already a Fonts folder then copy just the contents of the Waveshare Fonts folder into the existing folder.
  5. Now go back to the Arduino folders on both your local drive and in the Waveshare unzipped folder.
  6. Open the INT_RAM folder in the Waveshare Arduino folder. You’ll see another folder called OLED_Show. Copy this entire folder to your Arduino folder on your local computer.
  7. Open the OLED_Show folder. You’ll see a number of files, including a sketch called OLED_Show.ino. This is the demo sketch, you can open it with your Arduino IDE.

When you compile and upload the sketch you may get a message warning you about low memory on the Arduino. Just accept the message, the sketch leaves very little free memory as it uses most of it to load the display buffer.

Now that you’ve done all that work reward yourself by looking at your display.

Waveshare OLED Demo

The demo displays a fake “clock” along with a number of graphic symbols and some text.  It will give you an idea of what kind of characters you can display and how they will look.

If you are up for experimentation try editing some of the font files and see the effects of your edits.

If you want to see some animated demos using this display you are probably better off running the code included for the Raspberry Pi, as this won’t have the memory limitations the Arduino code does.

OLED Temp & Humidity Meter

The previous examples will help you get your OLED display setup and ensure that it is working. They can also be used as starting points for your own sketch to control the OLED display.

But they can also be a bit overwhelming. Because they contain a lot of graphics and animation coding to show off the display the demo scripts are also rather complex. And that makes it a bit more difficult for a beginner to figure out how to control their display.

In order to make it easier for you to get started with OLED displays, I’ve created a very simple project that you can build that uses simple code to display text.

The project is a Temperature and Humidity Meter. It displays the results on the 128 x 64 I2C OLED display we worked with earlier.

It also uses an I2C sensor to get temperature and humidity data so the wiring is very easy.

AM2320 I2C Temperature & Humidity Sensor

The AM2320 is a temperature and humidity sensor that has an I2C display.  

I’ve used this sensor before, check out the article about building a UV Index meter.

This device is very precise, it’s temperature is accurate to within 0.5℃ and its humidity readings are accurate to within 3%.  It can be used in a range from -40° (Celcius or Farenheit, it’s actually the same) to 80℃.

The pinout of the AM2320 is as follows (looking at the front from left to right):

  • VDD – Power supply of 3.1 to 5.5 volts DC.
  • SDA – I2C data line.
  • GND – Ground
  • SCL – I2C Clock.

The AM2320 has a default I2C address of 0x5C and cannot be changed.

Arduino Hookup

Since both the AM2320 and OLED display are I2C devices the wiring of our OLED temperature and humidity meter couldn’t be easier. Here is the hookup diagram.

Arduino OLED Temperature and Humidity Meter

One thing to note is that although both devices are I2C they don’t have the same pinout – they have the same pins but they are in a different order. Make sure you observe that when you are hooking everything up.

Now that you have it connected it’s time to look at the sketch.

OLED Temperature & Humidity Sketch

Here is the sketch for the OLED Temperature and Humidity Meter. If you need a copy of it make sure to check out the Resources section at the end of this article where you will find a link to download it.

 

In order to run this sketch, you’ll need to install more libraries to work with the AM2320 (I will assume you installed the two Adafruit libraries we discussed earlier as you need those too). Again these will be installed from the Library Manager in your Arduino IDE, using the same procedure you followed when installing the OLED libraries earlier.

The two new libraries you will need are as follows:

  • Adafruit AM2320 Library – As its name implies this is the library for working with the AM2320.
  • Adafruit Unified Sensor Library – This is a “master library” that is used by several Adafruit sensor libraries, including the AM2320. Your sketch won’t compile without it as the other library depends upon it.

Type the names of the libraries (i.e. “adafruit am2320” and “adafruit unified sensor”) into your Library Manager search box to find and install the libraries. If you’ve used Adafruit sensor libraries before you may already have the Unified Sensor Library.

Now onto the sketch. It starts by loading all of the libraries we just spoke of, along with the Arduino Wire Library to communicate via I2C. Note that the Graphics library has been included but isn’t really being used in this sketch, you can omit the include statement for it if you wish.

We then setup an object called display that represents our OLED display. Note that the original Adafruit OLED tha the library was written for used a Reset pin that still needs to be defined, even if it isn’t used.

We also define an object for our temperature and humidity sensor called am2320.

In the setup we initialize the Wire library. We do the same for the OLED and the sensor.

Note that the initialization line for the OLED specifies its I2C address. If you are using an OLED with a different address you will need to change that.

Most of the action in our script occurs in a function called displayTempHumid().

We start his function with a two-second delay, the sensor can take over a second to stabilize between readings.

Next we read the Humidity and Temperature from the AM2320, we assign these values to two floats.

Now we work with the OLED display.  Keep in mind that when you work with an OLED you are first setting up your data in a display buffer, after which you issue a command to display the buffer contents.

We start by clearing the display, which is a good practice.

Next, we set the display color. As we are using a monochrome display we always use WHITE. It doesn’t matter what color your display actually is (mine is yellow and blue but I still use WHITE for both). Color values don’t really come into play until you work with RGB OLEDs.

Next we set the font size. You may experiment here if you wish, I chose font size 1.

Finally we get around to printing on the display. We do that by (a) selecting the coordinates to place our cursor and (b) sending some text to print.

The cursor coordinates are in the form of (Column #, Row #) . The coordinate of the top left corner is (0,0)

We print the text that will appear in the first line, I chose “DroneBot Workshop” but of course you can change it.

We then move the cursor down and print the word “Humidity:” followed by some spaces – the spaces are a crude attempt at lining up the display!  We then print the actual humidity value from the float, followed by a space and a percentage symbol.

Finally, we move the cursor down again and do the same thing to the next line, this time with the word “Temperature” and the temperature value in Celsius.

The Loop is very simple.

First we call the displayTempHumid() function we just spoke of. It get s al the data into the display buffer.

Next we use a display.display command to actually print the buffer contents to the display.

And then we do it all again. Due to the delay in the displayTempHumid() function, it will refresh about every two seconds.

OLED Tempereture Humidity Meter Demo

The project worked perfectly the first time I tried it. You’ll notice some gibberish on the display when it is first fired up, this will clear in two seconds when the first readings are displayed.

Notice that as I am using a bicolor display the first line of text is in yellow, the remaining ones are in blue.

Conclusion

OLEDs are bright displays with a bright future and using them in your Arduino projects makes good sense.  

The cost of OLEDs is continually falling and it won’t be too long before they rival LCDs in price. They don’t need a backlight and they are visible in all types of lighting environments.

Just remember to keep them dry, even though they are “organic” OLEDs don’t like water!

I’m planning to start experimenting with RGB OLED displays next, so if you enjoyed this article and video keep your eyes open for an article about color OLEDs soon.

Until then grab some OLEDs and display something!

 

Parts List

Here are some components that you might need to complete the experiments in this article. Please note that some of these links may be affiliate links, and the DroneBot Workshop may receive a commission on your purchases. This does not increase the cost to you and is a method of supporting this ad-free website.

COMING SOON!

 

Resources

OLED Thermometer & Humidity Meter Code – Sketch for the OLED Temperature and Humidity Meter in a ZIP file.

OLEDs on Wikipedia – Wikipedia article about OLEDs and how they work.

How OLEDs Work – Another explanation from How Stuff Works.

Adafruit SSD1306 Library – The Adafruit SSD1306 OLED library on GitHub.

Adafruit GFX Library – Adafruit GFX graphics effects Library on GitHub.

Waveshare 1.5 inch OLED Wiki – The main Wiki page for the Waveshare 1.5 inch monochrome OLED module.

Adafruit AM2320 Library – The Adafruit AM2320 I2C Temperature and Humidity sensor library on GitHub.

 

 

 

 

Using OLED Displays with Arduino
Summary
Using OLED Displays with Arduino
Article Name
Using OLED Displays with Arduino
Description
OLED displays are bright, lightweight and easy to read in almost any lighting environment. In this article, you'll learn how OLEDs differ from regular LEDs and LCDs and how to use them with an Arduino. You will also learn to build a Temperature and Humidity Meter with an OLED display.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:     
Subscribe
Notify of

48 Comments
Oldest
Newest
Inline Feedbacks
View all comments
joze
5 years ago

Thank you for sharing with us this usefull informations.
I have suggestion for you to making a project that everyone needs in a home and this is 220v home energy meter that calculatets kw hours, with possibilyty to enter local electricity price and show costs on display.
No need to be very precize, but to get estimates cost per month..
Then it could be mounted on few household apliences.
There are few diy projects on the web, but I am wonder what whould be your way of doing this.
I also must say that I admire your work.
regards, Joze

Werner
4 years ago

Hi there, thank you for the excellent tutorial and perfect presentation. I try to load and run the complete sketch
but the Ardning IDE reports a ERROR in line 70 and prints: “a function-definition is not allowed here before ‘{‘ token ” and stops. I am running IDE Version 1.8.9 on WIN 10. Any suggestion what to change ?

regards Werner

Ron Kirby
4 years ago
Reply to  Werner

look at the SETUP it is entered twice need to edit it

Jan
4 years ago

u8g2 has great support for the 1.5″ OLED display.

The graphics library U8g2 won’t run on an Uno as it needs more memory for its page or frame buffers. It runs fine on a mega though.

The U8x8 text only library works great on an Uno. The constructor I used is:
U8X8_SSD1327_EA_W128128_4W_HW_SPI u8x8( /* cs=*/ 10, /* dc=*/ 7, /* reset=*/ 8);

Thanks for all the information for provide.

Kunal
4 years ago

Thanks for sharing. Do you have any SPI module to hook up NHD-2.7-12864WDW3-M-ND with Arduino uno? Thanks

Paul Dunphy
4 years ago

Again a great video. I would have liked a bit more on how to send data to the Waveshare 1.5 inch, similar to you showed with the 64 Line I2C. The Waveshare demo sketch indeed does eat memory, as you say. I will figure it out. I want to use it to send temperature and humidity data from an AM2320 sensor. I’m also going to try to add the HC-SR04 ultrasonic sensor data from the Elegoo Smart Robot Car Kit. Have the distances it figures out with the collision avoidance along with the temperature and humidity displayed on the Waveshare… Read more »

Eric Duke
4 years ago

do you happen to know how i could apply this project with the DHT11 temp humidity switch?
Thats what came with my elegoo kit but it only has 3 pins

Henk Barkhof
4 years ago

As output on the OLED display , all I got is :
DroneBot Workshop
Humidity: nan %
Temperature: nan C

???

4 years ago

My .96″ oled clearly said the address was 0x78. But, it is 0x3C as explained in this tutorial and video.

William McLean
3 years ago
Reply to  Steve Aldrich

Hi Steve,

I had the exact same problem, changed my address to 0x7b as per the back of the display…nada nothing, I came across your comment and thought mmm same address I wonder, tried it and it worked first time, many thanks for posting this wee tip.

Bill

4 years ago

Hii I interface the OLED ( I2C IIC serial OLED Module) display to node MCU it was working but confused about how to print the data in particular place in OLED screen to display the IP_Adress on OLED screen please give solution to display wifi status on OLED Screen
http://bigbelectronics.in/product.php?product=i2c-iic-serial-oled-lcd-led-module-0-96-inch-yellow-blue-12864-128×64-arduino-display-51-msp420-stim32-scr

Georg Berthelsen
4 years ago

Thanks for a nice tutorial on OLED, but a significant section is missing! How do I replace the 0.96 inch OLED display with a different size and controller? There are a great deal of sketches that are only written for the 0.96 inch OLED display, but how can I replace this display with e.g. and 1.5 inch 128×128 SSD 1327 display? * Is it necessary to write a new sketch? * If the same sketch can be used, where should it be corrected and with what values? * You can use the “Display Temperature and Humidity in the OLED Display… Read more »

Suraj
4 years ago

Thank you sir for this greatful explanation. Sir can you tell me how to dusplay the date and time on oled using android phone

David Wreski
4 years ago

I have looked everywhere where I can find out what SWITCHCAPVCC is.!
I have now idea what this is and what it means. Can you explain?
Dave

MarkNZ
4 years ago

error: expected ‘}’ at end of input

Just pointing out an error in the code.

I see others have come across this too.

The setup() has been defined twice:

// Define object am2320
Adafruit_AM2320 am2320 = Adafruit_AM2320();

void setup() {
// Start Wire library for I2C
Wire.begin();
void setup() { <———– DELETE THIS LINE TO GET THE CODE TO COMPILE

// initialize OLED with I2C addr 0x3C

natnael
3 years ago
Reply to  MarkNZ

ma man

Mo
2 years ago
Reply to  MarkNZ

Thanks!

Troy D Yanda
3 years ago

Does anyone know how I would do a multi message ? Such as a message appear on the screen for a few seconds and then clear the screen and have another message appear (as you would do on an LCD screen). I tried putting a delay in and then clearing the screen with the ,display.clear Display command then create another message but it will only display one message.

Jim Small
3 years ago

Hi Bill,
Thank you for all your most informative tutorials on Arduino it is os nice to be able to follow clear and concise instructions and be able to load a code that actually works.
Kind regards
Jim
Southport, England UK

Rick Neal
3 years ago

Could you direct me to where you found the commands for the OLED program. When I ran your program it printed the first two lines and then printed @ 00,20 the first two lines again.?? I never see the temp and most all the time it prints as confedi.?? I was just able to figure that out as it does different things. Reloading the gfx and display files don’t help.
Rick

Mike
3 years ago

I discovered you on YouTube and just want to say thank you for all the wonderful information you present in such a clear and concise way!

John
3 years ago

I have a .96” 128 x 64 ole display. I believe I have done everything you did here, yet mine will dont display anything. I have tried several different Arduino as well as several different displays. im not sure what ive dont wrong

Alan T
3 years ago

The error is at line 31 to 33

Sagar
3 years ago

Not Samsung it is lg which started oled display from 2013

Diego
3 years ago

Hi! On the display.setTextColor(WHITE); you can also write BLACK so the pixels of anything you draw will be turned off, it’s useful to “erase” something to write something else

Andrea Anderson
3 years ago

You have setup() twice – this is an error that is causing support posts on the Arduino forum. Can you correct this please.

Ross Lemons
3 years ago

The sample sketch for the AM2320 project has an extra “void setup() {” statement just below the wire.begin; statement. Otherwise it works beautifully.
Thank you for all your excellent and detailed tutorials.

Graham
3 years ago

Hi, thank you for your hard work….my efforts on displaying the Temp and humid on the oled 128×32 have failed so far. I’m fine with obtaining results via serial monitor, and displaying the adafruit demo, but unable to get the display of temp and humid results sorted out. There’s obviously a huge gap in my understanding of creating objects, I’d appreciate guidance on where to begin my search for an answer.
Graham

Bob
3 years ago

Excellent vids thanks.
You have two void setups in this download code screwing it up though, took me ages to find it, don’t need that **** when trying to learn!

Andy
3 years ago

Hi, on the oled sketch for temperature and humidity, I would like to use DHT 11 so what would the wiring be and also what part of the code for AM2320 would be changed. Many Thanks Andy.

Andy
3 years ago

Hi, I think your tutorials are great they explain everything and I use your codes as I am not good at writing or under standing them, but I love doing projects, how ever I am having trouble with the Temperature and Humidity code it is telling me it cant load it, can you please help, this is the code I am using. Many Thanks Andy. // Include Wire Library for I2C #include <Wire.h>   // Include Adafruit Graphics & OLED libraries #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h>   // Include Adafruit AM2320 Temp Humid Library #include <Adafruit_AM2320.h>   // Reset pin not… Read more »

Josh
2 years ago

Hi, thanks for the tutorial on how to set up the demo clock for Waveshare OLED Display along with the coding. I was wondering if you have the coding for how to connect the Waveshare OLED Display to an Arduino Uno and a HALJIA US-025 Ultrasonic Wave Detector Ranging Module 2.54mm 4Pin, please. 

Admax
2 years ago

What is the solution for file not found problem

Gilbert Naramor
2 years ago

Your videos are always very enlightening and helpful. I consider them a great resource. Please keep up the good work. 

Carlos Q
2 years ago

Although I used a DHT11, the code was inspirational to use this sensor. I always seen the temperature display in C and not Fahrenheit. The coding for displaying in Micro python is a lot easier than C++. I would love to see the code for this sometime.

Tedbear
2 years ago

Bill mentions using two displays with the same address “This could be a good technique to use when you need a display on the front and back of an enclosure for your project.” I did this with my “batcher” project last year. I used two identical I2C large 7 segment displays from Adafruit. One facing the front and one facing the rear of my enclosure. The batcher is used to make batches of product for my farm sprayer. The mixture is pumped through a commercial flow meter which uses a Hall effect device to “short the signal line to ground”… Read more »

Charles H. Griswold III
2 years ago

First, I love Dronebot. It’s my go-to place when I want an introduction to something new. Fabulous. Secondly, I had no luck at all with the Waveshare demo. It failed to compile in the Arduino 1.8 or RC IDE. What did work smoothly was the AdaFruit SSD1327 library example. I am using an ESP32 Wroom. At the top of the example code are #defines for pin settings. Mine are: #define OLED_CLK 18 #define OLED_MOSI 23 refered to as DIN on the module #define OLED_CS 17 #define OLED_DC 16 Waveshare says this is not used with SPI Also there are two Adafruit_SSD1327 objects, one for SPI and one for… Read more »

OMER
2 years ago

There is an error in this:
 // initialize OLED with I2C addr 0x3C
 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

Claude
1 year ago

I must say that all of your projects have worked for me, which is encouraging. I am retired now but I used to work in Toronto as an electronic technician, programming and coding is new to me but hey who says that at 87 one cannot learn anymore. Please continue to produce excellent teaching, I depend on you OK?

James Moroz
1 year ago

Thanks for your extensive and helpful haisory and technical explanation of the OLED. There is a contradiction in the wiring diagram between your diagram above and the comment on line 31 of the example sketch “ssd1306_128X64_i2c” from Adafruit.

You have: SCL to A4 Audrino, SCA to A5 Audrino. (does not work)
The example code has: SCA to A4 Audrino, SCL to A5 Audrino. (this works)

Thanks
Jim

Tan PS
1 year ago

Hi, Great video and explanation and examples on how to use the devices and libraries. Its great that we can use your programs as templates to modify and build our projects but I am dependent on available examples. I would like to be able to move away from reliance on available code so that in event examples are not available, I would still be able to write my functions as well as debug compilation errors that may crop up due to syntax or incorrect variable types. Perhaps you can consider a video or series on how to get there. Several… Read more »

GURUPRASAD H
1 year ago

Sir, Thanx for creating a wonderful platform for sharing knowledge and giving us opportunity to learn, explore and keep updated with the open source initiative. Its like gifting us ” WINGS TO OUR IMAGINATION”. use of this knowledge has given wonderful result in most of the project implemented by me.

guard ineer
1 year ago

Grrreat videos, as always, Thank you!
I am using seeed oled library, & I need to change text/font size for the 128×64 OLED. I have tried your GFX and “display” approach but it does not work for me. How do I change text/font size on the Seeed Oled?
Thanks

Harry Kane
1 year ago

Hi Bill, I’m truly impressed by the sheer volume of wonderful material you continue to produce. I’m a retired aerospace engineer and for the latter part of my career I was mostly writing software, in C & C++, so when I saw these inexpensive Arduinos I had to play with them. Your site is a godsend as it’s tough to search out the datasheets and specifications for all these gadgets, displays and sensors. I got this OLED Temp/Humid working, but there’s a small typo.There appears to be an extra setup() { on line 35 with no closing brace. Easily fixed,… Read more »

Jan Suk
1 year ago

it keeps telling me that there was an error during compilation with the arduino uno board, but it should work

Ian
1 month ago

How can I display my Temp & Humidity only when I press a push button?
Thanks

Benny
1 month ago

Is there is a bug in the code? it seems that line #34 is duplication of line #31, and should be ignored, isn’t it?