The FreeDeck Brings Faster Shortcuts to Your Fingertips!

This OLED display shortcut keypad uses some clever hardware and firmware tricks to squeeze lots of performance out of inexpensive modules!

Tom Fleet
10 months agoHW101 – Deprecated

If the amount of time it takes for my window manager to open is an indicator of anything, it's that I'm pretty terrible for sticking to one task at a time!

Even with window grouping and desktop switching commands mapped to even simple keyboard shortcuts, I can sometimes loose my way through the stacks of windows of the numerous open programs.

I've often longed for a more defined way of dealing with swapping about my work space. Back in 2008, there was a keyboard that seemed to be an answer to my dreams.

The Optimus Prime, with its freely programmable OLED macro keys ticked all the boxes, but with every key on it's board tricked out with a miniature RGB OLED display, it was an eye-watering investment - too rich for my blood.

Then, a more sensible design started cropping up, often seen as a OCZ re-branded "Sabre" board.

This design rather sensibly left the OLED configurable displays to where they made sense — over on the side. Not many people need to swap their character set about, so a screen on every key is unnecessary. Reducing the color depth to monochrome helps further with cost optimization.

You're still stuck with the "stock" keyboard attached to the OLED keys though. So, finally, we see "num pad" style macro keyboards enter the market, with the Elgato Stream Deck emerging as a promising off the shelf solution.

However, makers are rarely ever going to settle with "off the shelf" however — and these days, we don't have to.

Cheap OLED displays are now commonplace on the various supplier listings, and for the less than the cost of a cup of coffee, you can have a few small displays shipped to your door, nicely mounted on a small breakout board.

These little displays can be purchased so cheaply as they are often found in small consumer gadgets. MP3 players were a popular place to spot one, and nowadays, most people sport a fitness tracker with such a screen.

The market is huge, as are the quantities of displays being produced, so it's now cheaper than ever to add graphical display capabilities to any embedded project, something that Kilian Gosewisch has very much taken on board, with the design of his Free Deck — a DIY Stream Deck alternative!

The Hardware

The build at first appears somewhat simplistic, with the major components plainly visible on the front of the perforated project board.

With an Arduino Pro Micro, and six 0.96" I2C OLED displays, you'd think this would be a matter of just pulling in a few stock libraries, and being done with it.

But, let's look a little more closely at things. There's got to be some trickery going on, and I say this, because those displays only have 4 pins, which is fine for one of a device, but perhaps not for 6 of the same. Why's this?

I2C Addressing

These display modules are based on the ever popular SSD1306 display controller. This controller is commonly found on a range of various OLED display modules, and provides a simple way to interface the array of pixel elements to whatever host controller is driving them. A quick google search throws up a world of possibilities!

A display controller simplifies things hugely for the host controller, and suppliers can simplify things further, by supplying the fragile OLED FPC assembly onto a breakout board for us!

Some of these modules can support the variety of serial interfaces the SSD1306 provides, and others, like the ones used here, are hardwired for SPI, or in this case, the I2C functions.

That's awfully convenient, we can take any of those, drop them into a 4-pin header, and be up and running in next to no time.

But, what if we want to use two of them? Well, it's I2C, so, we'd usually just change the pull-up/pull-down resistors that are used to configure the controller GPIO lines that are used to configure the I2C address to which the SSD1306 responds.

If we take a look at the datasheet, we can see that in addition to the two I2C bus I/O (SDA & SCL), the D/C# pin is also used to set the LSB of the I2C address!

Knowing this information, we can see two potential pitfalls when wanting to run multiple displays.

  • The ability to change only a single single bit of address allows us only two distinct I2C addresses for this controller on the same I2C bus.
  • Perhaps more of a stumbling block, is that the D/C# pin is rarely (if ever) bought out to the header of these I2C display modules, as can be seen below!

So, how has Gosewisch managed to coerce not just the two, which at first seems to the main challenge, but 6 displays onto his I2C bus?

The answer lies in the schematic, and while it maybe doesn't jump out at first, the solution to addressing these displays is tucked away in the form of a 74HC4051 multiplexer.

If you follow it through, you can see that while all displays share a common SCL signal, the SDA signal from the Arduino Pro Micro is routed through a set of 74HC4051 multiplexer ICs.

This is a trick that takes advantage of the fact that an I2C device will usually ignore traffic on the bus if there is either no clock present on the SCL pin, or, less commonly, the SDA pin.

I've used this trick before by gating the SCL line of the I2C bus, as I feel it's a little less likely to cause erroneous bus states, but I'm glad to see that the gating approach appears to work just as well for the SDA line, when using these display controllers — they certainly look like they perform flawlessly!

The Configurator

Perhaps one of the slickest parts of the FreeDeck project is its Configurator. Bravely hosted by Gosewisch on his own website, the FreeDeck provides a wonderfully simple interface to create and configure the tile sets and their actions.

Allowing you to create pages of buttons to fit your needs, the interface really is a dream to use. You can upload images which are automatically re-sampled to the screen resolution and bit depth. Gosewisch has some put some real work into this, and it shows.

Configurations are saved as a .bin file, which is places onto a SD card, to be read in by the Arduino sketch running on the Pro Micro, which also takes care of handling the commands mapped to each key.

The Arduino Pro Micro happens to be based around an ATmega32U4, which happens to support native USB connections, without needing a separate serial converter IC. This has the added provision of not only supporting USB CDC (for serial communication), but also means that is can support USB HID devices, making it perfect for this project, where it means that the FreeDeck turns up as a USB keyboard!

Looking at the video below, the I2C performance is impressive. The screen update across the entire array is quick and responsive, and it's fair to say a lot of the performance comes from the oled_turbo library, written by Larry Bank. Bank knows a thing or two about squeezing performance out of embedded systems, and his library releases are worth taking a look at!

This is a really slick project that manages to squeeze a huge amount of functionality out of some components, that without some clever hardware and firmware, might not have originally been up to task.

The configurator is really the icing on the cake, making this a well executed project from which to base your own HID device!

You can follow Gosewisch on Twitter here.

Tom Fleet
Hi, I'm Tom! I create content for Hackster News, allowing us to showcase your latest and greatest projects for the world to see!
Related articles
Sponsored articles
Related articles