Category Archives: Electronics

AnyDisplay: Unified library for graphical displays

OK, I admit it.  I have a weakness for displays.  Most of the projects that I’ve got in the hopper include some sort of graphical display.  While the ubiquitous LCD character display may be inexpensive, I find them to be terribly limiting and, frankly, kind of boring.

Since delving into microcontroller development I’ve managed to get my hands on a pretty decent collection of graphical displays.  I’m currently rather obsessed with the new(ish) MemoryLCD displays from Sharp; look for a subsequent post detailing how to work with these.

One of my frustrations with the current state of graphical displays in the microcontroller realm is the lack of consistency and uniformity in terms of libraries.  Switching displays is a painful proposition; if you are lucky you may find an existing library for the display as a starting point.  The library may or may not be functional, will undoubtably be incomplete, and will most likely have a completely different API than what you are used to.    The GLCD project makes an attempt at supporting several displays, but I’m not fond of the API and adding support for new displays is rather difficult.  Some vendors such as Adafruit do take the time to build simple display libraries for the displays that they sell, but they tend to lack uniformity between displays.

I’ve spent a good deal of time researching and prototyping solutions and have designed a new unified library for graphical displays.  Called AnyDisplay, this library will provide a single, consistent API for integrating graphical displays with Microcontroller projects.  The library consists of a well-fleshed out, well tested API for graphics primitives which is consistent across all displays.  Adding support for new devices requires developing a small driver for device-specific implementations.

Ultimately, this will allow you to easily add cool graphical displays to your projects.  Focus on the product that you are trying to build rather than spending so much time dealing with low-level details.  The consistent API will make experimenting with new displays a much simpler proposition.

Serial Backpack for Avago HDLx-2416 Using Teensy

I purchased an Avago HDLS-2416 display from eBay a while back for my refrigerator monitor project (Fridge Squid FTW!).  This is a really nice compact 4-character 5×7 alphanumeric display, extremely bright and readable.

Unfortunately it was the wrong part; the 2416 is a parallel display, requiring 16 pins for normal operation.  What I *should* have ordered was a HCMx-29xx display, which is a serial device that already has Arduino support (check out the library on the PJRC site).

Last week while researching batch PCB creation on the dorkboxpdx site I stumbled across an interesting post by Ward Cunningham (yes, THAT Ward Cunningham).  In this blog post Ward describes how the 2416 is a near-perfect fit for the Teensy USB development board, a tiny AVR-based board from PJRC.  While Ward’s post focuses on using Txtzyme via the USB port to drive the display, it got me thinking about how to turn this display into a simple serial device that wouldn’t use up all of the ports on my Arduino.

I already had a couple of Teensy boards in my collection from my initial Arduino purchasing frenzy; I picked them up before I discovered the [amazon_link id=”B004G4XVKC” target=”_blank” container=”” container_class=”” ]Arduino FIO[/amazon_link], which is a much better fit for my wireless sensor project.  Sure enough, the 2416 display fits the Teensy like a glove, almost like they were made for each other.  I initially thought that I’d mount the display using low-profile female headers; soldered the headers on the board, plugged in the display, and…nothing.  Turns out that the pins on the Avago display are far too fine to make reliable contact with the female header that I had installed.  Oops.

I’ve gotten pretty good at soldering over the last couple of months, but desoldering? Not so much.  Removing the female headers took some doing, but eventually I got them removed and soldered the display directly to the Teensy.  Plugged everything in, uploaded Txtzyme to my Teensy and ran Ward’s yow! Perl script.  Very close – alpha characters worked fine, but no numerics or punctuation.  A bit of debugging and I found the problem.  In my haste to remove the female headers I had accidentally pulled the solder pad from one of the Teensy’s pins; a quick jumper to another digital pin, quick change to the perl script, and everything was right with the world again.

I spent some time banging out a simple bit of code to run on the Teensy, and will post the library up on my GitHub account once I’m happy with it.

This could be a nice solution if you wanted to include a HDLx-2416 or similar but were running out of digital outputs on your microcontroller.  This solution provides display integration with a single serial pin, rather than the five required for the serial HCMx-29xx serial display.

Edit: 7/24/2011: Found a source on EBay selling a bunch of these for a very reasonable price ($12.50); check out the auction here.