OLED Library

I would like to connect an I2C( SPI is also an option ) OLED to my Arduino 101. Can anyone suggest a component/library for the Arduino 101? If not, can anyone point me to a resource that would guide in the development of a driver?

I attached an i2c OLED and an i2c accelerometer to the Arduino 101 and ran the 12c scanner here:


and in each case neither was detected.

Both components work with an Arduino Uno without problem. I realize are using very different platforms here, but am looking for any advice on how to get these kind of devices with the 101.



Hi D&G,
the I2C scan feature is not working on 101 at the moment due to a missing feature of the firmware.
You can check if your i2c components are recognized using a modified I2C scanner sketch (attached). Note that it will perform a write() to the chip so don’t use it with i2C memories.
BTW, all I2C chips working with the UNO which libraries are based uniquely on Wire (so no AVR specific parts) will work just fine on 101 :slight_smile:

MultiSpeedI2CScanner.ino (6.26 KB)


Thank for the information and the arduino code. Both devices are shown connected to the arduino 101 with the scanner program you provided!

Here is a brief update on the OLED situation: I down loaded the u8glib library for Arduino - this is a "universal" display: https://github.com/olikraus/u8glib. It works great on with the uno, but when compiling an example program for the 101, the arduino ide states:

WARNING library U8glib claims to run on [ avr architecture (s) and may be incompatible with your current board which runs on sam] architecture(s)

So this library must not be pure i2c/Wire but have avr dependencies. I will look into to this further, and post here . . .any tips/hints, etc. would be greatly appreciated.


Found this nice tutorial on a Wire/i2c only code for OLED, oled_test sketch runs on the Arduino 101 connected to heltec 128X64 OLED 1st time without error.


Now I have to read the tutorials to find out how it works! :D


I was able to get a SainSmart SPI 0.96 OLED to work with the 101 using the Adafruit SSD1306 OLED library. I did have to go into the Adafruit_SSD1306.cpp and comment out the "if !defined" section at about line 27 so it does not try to include the AVR delay lib otherwise it will not compile. I suppose it might be better to add the appropriate ARDUINO_ARCH entry for the 101 but I got lazy.

One thing though, the demo in the Adafruit code runs very slow on the 101 vs. a Uno R3. Maybe I'm missing some clock setting or something but it does seem to work but very choppy.

Also, be sure to use the software SPI and not the hardware SPI settings in the code.

Here be a link to the Adafruit tut for the SSD1306 code. https://learn.adafruit.com/monochrome-oled-breakouts/arduino-library-and-examples



I have the I2C one from http://www.banggood.com/0_96-Inch-4Pin-White-IIC-I2C-OLED-Display-Module-12864-LED-For-Arduino-p-958196.html

I used the Adafruit SSD1306 and GFX library.

All of the platform specific incompatibilities in the SSD1306 library are in the SPI sections of the code so I just commented them out as I knew, for my purposes, I would not be executing them. Obviously I don't intend to push these changes upstream.

Note the I2C address might be 0x3C in Adafruit_SSD1306.h and "#define SSD1306_128_64" a bit further down.

Once that is done the Adafruit example ssd1306_128x64_i2c.ino worked fine.

I am getting about 7.3 frames/second when just outputting some simple debug.

I have previously used the U8glib on an Edison and Galileo. I intend to try this as well on the Arduino 101 to see which is faster.

Hello Jon and pkerney and thank you both for your answers!

We only needed to display a set of different bitmaps to the OLED in response to different test conditions, so I took the code I mentioned above and slighty modified and modularized it to perform this function and it works very well and smoothly. One caveat I would like to share for those wishing to translate a bitmaps to a data array and then cut paste into your code, the only utility I found that made usable arrays was LCD Assistant which only runs on windows. This may be unique to the use of the robotcantalk.blogspot code, but I am not sure. If I get some time to try the Adafruit or u8glib solutions you both mentinoed I will let everyone know.

One thing I noted about the adafruit library( and I belive u8glib) is that they use PROGMEM:

The PROGMEM keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "put this information into flash memory", instead of into SRAM, where it would normally go. from: https://www.arduino.cc/en/Reference/PROGMEM

This would seem to be specific to the AVR architeture, the 101 however has ample memory to handle bmps however( as an aside the 101 rocks! )

This would be commented out in the code with your code modifications, but it is used to store data in the font library, https://github.com/adafruit/Adafruit-GFX-Library/blob/master/glcdfont.c Have you had any problems with fonts? Had did your ide handle this?

Thanks again to you both,