Hack: Customize the LED Shake-Stick Images

As I managed to construct the LED shake-stick kit just yesterday evening, I wasn’t entirely satisfied with its operation. For one, the images weren’t particularly inspiring. I mentioned that it should be possible to replace the images in the ROM without any understanding of the code, so I guess I should give that a go, right?

Designing a New Frame

image-sizePhotoshop was my editor of choice, so I decided to make a 64 x 16 pixel 1-bit-per-pixel image in it. I decided I should probably make something that is “uniquely” me, so I got out the text tool, did a little fiddling with font sizes and spacings until I ended up with this:

shakestick-hackIt uses the full height and full width, and just like the images extracted from the ROM, it is white where I want the LEDs to light and dark otherwise.

shakestick-hack

Because of the arrangement of the ROM itself, we need to rotate it so that it stands vertical, and invert the colours so that it’s black where we want the LEDs to light. This makes our work much easier.

bmp-save-settingsOne of the tricks is to save it as a .bmp file of 1-bit depth, this giving us a data format that is close to what we want. Opening the .bmp file in a hex editor …

bmp-data

… we need to pay attention to every second pair of bytes. The last pair of bytes appear to be padding, so is ignored, and quite a few bytes at the beginning is a header. Ultimately, we want 128-bytes, so I copy each byte from the end to the beginning into a new file. This is because a .bmp file scans bottom-to-top.

image-data-bytes

The required image data bytes are in the snippet above, which I saved as a separate .BIN file. I grabbed the original .bin file and pasted it over 0x6 so as to overwrite one of the frames with the new image data.

patched-shakestickbin

Then, I grabbed my MiniPro TL866CS and programmed the chip. Note that it’s quite an annoying process to pull the chip out and put it back in – do it wrong and you’ll break a leg!

program-backResult

I went down to the laundry, where I had no windows and closed doors so I could take a picture in the dark.

2016112211419467

Evidently, the little hack worked, and the text shows up as expected on a long-exposure photograph. However, looking at the stick in real-time, the short “flashes” of text aren’t easily perceived by the human eye and understood due to their transient nature. Simple shapes are probably best, or just having a few bold letters.

One notable observation was that the data on the final column is “held” at the end, as the program doesn’t write to both ports to turn off the LEDs on the sequence. As a result, really, you should only use 63 x 16 pixels, leaving the last 16 pixels off so that the LED stick doesn’t idle with all LEDs on.

Conclusion

As expected, it’s possible to replace the images without knowing anything about the program provided you meet the format requirements and have the equipment to reprogram the chip. There are some caveats – the program does have some unexpected behaviour sometimes even as supplied, and swapping the images doesn’t change this (but could make it worse). The last “column” of data is “held” after each activation, so having the final column as all zeros is advisable, otherwise the stick idles with all LEDs activated. Complex patterns and text is not advisable, as persistence of vision isn’t long enough to let the brain fully perceive and understand the pattern, but is acceptable if using the stick for light-painting.

About lui_gough

I'm a bit of a nut for electronics, computing, photography, radio, satellite and other technical hobbies. Click for more about me!
This entry was posted in Computing, Electronics and tagged , , , , , , . Bookmark the permalink.

Error: Comment is Missing!