Tutorial on I2C OLED Display with Arduino/NodeMCU

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

That is one of the most interesting and different accents I have ever heard :) Is it indian/Australian?

šŸ‘ļøŽ︎ 9 šŸ‘¤ļøŽ︎ u/this_is_not_nil šŸ“…ļøŽ︎ Jul 31 2018 šŸ—«︎ replies

This is well timed. I'll be having a play with my NodeMCU to hookup one of my OLED displays to it this weekend.

šŸ‘ļøŽ︎ 3 šŸ‘¤ļøŽ︎ u/thebrazengeek šŸ“…ļøŽ︎ Jul 31 2018 šŸ—«︎ replies

Thank you very much for that tutorial, really well made and fun to watch!

šŸ‘ļøŽ︎ 3 šŸ‘¤ļøŽ︎ u/thegundalf šŸ“…ļøŽ︎ Jul 31 2018 šŸ—«︎ replies

Cool video. I picked up a random display but haven't messed with it. I looks to be a dual SPI/I2C display though and wasn't exactly sure how to make it I2C and had many other projects ahead of it. Any ideas on what needs to be changed and/or wiring on it to do i2c?

Mine is like this: 0.96" White 0.96 Inch OLED Module 128X64 OLED LCD LED Display Module For Arduino IIC I2C Communicate DC 3V-5V SPI Serial Module http://s.aliexpress.com/VRFjiEnA

šŸ‘ļøŽ︎ 2 šŸ‘¤ļøŽ︎ u/digiblur šŸ“…ļøŽ︎ Aug 01 2018 šŸ—«︎ replies

Well done. Clear and good pace. Enjoyed that

šŸ‘ļøŽ︎ 2 šŸ‘¤ļøŽ︎ u/MKme_Lab šŸ“…ļøŽ︎ Aug 03 2018 šŸ—«︎ replies
Captions
the very first program you write when you start learning a new programming language is hello world the program itself does nothing more than printing a hello world text on the screen so how do we get our Arduino to display hello world in this video I'll be showing you how to get started with the small 0.91 128 by 32 and 0.96 128 by 64 I to see OLED display there are hundreds of tutorial on the web explaining the same thing in different ways but I couldn't find one that tells me all about OLED display and how to use them in different scenarios it took me some time to work it all out so I thought I should create a tutorial on what I have learned and combine all the features and ways the OLED displays can be used in our projects [Music] in this video we'll be talking about what is an oled display then we'll have a closer look at the 0.9 one 128 by 32 and 0.96 128 by 64 I - C or LED displays next we'll talk about installing the Adafruit library to our Arduino IDE then we connect node MCU and Arduino to an OLED display next we'll have a closer look at the code and display some text and graphics on it we'll also talk about applying custom fonts and displaying images then we'll connect multiple or LEDs to a microcontroller using I to see multiplexer and finally we'll talk about three common errors people make while using the OLED displays for this tutorial we need a breadboard a zero point nine one 128 by 32 and a 0.96 128 by 64 I to see all it display Arduino Uno nano whatever is handy note MCU TC a 954 8a I do see multiplexer few connecting cables and a USB cable to upload the code oyel ad or organic light-emitting diode is a light emitting diode in which the emissive electroluminescent layer is a film of organic compound which consists of millions of small LED lights that emits light in response to electric current or LEDs are used to create digital displays in devices such as television screens computer monitors portable systems such as mobile phone handheld gaming consoles and PDAs and OLED display works without a backlight because it emits visible light there are many types of OLED displays available in the market based on their size color brand protocol spi or i2c passive matrix or active matrix and many more in this tutorial I'm going to talk about connecting 0.91 128 by 32 and 0.96 128 by 64 I to C or LED display to an arduino nano and no MCU I to see bus technologies there's only two pins of the MCU so we have heaps available for other sensors let's have a closer look at these two displays at the back of this displays there are heaps of SMD capacitors and resistors soldered on the board but since it's an i2c device we only care about these two pins the display connects to Arduino using only four wires two for power VCC and ground and two for data serial clock and serial data making the wiring very simple the data connection is i2 C and the interface is also called two-wire interface the on-board pins can be in different order so always triple check before hooking it up to your project operational voltage is between three volt to five volts but it is best to use the guidance from the manufacturers data sheet sometimes we need to use two displays in our project so how can we achieve this the trick is to have configurable address on the display this unit has configurable address between hex 78 and hex 7a just by unsoldering the zero ohm resistor from one side and hooking it up to the other side or just by putting a global sold out we can change that dress we'll talk about it in depth when we hook up multiple displays to an Arduino in the later section of this tutorial in pictures these displays look very big but practically speaking they're tiny they're made of 128 by 32 or 64 individual OLED pixels and do not require a backlight just have a look at this and see how small it is even though they are very small they can be very useful in an electronic project there are several libraries available to control this displays in past abuse the u8g lib library but I find the Adafruit library very easy to understand and use in our projects so I'm going to use the Adafruit library in this tutorial to control the OLED displays you need the adafruit gfx dot H and the Adafruit SSD one 3:06 dot h library there are two ways you can download and install the library to your arduino ide method one go to the library manager and search for Adafruit underscore SST 1 3 0 6 and Adafruit underscore GFX select the latest version and hit the install button once installed you can use the libraries in your program method to these two libraries can also be downloaded from github I'll provide the links in the description below once downloaded copy the Adafruit underscore s sd1 3:06 - master folder from the downloaded zip file into the arduino libraries folder this folder is usually found at documents Arduino libraries on windows system on Linux it's usually found at the home folder arduino libraries finally in the arduino library folder rename the Adafruit underscore SST 1 3 0 6 - master folder to Adafruit underscore SST 1 3 0 6 even if you don't rename that's fine now let's have a look at the Adafruit underscore SSD one 3:06 dot H file 2 things we need to know in this library 1 if you want to use the smaller display use the default 128 underscore 32 otherwise for bigger display comment the 128 underscore 32 and uncomment the 128 underscore 64 pretty self-explanatory number 2 if you have soldered the hex 7a address on the board which we'll talk about later then use the 7 bit hex 3d address for the bigger displays otherwise use the default hex 3c address for the smaller displays the address is hex 3c let's start by connecting the node MCO to the display the first and the most important thing to note is that some of the display may have the ground and VCC power pins swapped around check your display to make sure that it is in the same order as in the image if the pins are swapped make sure to change the connections to the Arduino or node MCO now connect the VCC to three volts ground to ground slc to d1 of nor MCU and sta to d2 in case of Audrina connect the VCC to 5 volts ground to ground f CL 2a v SDA to a for now if you are using an Arduino mega use pin 21 for SC l and 24 SDA Adafruit library comes with really good examples for both 128 by 32 and Holly and 28 by 64 display the library is located on the file examples Adafruit SSD 1 3 0 6 and then the display type we're going to use the honey and 28 by 32 I to see example and we'll modify it to work with both honey and 28 by 64 and 128 by 32 displays first by hooking it up to an Arduino and then to an O times u board the code starts by including both the Adafruit libraries in this tutorial I'm going to stress on only those parts of the code which are necessary for us to load on both boards and displays if you want to know more about the code please drop a comment on my blog or in the comments section below and I'll endeavor to get back to you first we are going to load the code to an arduino nano connected to a hundred and twenty eight by 32 display we can use the code as is without making any modifications honey and 28 by 32 uses hex 3 c address so this bit looks all good here let's double check the header file yes it is also using the hex 3 c address and the display type is hundred and twenty eight by 32 now let's connect the honey and 28 by 64 display as we know it uses the hex 3c address by default so we don't need to update the address in either the code or the library we just need to comment the honey and 28 underscore 32 and uncomment the honey and 28 underscore 64 in the header library and change the LCD height to 64 in our code now to run the same code on an old MCU we need to change one more line in our code the hash define our LED underscore reset for will change to hash define our LED underscore reset LED underscore built in rest of the code is same as what we saw in Arduino pretty much to display anything we need to first clear out the previous screen then we need to draw the object show it on the hardware then we need to wait for some time before displaying the next item in this example we are displaying few items like text line circles scrolling text triangles and more go ahead and use your imagination and display whatever you want on this tiny displays sometimes your code need to display custom forms and images if you are very good in bit mapping then you just need to create a byte array but turning on or off the tiny leds of the display to create a custom font or an image however I'm not very good in doing these mappings and don't want to spend hours creating the bitmap tables so what are my options I'd only use two websites to generate custom fonts and images the links are provided in the description below go to the font converter website select the font family style size library version as adafruit gfx font and then hit the create button on the right hand side of the page you can see how your font is gonna look like on the actual display based on your selection the web page generates the fonts header file create a file called modified underscore font dot H in the same folder where your code is and copy and save the generated code into it then you just need to include this header file in your code to use the phone to use the font in your code you just need to add display dot set font with the name of the font in your code you can get the name of the font from the header file you just added to your project that's it easy memory is always a concern while using custom fonts so always can see that the bytes that will be consumed by the memory just remember at uno has only 32k of memory to display a bitmap image on your screen you first need to create a hundred and twenty eight by 64 or 32 sized image I'm using the good old MS paint to create a hundred and twenty eight by sixty-four bitmap image which I'll then upload to this image convert a website the website converts the image into byte string which can be used with the Arduino and OLED display start by uploading the image to the website then put a check on the invert image color checkbox and change the output code format to add we know code next select the orientation and hit the generate code button the preview section shows you how your image will look like on the actual display I have included the code with this tutorial which you can use to display your image you just need to replace the byte array in my code with the one you just generated and then load it to your Arduino connecting 228 by 64 displays to your project is easy you just need to on solder the zero ohm resistor from the hex 78 address and put it on the hex 7 a and then use the hex 3d address in your code instead of the hex 3c you must be wondering why we are using the hex 3c and hex 3d addresses and not the actual hex 7a and 78 addresses adrenal accepts seven bit address and not the egg bit hardware dresses so we first need to convert the 8-bit address to binary and then chop off the least significant bit to get the seven bit address then convert the 7 bit to hex to get the hex 3c or hex 3d addresses which you then enter in your code we first need to initialize the display by giving it a unique name then in your code use the display 1 and display 2 to call the begin statement with the device addresses in them that's it you can now go ahead and do whatever you want using the display 1 or display 2 in the rest of the code I have provided an example with this tutorial which you can use for your reference Waring is exactly the same as what we have done before pretty much you just need to add another display to the same i2c pin of either the Arduino or the note MCU based on their dresses the microcontroller then sends the data on to the i2c tarah line now what if you want to hook up more than to displace to your project arduino has limited number of pins and hence you cannot have more than a certain amount of shields attached to it moreover it has only one pair of i2c buses so how can we attach more than 2 I 2 C displays to an Arduino the trick is to use a TC a 95 48 multiplexer TC a 9 5 4 it allows a single microcontroller to communicate with up to 64 sensors all with the same or different I to C addresses by assigning a unique channel to each sensor slave sub us when we talk about sending data over two wires to multiple devices we then need a way to address them it's same as the postman coming on a single Road and dropping the mail packets to different houses because they have different addresses written on them connect V in to 5 volt ground to ground SEL to i2c clock and SDA to i2c data line then why are the or LEDs to V in ground and use one of the SCL and SDA multiplexed buses the channels are selected by sending the TC a 95 48 it's I to see address followed by the channel number you could have at the max eight of these multiplexers connected together on hex 72 hex 77 addresses in order to control 64 of the same R to C address parts by connecting the three address bits a 0 a 1 and a 2 to V in you can get different combination of addresses I'll explain this in depth in my next tutorial on TC a 95 48 breakout board for now let's just hook up a to--let's to this board and have a quick look at the code and the code let's start by including the wire library and by defining the multiplexes addresses then we need to select the port we want to communicate to and send the data on it using this function next we will initialize the display in the setup section by calling the USG dot begin function for each display attached to the marks once initialized we can then do whatever we want just by calling the function TC s select where I is the value of the multiplexed bus and then sending the data and clock accordingly advantages include all it displays don't need a backlight displays are very thin and lightweight they consume low power viewing angle are wider than LCDs brightness and contrast are great they're high-speed and have low response time and they have a deep black color the image of an OLED display is beautiful Hiva OLED displays also have disadvantages because all its screen contains organic material their lifespan is shorter than LCD displays additionally many OLED displays get burnings after showing the same image for a long time after a burnin the image stays on the screen even after showing another image water can instantly damage the organic material of these displays to conclude this tutorial let's talk about few common errors people make while using this displays always triple-check the pins before using it in your project pick up the right library address in the header file and in your code if that dress is wrong that oullette will not display anything the display size must be changed in the driver before it can be used in your project if it's not changed you'll get an error message when attempting to verify the code if using node MC you make sure you replace the oil ad underscore reset from 4 to LED underscore built-in I have seen people making all sorts of crazy things using this OLED displays some have even made video games and all I'm really not interested in making a video game using this tiny display however I will now leave you to explore your imaginations and come out with amazing ideas thanks again for watching this video I hope it helps you if you want to support me you can subscribe to my channel and watch my other videos thanks see you again in my next video bye now
Info
Channel: Crazy Couple
Views: 247,282
Rating: undefined out of 5
Keywords: 0.96 oled arduino, 0.91 oled arduino, Arduino Tutorial: OLED 0.96, u8glib, ssd1306, Arduino Tutorial graphics for displays SSD1306, I2C Display, i2c displays 0.96 inch, adafruit ssd1306, Two Equal Displays on One Arduino I2C Bus, tca9548, Adafruit library, ss1306, oled ss1306, 128x64 i2c oled, arduino i2c oled, arduino ssd1306, 128x32 OLED, 128x64 OLED, IĀ²C, Inter-Integrated Circuit, TCA9548A I2C multiplexer, connecting more than two oled, multiple oled
Id: _e_0HJY0uIo
Channel Id: undefined
Length: 16min 46sec (1006 seconds)
Published: Mon Jul 30 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.