01 Arduino How? DIYMall 0.96″ OLED

Date:  May 14, 2017

This is the DIYMall 0.96″ OLED.

It is a very small and cute OLED display I got from Amazon.

It can be used by Arduino, Raspberry Pi and any other micro-processor.


This quick tutorial is to teach you how to connect this OLED display to your Arduino.

This is the first thing to do in order to get my kids into Arduino programming.


Very small display with only 4 pins.


So, you hook up the OLED display like this.

OLED VCC pin to Arduino 3.3V (or 5V)

OLED GND pin to Arduino GND (Any of it)

OLED SCL pin to Arduino A5 analog pin

OLED SDA pin to Arduino A4 analog pin


Now, let’s search for a library to use.

Arduino has been around for many years.

So, the chances that there already have people wrote the codes to interface with this OLED display.  Or any display.

A library’s job is to make it easy for people to write codes, so that no matter what display you use, you might not have to change too much the code to port your program over.

Screen Shot 2017-05-13 at 6.44.04 PM.png

So, one of the correct library to use is U8glib.

Go to your Arduino Menu –> Sketch –> Include Library –> Manage Libraries to search and install the U8glib.

Then, go to Arduino Menu –> File –> Examples –> U8glib –> HelloWorld, select to load this program.

Screen Shot 2017-05-14 at 7.33.37 AM.png

This is the sample code to output “Hello World” onto the OLED display.

Now, before you can get this to work, you will need to select the correct OLED display Construct (a piece of code definition) to tell the program that you are using this DIYMall 0.96″ OLED.

Screen Shot 2017-05-14 at 7.35.21 AM.png

In order to make your program work, you have to select this by removing the “//” comment line.

Screen Shot 2017-05-14 at 7.39.38 AM.png

So, I removed all the junks, and left with this piece of code.  That is all you need to print Hello World.

Screen Shot 2017-05-14 at 7.43.30 AM.png

Now, very important.  Every library should come with some sort of documentation so to teach you how to use these wonderful functions.

Reference Manual:  https://github.com/olikraus/u8glib/wiki/userreference

Screen Shot 2017-05-14 at 7.46.07 AM.png

U8glib Wiki page:  https://github.com/olikraus/u8glib/wiki

This wiki page is useful too.  Now, you know why early I have a screen shot of library installed on my system, there is this u8g2 (new library to replace the U8glib).

Screen Shot 2017-05-14 at 7.47.30 AM.png

Of course you can still use the U8glib library.  But if you wish, you can use the new U8g2 library.  This is the code.

Wiki:  https://github.com/olikraus/u8g2/wiki

Reference Manual:  https://github.com/olikraus/u8g2/wiki/u8g2reference

Font Name:  https://github.com/olikraus/u8g2/wiki/fntlistall

Screen Shot 2017-05-14 at 7.51.48 AM.png

It is all about creativity.  See, I hooked up 3 screen to my Arduino UNO.  And surprisingly, all three screen lights up.  Wahahahahahaha

Today Arduino How lessons….

  1. How to connect a cheap OLED display to your Arduino.  Connecting the pins.
  2. Which library to use to interface with your cheap OLED display.
  3. Where to find the reference manual or wiki pages for your cheap OLED display.

Once you have done so, you can proceed to the next one.  Use your Arduino to “sense” the surrounding, accept either a digital or analog inputs, using all kinds of sensor.  For example, a button, a potentiometer, a temperature sensor, or even a light sensor.

So, why the display is important again?  Because, once you connect your sensor, you want to check anything, you just display it on the OLED display.  i.e. displaying the ON or OFF status of the button, displaying the temperature readings, etc.

Text Based Programming

Arduino requires you to write C programming codes.  To both Jay and Kay, it will be very tough.  But at some point, you will need to expose them to TEXT BASED programming language such as Python, or C- Programming or even Swift programming for IOS devices.  The Smart Nation world is not about Scratch programming or Mindstorms programming using drag and drop, etc.

Expose this as earlier as possible to the kids.  Don’t let them find out the hard way after they go to Secondary school.  It will kill their interest if they suddenly realise the fact that programming can be very hard.

Copy & Paste

For beginners, simply ask them to cut and paste the codes and troubleshoot to make it work.  Also teach them how and where to find information, such as the library.  Ask them cut and paste and copy the Example Codes you learned from the library reference manual.  If you are lucky, they will relate all these back to their Scratch or Mindstorm programming.

A Fun Game Project

Build a game together to teach them.

For example, a Pong game.


A working Pong Game is easy to build.  But learning how to build it step by step will be fun for the kids.

Welcome to the Smart Nation.





Leave a Reply