Scratch -> Lego Mindstorms

A bit of hardware hacking for Troon Primary CodeClub, who have tons of old style Lego Mindstorms they don’t use any more, and after a year of Scratch programming on their PCs are just getting started with Raspberry Pi. We’re using this Scratch modification together with the hardware I’m making which is based on this circuit. The main thing here is an L293D Motor Controller IC which can drive 2 DC motors in both directions. You can write the hardware code in Scratch like this to control the lego motors:


The most tricky part in this whole endeavour has been physically connecting to Mindstorms. At the moment I’m having to use crocodile clips which won’t work long in normal classroom conditions – but I’m wary of destroying/modifying the connectors as they’re not made any more…


11 thoughts on “Scratch -> Lego Mindstorms”

  1. We’ve got a number of “broken” wire connectors in our Lego kits, maybe they can be repurposed? Probably lots on eBay too.

  2. Sounds good – should we join forces on this? I can build you a board to try out. How are you working with Mindstorms at the moment in Redruth?

  3. Great stuff 🙂 I’ve got quite a few of those motors in my schools so I’d be very interested in a good way of connecting them up as well


  4. Thanks for ScratchGPIO and your blog, which is proving very useful! I’m hoping this can be a way of making CodeClub a bit less screen based…

  5. This is all great stuff – thanks very much! I had a go at the tabs on the brick but was a bit scared of breaking them, the backing plate seemed stuck. It looks like they are more hackable than I’d feared, so I shall go ahead with more confidence 🙂

    It’s good that they have moved on to RJ12 though. At the school they also have yet another type of Lego connection with a more recent educational kit – I wish they would standardise.

  6. Yes, this term we’ve been trying out the old Dacta + RCX kits, not getting too far away from existing material – main problem has been lack of working batteries and slow firmware downloading because of RoboLab rather than command line. Next term, not sure, we may be back on Scratch, but Scratch & Lego sounds like a nice combination.

Leave a Reply

Your email address will not be published. Required fields are marked *