I recently helped fund a Kickstarter project for an Organic LED (OLED) display and breakout board. This was design and built by ILSoft, an electronics and software company based in Tyne and Wear, UK.
I had been interested in using an OLED display for some time, as they have a good contrast ratio and quite a good resolution. This makes them good for viewing small details in different light conditions (potentially where an LCD might not be suitable).
This board recently arrived in the post and I wanted to check it out and get it up and running. This is a post on my first very basic tests getting the display to work with an Arduino.
I downloaded the example code from ILSoft GITHUB pages. These were uploaded into my Libraires folder within my Sketchbook.
When the Arduino IDE was opened up I had access to their example code. I uploaded one of the AVR examples for Arduino and connected up the following connections (its obvious now, but I needed to realise that the SDI and SCK go to the equivalent pins on the Arduino….):
|OLED Board Pin||Arduino Pin|
This worked to give me the example outputs which looked pretty, but were pretty basic.
I wrote a quick test routine which drew random lines in random colours (check the end of the post for the code). This shows off the capability of the screen pretty well, although it looks like a mess after a minute or so.
Here are some photos:
Drawing random lines within a 128 x 128 display with each line as a random colour.
Eventually its a mess – but fun.
The resolution of the display is great – its has good contrast and you can read really small text with ease. This means you can display a load of information in a very small space. I am planning on building a photovoltaic IV curve tracer which will have this a s a display. Look out for more posts about it…
Here is is Arduino code. You need to download and install to your libraries folder the OLED library from ILSoft for this to run.
By Matt Little
This is a simple testing routine to draw a whole load of random lines on the OLED board from ILSoft.
Please see www.re-innovation.co.uk for more details.
Based upon the:
Colour OLED Breakout Board Library
Copyright (c) 2013, ILSoft Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// The Arduino Shield from ILSoft uses pins 8, 9 and 7 for CS, DC and Reset.
#define CS 8
#define DC 9
#define RESET 7
// Create a variable to hold our OLED class.
// Instantiate the class with the pins.
oled = new SSD1351(CS, DC, RESET);
// Clear the screen.
randomSeed(analogRead(0)); // Initialise a random number seed
// Draw the screen.
// Draw a line between two points with the colour Red.
oled->drawLine(Point(random(128), random(128)), Point(random(128), random(128)), Colour(random(255),random(255),random(255)));
draw(); // Draw a random line within 128 x 128
delay(500); // wait a bit