A Hackaday Fubarino Contest Entry

When Hackaday announced their Fubarino contest I was intrigued. The idea of the contest is to insert an Easter Egg into a microcontroller project that, when activated, will display the Hackaday URL. While I think most of us are familiar with devices whose functionality can be changed by cutting a trace, removing a component, or via software, I was surprised that it had never occurred to me to insert an Easter Egg into one of my own projects.

Unfortunately, I didn’t decide to put an entry together until about 2 weeks before the contest deadline so rather than starting from scratch I decided to modify an existing project, the SparkFun AVR Oscilloscope Clock.

What is the Oscilloscope Clock ?

The AVR Oscilloscope Clock is a dual programmable signal generator that uses the X-Y channels on an analog oscilloscope to display an analog clock. Time can be displayed in a variety of formats, which can be configured using on-screen menus or via commands over a serial connection.

It occurred to me that Hackaday.com has exactly 12 characters so I decided to modify the clock’s source code to replace the dial’s characters with HACKADAY.COM. To obfuscate the modification, I decided it would only be available if the clock was displaying Roman numerals and would be triggered via an undocumented command only made available through the serial interface.

Creating A New Clock Face

Source code for the Oscilloscope clock is available through the Sparkfun project page. Download it and unzip to a convenient place.

The various clock faces (and other displayed items) are contained in the file vecttable.inc and are defined according to the following rules.

  1. Each clock face consists of multiple lines of text, with each line corresponding to a character used to represent a digit 1 – 12.
  2. Displayed characters are defined by a series of X-Y coordinates that serve as endpoints for drawing lines on the oscilloscope screen.
  3. Screen coordinates range from 1-254 in the X/Y directions but individual displayed characters are confined to a 20×20 box centered at the character location.
  4. Each text line is terminated by 0X00. If a character requires more than one one continuous line for display, the X-Y coordinate pairs for each individual line are separated by 0X00.
  5. The final line describing the clock face is terminated by 0XFF, 0X00.

For an example open the vecttable.inc file in an editor and scroll down the the array DialDigits12[]. The definition of the characters used to display HACKADAY.COM are displayed below.

byte DialDigitsHackaday[] PROGMEM = {
    172, 229, 172, 209,   0, 172, 219, 182, 219,   0, 182, 229, 182, 209,   0,   0,
    211, 171, 211, 181, 216, 191, 221, 181, 221, 171,   0, 211, 181, 221, 181,   0,
    234, 138, 224, 138, 224, 118, 234, 118,   0,   0,
    211,  66, 211,  86,   0, 221,  86, 211,  76, 221,  76, 221,  66,   0,
    172,  34, 172,  44, 177,  54, 182,  44, 182,  34,   0, 172,  44, 182,  44,   0,                
    123,  20, 123,  40, 130,  40, 133,  37, 133,  23, 130,  20, 123,  20,   0,   0,
     73,  34,  73,  44,  78,  54,  83,  44,  83,  34,   0,  73,  44,  83,  44,   0,
     43,  66,  43,  76,   0,  38,  86,  43,  76,  48,  86,   0,
     18, 128,  18, 132,  22, 132,  22, 128,  18, 128,   0,   0,
     48, 191,  38, 191,  38, 171,  48, 171,   0,   0,
     73, 212,  73, 226,  76, 229, 80,  229,  83, 226,  83, 212,  80, 209,  76, 209,  73, 212,   0,   0,
    123, 223, 123, 243, 128, 233, 133, 243, 133, 223, 255,   0

To make these custom characters available in the software, include these lines in the vecttable.inc file and add the array name (DialDigitsHackaday) to the list of DialDigits… arrays in ClkData.h.

Inserting The Command

Commands available from the Oscilloscope Clock serial interface are defined in the file ClkCmd.c. I inserted the command to toggle the Easter Egg in the list of OtherCommands. This required adding a unique letter designator (“E”) to the OtherCommands[] array and the name of the associated function (ToggleEasterEgg()) to the CmdOtherMapping[] array, and then writing the code to display the Easter Egg.

To track whether or not the Easter Egg should be displayed, a global flag (easterEggEnabled) was defined and initialized to FALSE. Upon reception of the defined command, the value of flag is changed from FALSE to TRUE (or vice-versa) and the existing routine SetDialDisplay() called to update the display.

int easterEggEnabled = FALSE;
BOOL ToggleEasterEgg(void)
    easterEggEnabled = !easterEggEnabled;
    return TRUE;    

The routine SetDialDisplay() was modified slightly so if Roman numerals are being displayed and the easterEggEnabled flag is set, the Roman numerals are replaced by the custom HACKADAY.COM characters. The applicable code snippet is shown below.

    } else if (v == DIALROMAN) {
        //set Roman Numerals Display
        // JAC = Use the Hackaday font if easter egg is enabled.
        if (!easterEggEnabled)
            CurrDial12DigitsPtr = DialDigitsRoman;  //Current Dial Digits Display
            CurrDial24DigitsPtr = DialDigitsRoman;  //Current 24 Hours Dial Digits Display
            CurrDial12DigitsPtr = DialDigitsHackaday;
            CurrDial24DigitsPtr = DialDigitsHackaday;
    } else {

Bringing It All Together

Once the code has been compiled and loaded into the Oscilloscope Clock (instructions for updating the firmware are available at the Dutchtronix website), the Easter Egg can be activated by connected a serial cable to the clock to access its serial interface, then issuing the commands:

xf2 (changes display to Roman numerals)
xe (new command to activate the Easter Egg and display the custom Hackaday dial characters)

Unfortunately (or fortunately, depending upon your point of view) I don’t have the equipment to put together a video showing activation of the Easter Egg but a couple of screen shots showing the clock displaying Roman numerals and the custom HACKADAY.COM dial face are shown below.

Roman Numbers

Custom HACKADAY Display

While working to get the Easter Egg working was interesting, even more interesting was the internal debate on what form it should take and how it should be activated. Now that the idea’s been planted, I think this is something I’ll definitely be including as part of future projects.

DuWayne's Place

Computers, Electronics, and Amateur Radio from KC3XM

QRP HomeBuilder - QRPHB -

Computers, Electronics, and Amateur Radio from KC3XM

Open Emitter

Computers, Electronics, and Amateur Radio from KC3XM

Ripples in the Ether

Emanations from Amateur Radio Station NT7S

m0xpd's 'Shack Nasties'

Computers, Electronics, and Amateur Radio from KC3XM

%d bloggers like this: