This website was originally written in Ruby and hosted on the Raspberry Pi. It's now archived at GitHub for posterity!

Hobbytronics 1.8" Serial-TFT Board

Over the last few days I have been engrossed in tinkering with both the software to drive, and the Arduino-based firmware that lives on, the Hobbytronics Serial-TFT Board.

Following on from their great little Serial-VGA, the Serial-TFT board is a 1.8" TFT with an Arduino-compatible ATMega controller and can be used either stand-alone ( it has an ATMega 328 onboard ), with another Arduino, or can be mounted via a 26pin header right on top of your Raspberry Pi.

No matter how you use it, the Serial-TFT is always controlled using a simple, easy to implement Serial protocol with 14 commands ( or 15 in my modified version ).

Hobbytronics supply a digital clock example, but I quickly decided I could push the Serial-TFT further. This lead to an in-depth, often brute-force exploration of its capabilities, during which I pushed the poor little ATMega to its limits by thrashing it with circle drawing commands.

My project of choice was an analogue clock, which is a simple concept in theory but was actually quite tricky to implement on the Serial-TFT board. My eventual solution is far, far simpler than anything I tried while finding it, and basically involves redrawing all the clock hands on every tick, and drawing a line over ones that are no longer needed; ie when the second hand moves I first erase it with a line of the background colour, and then draw a new one in.

Re-drawing all three hands every second is the method that caused the fewest artefacts. As long as a hand isn't unecessarily erased, this doesn't cause any unwanted flicker.

I wasn't too keen on the default colours available on the Serial-TFT either, so I ripped out most of the colour handling code from the firmware and replaced it with an array. Currently I store 16 colours, all of which can be overwritten with new values using an additional command. This command is supported, and well documented, in my companion Python example code.

The Serial-TFT only supports 16-bit colours, but they're not an altogether bad representation of the 24-bit colours you'll likely use in most editor colour-schemes. Thus I have ported Solarized and whipped up a couple of themes of my own for good measure. To aid in your own porting, you can set new colours either as packed, 16-bit integers, RGB values or just a plain-ol string-based Hex colour like '#CC9966'

My modified firmware is available in GitHub:

The companion Python code can be found there too:

Next step; get tweets up and running on this thing!

« Back to index Posted on 2013-05-16 by