Tuesday, May 19, 2015


My oldest son is almost seven years old. Seven is right about when I got my first Atari 800XL and learned to program. Today's kids have much cooler choices for computers. Personally, I think that the ability for programs to interact with the physical world makes a huge difference in motivation.
I recently backed up a Kickstarter campaign for the Espruino Pico. While being "yet another" small microcontroller-based board, this one has quite a neat software stack: it runs a JavaScript interpreter and exposes a very extensive JavaScript API for controlling its I/O. I was thinking this would make a great tool for super-quick hacks that I sometimes need for testing purposes / one-off tooling. But quickly it dawned on me that this would be a perfect way to get my son into programming! The Espruino has an IDE that is a Chrome extension with Blockly support, allowing us to code without having to do much typing and without risking syntax errors (which is often a big source of frustration for beginners). I also found that it was fairly easy to add new blocks, so I quickly made a couple of useful ones (for example, there wasn't a stock block for controlling a servo).
And so we've been playing for a while, controlling the on-board LEDs with the on-board button, and later adding a servo motor. But blinking LEDs and moving a servo for their own sake gets boring after a while. Luckily, the tooth-fairy has kindly provided us with a kit of accessories which greatly extends the possibilities! Since my son loves Legos (who doesn't?), my idea was to allow him to embed the I/O devices in his creations. Not a new concept, but mine was totally DYI, taking only a few hours of work in my garage and costing next to nothing.
The kit I made (shhhhh, don't tell it was me!) contains:

  • A micro servo, fitted with 2x2 Lego bricks on the top and bottom with correct alignment and a 1x4 brick on the arm. I used Gorilla glue for attaching the bricks to the servo, then "cast" the thing in hot glue for extra strength and cleaner shape. For alignment, I built a Lego fixture that held everything in place while the glue dries. For the casting, I found a cool trick you can do with hot glue: I pressed the workpiece with the molten glue against a piece of parchment paper placed on the desk. Once cool, the hot glue easily separates from the parchment paper, resulting in a really clean, flat surface.
  • A selection of LEDs. I found that the "technic" lego pieces have holes that are the perfect size for a 5mm LED. With a bit pressure it goes all the way in and will never come out. I made a set including: a double-LED (red, green) piece, an auto-color-changing LED piece and an RGB LED piece. I soldered the appropriate (for 3.3V) current-limiting resistors to the back of all LEDs to make hook-up simpler for my son.
  • Two push-buttons. It turns out those through-hole push-buttons fit perfectly between the bumps of a 2x2 piece, when placed diagonally. A dab of Gorilla glue, and we're done.
I'm really happy with the result and if it works out well I can easily add more pieces.
Here's what happens when you let dad play with the kids' toys...


  1. Ytai great post! Looking forward to re-implement some of the ideas you came up with the LEGOs and hacking the LEDs, servos and push-buttons onto them. Thanks for sharing.

  2. Would you be willing to make and sell kits of these bricks? I know quite a few people that would be interested...

    1. No, thanks. But the nice thing is that it's so easy that anyone can make them in an evening!

    2. No, thanks. But the nice thing is that it's so easy that anyone can make them in an evening!

    3. If you're interested, I'm working on a similar project which I am planning to sell in kits. The two main differences is that it does not involve microcontrollers, only more basic electronic components, and that each block has side connectors instead of wires (so that placing 2 blocks next to each other will create a connection between them). If you want more info, here is the Facebook page of the project: https://www.facebook.com/blockits (it is currently more up-to-date than the website)

  3. This brought back memories of my first Atari and I also remember an "electronic" game called Merlin. The Lego robotics give kids an opportunity to create and really dig in. When we discovered them for our son, it made me wish they were around when I was growing up.