Cheap OLED Displays and Arduino > 아두이노

TODAY545 TOTAL33,807
사이트 이용안내
Login  ▼


BASIC4MCU | 아두이노 | Cheap OLED Displays and Arduino

페이지 정보

작성자 키트 작성일2017-09-13 15:38 조회174회 댓글0건




this message might be for you!

oledWe all like cheap items off eBay especially if they do cool and unusual things, sometimes we get so carried away by the price that we do not even realize that fact that we do not know anything about making the product work. A while back, I was browsing through eBay dreaming of all the stuff I can buy if I become rich. Then I came across something very interesting. A set of two OLED displays with a 1.3” screen size. Very small but should be good for some Arduino projects, right? After a quick skim over the description, I found a few words that said here is the link to the library… In no time, the OLEDs where sold.

Let us talk a little more about what OLED displays are and why anyone would consider using them in their projects. OLED stands for organic light emitting diode. On the microscopic level, an OLED display is a matrix of organic LEDs that light up when they emit energy. Old LCD (Liquid Crystal Display) technology uses electronically controlled polarizers to change the way light passes or does not pass through them. This requires an external backlight the lights up the whole display underneath. This uses a lot of energy because at the time the display is on, enough light for all pixels must be provided. The new OLED technology only uses electricity per pixel. Because each pixel creates its own light, only the pixels that are on use electricity. This makes OLED technology very efficient; also, the way these types of OLEDs are built allows them to be very thin compared to LCD. That is why all the new TVs that are coming out are super thin. There is more to OLED technology but “HowStuffWorks” does a good job at explaining all the fine details of OLED technology.

After waiting almost a month, I opened up the OLED and went right to testing it out. The link in the description pointed me to this website, which is a tutorial from Adafruit. Apparently, Adafruit also makes small OLEDs displays that are very similar to the ones I received. After going through the tutorial, adding the library, and setting up all connections, I load the Arduino example file and get something like this.

arduino oled

Very useless… however the image above shows a good example of the limitations of OLED displays because Of the way they’re built OLEDs have s slower refresh rate which is seen as darker lines on the OLED in the picture. At this point, I got very discouraged, set this OLED in my electronics box, and forgot about it. A few months past and I gained some interest in making this OLED work. Therefore, I started to do some research. I found a library that supports all sorts of displays for Arduino, and it supports Adafruit’s OLED. I loaded it up and got it to turn on, very exciting!

Here is what I did…

1. Connect the OLED as follows:

SCLpin 5
SDApin 4
RSTpin 3
D/Cpin 2
CSpin 10 (optional)

To add CS (chip select) you have to solder a wire to the back of the OLED where it says chip select.

2. Download the U8glib library from their website and place it into libraries folder of your Arduino.

3. Now here is the tricky part that will make your OLED work perfect:
– Go into the libraries folder
– Open U8glib library folder
– Now open Utility folder
– Scroll down till you find the file with the name “u8g_dev_ssd1306_128x64”
– There are actually two of them… One of them is bigger, open the BIGGER one. Right about line 186 you will see this:

<ol class="linenums" style="margin: 0px; padding-left: 27px; color: rgb(174, 174, 174);">
0x000, /* set lower 4 bit of the col adr to 0 */</ol>

Change it to this…

<ol class="linenums" style="margin: 0px; padding-left: 27px; color: rgb(174, 174, 174);">
0x002, /* set lower 4 bit of the col adr to 0 */</ol>

4. Open Arduino IDE
5. In examples under U8glib, you will see a “Hello World” example… Open it
6. Now if you look through the code you will see that in the beginning there is a lot of commented out code that allows the user to select what display they want to use. Right under all that add a new line and put this in. This tells the code how you connected your OLED.

<ol class="linenums" style="margin: 0px; padding-left: 27px; color: rgb(174, 174, 174);">
U8GLIB_SSD1306_128X64 u8g(5, 4, 10, 2, 3);</ol>

7. Click upload and you are all set.

arduino oled hello world

A so-called garbage OLED is not really garbage after all. The HelTec OLED that I got has 128×64 pixels, which is not much, but you can actually play chess on it. Just look through the examples in this library and find the cool things you can do with this small OLED that I got from eBay. It was actually quite hard to get it to work for the first time because information about making it work was found scattered around all over the internet; this small write-up combines it all in one simple to read tutorial. 

댓글 0

조회수 174

등록된 댓글이 없습니다.

아두이노 목록

게시물 검색

MCU BASIC ⓒ 2017