Connect and use an OLED Display with Arduino using the SPI Bus - Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] all right hi again guys this is Ivan from Bernie b.com and today in this tutorial I'm going to show you how to connect and use this little OLED display that uses the SPI bus uh interface uh the SBI bus uses more connections than the uh i2c bus that we saw in another tutorial tutoral but the SPI bus has the advantage of being a lot faster so since this is a little graphic LCD uh you know to display bit Maps or um anything like that the speed is an advantage for us and in this project we're using five pins for the uh display and only one pin for the dht11 that you see right here that we saw in another tutorial also uh this little OLED display is about an inch wide and has a resolution of 128 by by 64 so it's good it's good enough for what we want to do today and these are really great oleds have the advantage of first of all being very bright and they have a wide Vie angle and also they almost use no power at all I think this guy full on is like 08 Watts or something so these guys are very well suited for any project that is running off batteries or something like that a portable project so what we're going to do today we're going to take the readings from the dht11 temperature and humidity and we're going to display these values on the display right here and also what we're going to do we're going to take a bit map that we're going to transform into exod decimal using a little program called LCD assistant that I'm going to show you and it'll put the little logo right here and put the temperature and the humidity on the side right there so connections uh we have five connections we need to do to the display first of all I'm taking the voltage and ground from the Uno putting it on the breadboard rail and then I'm using the rails to connect the power to both of the module so five connections going to the Uno at position 8 9 10 11 and 13 and our dht11 only needs one so we're putting that at a z as always if you want to get the diagram the schematics the code the library we used just go to our website and click on the tutorial Tab and you'll find all that information uh for this particular tutorials and find all the tutorials we've done uh recently now the one thing we need to um make sure is that we're going to use a library for this the library is called you of let me make sure uhg lib and this is a great library for any OLED that you might have the one we have right here uses the sdd 1306 uh chip so that will will be compatible with that Library so we'll take a look at that Library there's a lot of parameters that we can use uh we're going to use the um to put the text and the bit map but there's a lot more so you can find a link for that on our website also if you want to get more u in Dept so we're going to cut here first thing we're going to do we're going to fire up the LCD assistant software take the bit map convert it and then we'll go to main code copy that information so we can have the bitmat right here and see all the uh the code that we need to display the information so we'll cut here and we'll be right back with the results okay so here we are guys this is the little program we're going to use LCD assistant you can find a link on our website to download that so we're going to load the image that we created before and in Photoshop it's a bit map black and white so we're going to load that in and you see a picture preview there now the bite orientation uh we need horizontal because that's what the library is using uh the the size we don't need to modify it just make sure the size is not bigger than the actual LCD so here we're doing about 50x 5050 uh the rest of the settings are all okay so we're just going to go and go save output and then we're going to type in a name for the output file which is going to contain the exod decimal information that we're going to put in the main code so we're just going to name it brain X save that and then we're going to open that file and we're going to use wordpad for that and there it is so basically all it does it generates all the code to put the bit map on the screen so this uh what we're going to do we're going to copy all this information inside our main code so we're going to go to the main code screen and take a look at that right now all right so here we are in the main code as you can see we have the information that we got from the LCD assistant for a for a bit map right here so we're putting that into an array that we can use later to display on the OLED so we're defining the array here to put all the X information now also the first thing we're going to do we're include two libr ques one is for the OLED display and the other one is for the dht11 sensor so you can find a download link for those files on our website once you have them just extract it to your library folder there's the first one and the DHT once you've done that just restart your ID software and we're good to go so we're going to define the pin that our sensor is connected to that's a z then we're going to do our library so here's the OLED library and these are the pins that the uh OLED is connected to on our Uno in sequence then we have the information of the bit map and then we do the draw function so basically start with drawing the bit map as position x76 y5 this uh the six is for the width and the height the width is multiplied by 8 that's why it's six so it's close to 50 we're at 48 and then we choose a font that we have that is available in the library then we draw at 030 we're going to put temperature column and then at 050 a little bit lower we're going to put yum column then we're going to set the print position at 4430 and that's going to put our cursor right after the temperature column space so we can put the DHT temperature reading right there by calling that zero is because we don't want any decimal uh numbers and then at 6030 right after we get that we're going to put the C for Celsius after temperature that humidity there and then we do the same thing for the humidity so we put our cursor after that we get the humidity value and then we put the cursor a little bit later and we draw the string percentage and then we have our main Loop which basically calls reads the uh sensor pin to get the information and then we do the function at the end we do a delay of 5 Seconds because the sensor shouldn't be accessed more than once every 2 seconds so that's it so that's the uh whole code that we're going to use so we're going to upload that and go back to our breadboard and look at the results so let's go take a look all right so we're back to our breadboard we already uploaded code to the Uno right here and I'm going to plug it in and we should see the results uh appearing on our our little display so here we go and there you are so we're putting the burning bits logo that we transform with the LCD assistant in exod decimal and then we're putting temperature humidity getting the values from the dht11 and putting Cel uh Celsius and the percentage sign now you might see some scan lines on the video but that's due to the camera because what I'm looking at it is very bright and very clear and that's because 12 8X 64 pixels on a 1in display makes it that the pixel density is very high on these guys and they look very good so if you want to build something like this we sell all the parts on our website brb.com and if you go to the tutorial page for this particular project you'll find the link for the library the sketch more information and also you'll uh find more tutorials that we've done so once again I'm Ivan and I want to thank you guys for watching and I hope to catch you guys later take [Music] care
Info
Channel: Brainy-Bits
Views: 81,675
Rating: undefined out of 5
Keywords: Arduino (Brand), OLED, DHT11, Tutorial, UNO, 128x64
Id: 7Kli1DgHZc8
Channel Id: undefined
Length: 9min 11sec (551 seconds)
Published: Sat Feb 14 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.