Sunday, 29 September 2013

OLED 1602 Display and library for the SSD1311

Following on from the last post, the OLED 2 line 16 character display arrived from Hong Kong.

The display uses I2C to connect to the host and will work at 3.3 or 5V so is ideal to use with an Arduino board.

The supplier WIDE.HK supplies some sample code to get it running in the form of a QR code on the packaging that links to the the code and a couple of PDF datasheets.

The code uses a long winded method to initialise and write to the display, but it gets it working.

I have been thinking it was about time I learned how to create a library and this gave me the reason to give it a go, as well as not being able to find a library for this device anywhere on the web.

The very basic Library can be downloaded here, please remember this is my first attempt at creating a library, it works but I imagine it needs more functions adding before it becomes very useful.

Library updated 7/11/13 see here.

Here is the demo code I wrote using the library: -
Demo sketch to display text on the OLED 1602 display
from Wide.HK. This uses a Lbrary that I've put together
containing some basic functions.
The I2C Address is set to 0x3C in OLedI2C.cpp
Phil Grant 2013

Sketch updated to work with new library 7/11/13
#include  "Wire.h"    
#include  "OLedI2C.h"  
void setup()
void loop()
  //Set cursor position to col and row, top row is 0, first col is 0
  // no longer required LCD.cursPos(4,0); //(col,row)
  LCD.sendString("Gadjet's", 4, 0);    //("String", col, row)
  // no longer required LCD.cursPos(6,1); //Set cursor position to col and row 
  LCD.sendString("BLOG", 6, 1);   //("String", col, row)

As usual, feedback welcomed, use the comments if you found this library useful ...... or not.

Monday, 23 September 2013

Microduino OLED Display

Having read about the Microduino on Kickstarter I thought it looked familiar and tracked down where I'd seen it before, on a website unfortunately there seems to be a bit of a dispute between Hobbycomponents and the Microduino people so they aren't selling them any more.

They are offering you the chance to win one though because they've got loads of stock left.

Anyway I was lucky enough to get one of the OLED LCD displays before they stopped selling them, that's the reason for the post in the first place.

The display looked like a good display for a reasonable price and I liked the promise of really good contrast and low power consumption when compared to other non OLED illuminated displays.

The display uses I2C to communicate with the Arduino so not many pins required to drive it and I really like the fact that it has some good solid mounting holes on it, so many displays out there seem to forget this requirement.

The first thing I needed was a library to get it up and working and  tried a couple before I found one that worked, the library covers a vast number of LCD controllers and allows the use of loads of different fonts.

The library can be found here

The library does use a chunk of available flash memory but there's still some left over for your code but you might struggle if it's a huge application, I believe there are other libraries out there and they may use less resources.

Using the examples available and after adding the library you'll need to un-comment the line for this display relevant to your display, I used this one: -

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)

A modified version of the hello world example with a simulation of what the Chronograph display would look like can be downloaded here.

I really like the look of these OLED displays and I've found another one on ebay I like
It's an OLED version of the classic 1602 LCD, now I'm just waiting for the postman to get here from China!

Hot water control using a Raspberry Pi Zero W

Following on from the first blog about the hot water heating control here's what I put together for the mounting. Whilst looking for a...

Popular Posts