Inspired by Dan Aldred‘s LEGO Clock hacks (http://www.tecoed.co.uk/darth-beats.html and http://www.tecoed.co.uk/yoda-tweets.html) I picked up a broken Batman clock from eBay for some hacking shenanigans. I had several aims, based on the great work of Dan before me
- Add a Pimoroni Scroll pHAT HD, which would allow both text and graphics to be displayed
- Attempt to retain the existing button board
- See if the on board piezo was usable
- Light the white eyes behind the cowl
The first problem was dismantling it. While the join of the front and the back halves of the shell are easy to get into, breaking the glued fixings on the inside requires a fair amount of brute force and ignorance. Thankfully I have an abundance of both 🙂
Once I had gained access to the internals I checked the piezo buzzer. A quick test with a Micro:bit confirmed it was passive and could be driven with PWM signals to provide different musical notes. I use the term “musical” loosely.
Now on to the build. Using pinout.xyz to identify which pins the Scroll pHAT HD used this was wired to the pi zero with a section of ribbon cable. The buttons and the piezo are all wired to the pi zero as well (piezo on GPIO18 as that’s a PWM channel). I also added a micro USB breakout board from Adafruit. The existing battery connectors have been removed from the shell and the breakout fits perfectly at one end. The battery cover will have a notch cut out to allow a micro USB connection. The breakout is soldered directly to a 5v pin on the pi zero.
The last challenge was the lights in the head. Unfortunately the eyes are painted on and the plastic is pink. This does funky things to the lights so the colours are basically red, white or shades of pink between; not what I needed. Back to the work bench for some careful drilling. The lights used are 5mm PL9823 which are a form of smart pixels (i.e. WS2812/neopixles). Lesson learnt here: You cannot chain them for power (i.e. wire in series). They must both be wired to 3v and Gnd directly. Oh yeah, and while they’re meant to work at 5v they’re happy at 3v.
Holy Birthday Cake
My son was having his 8th birthday party around the time I finished the build. His birthday cake was LEGO Batman themed (made by my very talented wife), so we added the hacked clock alongside it. It was coded with two party pieces.
- Press a button on the back and it plays the start to the (original TV series) theme tune
- Press the head down and it “sings” happy birthday to him
Here’s the video of it in action
My work here is done. Added the happy birthday for eldest's party tomorrow.
— Carl Monk (@ForToffee) July 27, 2018
….and the cake
— Carl Monk (@ForToffee) July 28, 2018
I now have Batman running on my desk as a clock. I know this is basically the same thing as its original design but this is waaaaaay cooler. Hands up, I borrowed the clock code from the Pimoroni example. In addition I added some code to connect to the Cheerlights API so the eyes change colour at the whim of the internet. But the internet is fickle, so I added code to randomly pick a colour when the head is pressed.
The source for all this magic? On my Github of course https://github.com/ForToffee/LEGO-Clock
- Yellow Scroll pHAT HD – Pimoroni
- Diffuser – Pimoroni
- Micro USB Breakout – Adafruit
- Raspberry Pi Zero
- 2x PL9823 5mm RGB LED – eBay via China
Yes, all the titles are taken from the “Holy….” phrases that Robin used in the TV series, c/o Wikipedia