Construction Brick Scratch Interface Device

SID-Lego

Lego compatible Scratch Interface Device

I’ve been thinking about this for a while. It’s all very well having a battery pack connected to some motors and LEDs with Lego, but what about making it all controllable remotely from Scratch running on a laptop or desktop?

In previous articles, I’ve looked at using the Raspberry Pi and the Lego firmly next to each other, with a wireless keyboard and mouse and that oh-so-bulky monitor cable.

Then I figured out what the implications of “Scratch Interface Device” meant when I spotted it on CympleCy’s website.

Having bundled the Raspberry Pi into the case and added a set of LEDs and switches, it was a simple job to install SID and get working. The last four digits of the Raspberry Pi are used to identify it, and these must be entered on to the PC (Or Mac, if you have one). Once this is done, starting Scratch and enabling Remote Sensor Connections allows the laptop to control the Raspberry Pi without having the bulky connections. Now it’s possible to seriously integrate Lego and intelligent control.

ChristmasLights (4)

ScratchCPIO program to run the lighting

The whole setup now runs faster as the Scratch project runs on a PC, while the Raspberry Pi handles the GPIO control remotely. I haven’t yet tried all of the functions, but all those that I’ve tried have been supported. My PiBlox case has space for the Raspberry Pi camera, so running “Broadcast Photo” causes a photograph to be taken and stored on the Pi’s SD card. At the moment, it’s directed to /home/root/photos but maybe that’s something I’ve done wrong – ScratchGPIO running directly sends the files to /home/pi/photos which is a little more convenient (more later on why…).

Now… I could have stopped here, but inspiration has now kicked in. At the time of these early experiments, I was using an external battery pack and then…

…the Raspberry Pi Zero was released!

And the reason I’m now thinking of experimenting further?

Proposed Lego compatible Scratch Interface Device:

  • PiBlox case
  • Raspberry Pi Zero… when I can get hold of one.
  • WiFi dongle – perhaps a hacked and built-in version?
  • Li-Ion battery and 5v converter/charger
  • Connector setup to suit 0.1 connectors easily at the side of the case. Digital (and analogue?) Inputs, Motors and Servos.
  • Motor and GPIO controller (Explorer pHAT or maybe¬†PiRoCon v2¬†depending on the size)
  • Mini amplifier PCB and small speaker.

For now, here’s a video of some of the work in action.