Introduction: Tilting LEGO Maze With Micro:bit
It's no secret the LEGO is awesome, and there's nothing we love more than adding some fun electronics to our LEGO kits to make them even more awesome. Our LEGO maze has knobs on two of the sides to allow you to tilt the top half and maneuver a ball through the maze from start to finish. You can design your own mazes (it's LEGO!) so you can make them as easy or difficult as you wish.
Let's add some electronics! We'll be using a micro:bit along with a (LEGO compatible) Bit Board. We're going to plug a small thumbstick controller into the Bit Board so it can control the movement of two servos to tilt the maze in the X and Y axes.
Brown Dog Gadgets does in fact sell kits and supplies, but you don't need to buy anything from us to make this project. Though if you do it does help support us in creating new projects and teacher resources.
- 1 x Crazy Circuits Bit Board Kit
- 1 x micro:bit
- 2 x LEGO Compatible 270 Degree Servo
- 1 x Thumbstick
- 4 x Jumper Wires
We just need a few parts to attach our servos to the LEGO baseplates and a gear to mesh with the tilt knobs. Besides that a few plain bricks and baseplates are used. We have provided links to each part on BrickOwl but you can find them anywhere LEGO or LEGO-compatible parts are sold.
Step 1: Acquire / Assemble Maze
We've got one of the mazes from JK Brickworks and thought it would be fun to motorize the tilting mechanism and make it controllable by a two-axis thumbstick.
The kit isn't available from LEGO anymore but you can find used ones, or build your own maze using the concepts from this version.
Step 2: Add LEGO Plates
The stock maze is controlled by hand. You hold and rotate the two wheels on the sides and the maze tilts to move the ball through it.
We added a LEGO baseplate to each side where a wheel is located so we could attach our LEGO-compatible servo motors.
The servo motor has a LEGO Gear with 16 Teeth attached to it that meshes with the gear teeth on the outside of the wheel. When our servo turns, it turns the wheel and tilts the table.
We removed a few of the flat LEGO pieces on the side and added some bricks to connect our baseplate. (Alternately you could attach the maze and baseplates to a larger baseplate on the bottom, or a flat surface with some tape, etc.)
Step 3: Add Bit Board
Add the Bit Board to your project. You'll want it positioned between the two servos so the wires can reach to plug in the servo motors.
We just stuck ours down to the LEGO baseplate with a few thin LEGO bricks.
We're only going to use the pin headers to connect things for this project so we don't need to worry about the LEGO-compatible pin holes on the Bit Board.
Step 4: Add Servos
Once you have your LEGO baseplate in place you can add your servos.
We used the following parts to attach each servo:
- 1 x LEGO Axle 4 (3705)
- 2 x LEGO Technic Brick 1 x 2 with Axle Hole
You may find that the servos rocks a bit when turning the gear, so it can be helpful to build up more LEGO bricks around the attachment points of the servo to add stability.
Step 5: Connect Servos
Plug the Y Servo connector into the Pin 14 row. The orange wire goes into Pin 0, the red wire into the + (positive) column, and the brown wire into the - (negative) column.
Plug the X Servo connector into the Pin 13 row. The orange wire goes into Pin 0, the red wire into the + (positive) column, and the brown wire into the - (negative) column.
Remember!You will need to add an external battery pack to power the servos. The battery pack can power the servos as well as the micro:bit so once you are done programming the micro:bit you can unplug the USB cable.
Step 6: Connect Thumbstick
Using Jumper Wires start by plugging the Thumbstick VRY Pin into Pin 1 on the Bit Board.
Next, plug the Thumbstick VRX Pin into Pin 0 on the Bit Board.
Then plug the Thumbstick +5V Pin into the + (positive) column.
And finally, plug the Thumbstick GND Pin into the - (negative) column.
Step 7: Add Battery
We're going to add a two AAA battery pack to the Bit Board to power the micro:bit and the servos.
While the USB cable can be used to program the micro:bit and to provide power for some low-power components (an LED or Piezo Speaker, etc.) it cannot power the servo motors we are using.
Step 8: Load the Code
Connect a USB cable to the micro:bit and then plug it into your computer.
We'll be using makecode.microbit.org to program our board. It uses a simple drag and drop block interface.
We're going to load the following code for our Maze Tilter program: https://makecode.microbit.org/_DXERvAVU3KCu
Once the code is loaded you can disconnect the USB cable and insert the micro:bit into the Bit Board so it can control the servos.
Step 9: Test It Out!
Now that you have your servos and thumbstick connected, your code loaded, and you've powered your Bit Board with a battery pack, you're ready for testing!
One thing you'll need to do is level the maze table and then make sure the servos are in the halfway position before meshing the gears together.
The code will set the servos at the halfway point when it starts, so you should always be starting with the table level when you power on the Bit Board.
The thumbstick springs back to the middle position when you release it, and we've set the code to allow for a little wiggle room so it won't move on its own.
We're ready to go! Can you get the ball from the start to the end of the maze? Can you do it faster than your friend?
Participated in the
Battery Powered Contest