Creative with code and LEGO


Bring your LEGO builds to life with the BBC micro:bit, a servo control board and geekservos. You can make a dancer, a merry-go-round, a no-bot, a fortune teller, a tickle bot, a monster that bites, a wobble bot, a basketball game and much more using your own collection of LEGO bricks and some extra pieces you may not have yet. You can also add some craft materials for some more fun.

This video features some cool builds made by kids (aged 8 to 11) during my fall 2023 micro:bit courses, called "Creative with code and LEGO". During my lessons kids could build and code their own designs. Each lesson they were given a prompt to work with, instructions on some simple mechanisms and some useful LEGO blocks. The only time that I gave them building instructions on paper was when we were building the pipe organ and the monster. Then I gave them building instructions to show them how to make the mechanisms used in these builds.





LEGO compatible servo motors

Elecfreaks offers LEGO compatible servos that can easily be attached to classic LEGO or to LEGO technic blocks that have holes for pins. These so called geekservos are small and don't use a lot of power. And they are durable and not very expensive (less than 10 dollars/euros). I've used these servo motors during more than fifty workshops so far and they always work just fine. Never had any problem with them.

The servos have a short LEGO compatible axle to which you can connect a variaty of LEGO pieces with a hole for an axle. The only disavantage of the geekservos is that they don't always easily align with holes in your LEGO builds, a problem that you don't have with official LEGO motors. But in most builds this isn't a problem. Furthermore, geekservos are easier to connect to classic LEGO than official LEGO motors when you need the turning axle to point upwards. By the way, don't expect to be able to make robots that drive at high speed with servo motors. But for fun and creative robots their turning speed is high enough.

There are two types of geekservos. You have a LEGO compatible continuous servo that you can code to turn forward or backward with a specific speed between 15 and 100 percent of the maximum speed that the batteries allow. And you have a 270 degrees position servo that you can set to a specific angle between 0 and 270 degrees.

More information can be found at Elecfreak's website:

https://shop.elecfreaks.com/products/elecfreaks-9g-360-degrees-building-blocks-servo

https://shop.elecfreaks.com/products/elecfreaks-9g-270-degrees-building-blocks-servo





Simple servo control board

Kitronik's Simple servo board for the micro:bit offers an easy way to power and code the geekservos. You can connect three servo motors at a time. The availability of separate pins makes connecting them easy and it allows you to still use pin O, 1 and 2 and the GND pin for other purposes, like attaching conductive tape to check whether a circuit is closed or not. So pin 0, 1 or 2 can be used to add external buttons to your projects or make something move when someone closes the circuit between the GND and one of the other pins with their finger.

Unfortunately you can't use rechargeable batteries in the Simple servo board, because three rechargeable AA batteries provide too little power for the geekservos to function well. So you need disposable batteries. But you don't have to renew those very often because the servos don't use a lot of power.

Kitronik offers a MakeCode extension with custom coding blocks for their Simple servo board. You can add this extension to MakeCode by typing kitronik-simple-servo in the extension search field.


Extension for 270 degrees servo

I made my own version of the official extension with help from someone at Kitronik. In my version the default position servo is a 270 degrees servo. In the regular extension this is a 180 degrees position servo. You need to copy one of these links and add it to the extension search field in MakeCode to add my version of the servo custom blocks:

English: https://github.com/TeacherPinky/Lego-servoblocks-English

Dutch: https://github.com/TeacherPinky/Blokken-Legomotor

This video shows you how to add the custom blocks and gives you some example code. Be aware that the position servo doesn't give feedback on the moment that it has reached the coded position. This means that you have to add a pause block to allow the servo to have enough time to reach the angle you coded.




More information about the Simple servo board of Kitronik can be found here:

https://kitronik.co.uk/products/5673-kitronik-simple-servo-control-board-for-bbc-micro-bit


Extra

When you make LEGO robots or LEGO switches that use conductive tape, my wait until extension for MakeCode, inspired by Scratch, can be very useful too.

Furthermore, I recommend using woven conductive tape from Pimoroni, because you can easily stick it down to LEGO and removing it is easy too.










Protractor template

Brown Dog Gadgets offers a very nice protractor template for the position servos that can be used when making no-bots for example:

learn.browndoggadgets.com/Document/DuYaXEFxRbXXqhw3/Protractor-Template.pdf.

This video shows no-bots made by kids who used the protractor. You can see it on the table... No-bots offer a fun introduction to 270 degrees geekservos, because kids can just look at the protractor around the "neck" of their robot to find out to which angles the servo motor needs to turn to make the robot say no by shaking its head.




If you don't have a lot of LEGO or you don't have the time to sort LEGO, you can also make no-bots with one LEGO brick and craft materials, like you can see in this video:





LEGO bricks

These are LEGO bricks that can be connected with the turning axle on the geekservos:

















These are LEGO pieces that can be used to connect the geekservos itself to classic LEGO (white and green piece) or LEGO Technic pieces (black pin):













If you want to buy these LEGO pieces, you could try finding a BrickLink seller in your area. Here you can find separate pieces for an affordable price. But it can be a bit time consuming to find a seller that offers all the bricks that you need, because not every seller has the same collection of bricks for sale. Sellers are people who part out sets to sell the pieces individually.

If you prefer buying a few sets I recommend the replacement set for LEGO Spike Essential, which offers some nice LEGO bricks to tinker with together with geekservos. The creative monsters set is a nice addition to your LEGO collection when you want to make good looking funny robots with teeth, eyes and so on. The personal learning kit for Spike Essential is a set that gives you some more LEGO Technic bricks in fun colours.

If you want to make a robot car, the personal learning kit for Spike Prime is a good set. You could also consider buying the BricQ Prime personal learning kit for some more technical pieces, wheels and two heavy blocks that can be handy to stabilize builds with moving parts.



More examples

Here are some more examples of what you can do with LEGO and the micro:bit.

Many more examples can be found on my YouTube channel and Twitter/X account.

Promotion video for my lesson series





Tickle bots (inspired by paper tickle bots made by Jasmine Florentine - www.jasmineflorentine.com/paper-robots)




Simple drawing machine

In this video I also added some screenshots of the code you can use. Kids can start simple, just turning on the motor and turning it off after 5 seconds. They can also make the motor change directions for a different type of drawing (I made a small mistake, this code example is missing the stop block). Furthermore kids can add coding blocks for icons on the micro:bit display and add sound blocks to their code.





Micro:bit basketball games (no servo motors needed)





Lip-sync robots made out of paper towel rolls, using a positions servo to move the mouth.

Inspired by this tweet of Mountain Makers and this YT video of Moving Toys Workshop.
Another example, featuring Donald Duck, can be found here.



Wobble bots







Robot made with the Wukong board of Elecfreaks that can control 8 servo motors





Coding emojis






Fortune teller with crystal ball (text in Dutch), inspired by the answer bot in this tweet by Kathy Ceceri.





My booth at the Maker Faire Delft 2023





Last but not least: I recommend checking out the Twitter accounts of Cecilia Hillway who makes all kinds of cardboard robots with the micro:bit. Her students also make cool stuff. And checking out the work of Pauline Maas, writer of the Invent to learn guide to the micro:bit, is also highly recommended.



























This blog post is written by Martine Segers. I hope it inspires you to tinker with the micro:bit yourself. If you have any questions or remarks, you can reach out to me via PinkyPepper.scratch at gmail.com.