Pixel Editor for Arduino OLED I2C Display

I’ve been working with Arduinos. I love it and highly recommend them to anyone interested in electronics/micro controllers. In my first post on this site, well over a year ago, I detailed the pain of getting a AVR Controller to run. The second post should have explained how I loaded my first program to it, but I never managed it, despite trying for dozens of hours over a few weeks, partly with the guidance of my electrical engineer father-in-law.

A similar guide to getting started with an Arduino would not warrant a post at all. It would read: Go download a FTDI driver, install the Arduino IDE, connect by USB.

It’s beautiful, and I’ve had lots of fun with it. I’ll absolutely be posting more soon.

An interesting aspect of extra hardware to use with the Arduino is the pin requirement – i.e., how many cables to you have to run from the Arduino to the hardware to make it do useful things? There’s a fascinatingly wide range. An IR remote might work with just one dedicated pin (and two cables for power), a VGA camera I have uses 18 pins. I’ve also got two displays – one uses almost all of the ~15pins, while the other uses two (+two for power). To be fair, one has 18bit color, while the other has… one bit. Nonetheless, the latter is far easier to work with for a quick build.

Breadboard with Arduino and OLED Monochrome Montitor

The exact pin configurations and required libraries will almost certainly be different on your display, so let’s not go into detail. Rather, let’s look at a little tool I made for it: A bitmap pixel editor.

The Adafruit libraries for use with displays support easy text rendering, shape drawing and drawing a bitmap. The latter is achieved with the help of an array of chars, where each bit defines whether a pixel is black or white. They also provide a tool for creating bitmaps from images: Img2Code. Unfortunately, you need to download it, run it with java and create the image file somewhere else. Let’s cut out some middlemen here and build a pixel editor.

[Intense Coding happens off-screen]

Like this:

See the Pen Pixel Editor for Arduino OLED Display by Kjeld Schmidt (@KjeldSchmidt) on CodePen.0

There’s really not a lot to say that isn’t explained in the code comments. It becomes to small when working above 64×64 pixels and a bit slow to generate the text at around 32×32. Other than that, I believe it works quite nicely. I’ll definitely be using it when building games or animations. I hope some of you will find it useful.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.