Skip to content

Projects

#18 3D Labyrinth Project With micro:bit

by PicoBricks Team 30 May 2025

There are multiple ways to exit a maze, but the most well-known method is to follow the wall with your left/right hand. Although this method may take some time, you can definitely get out of the maze by consistently touching the wall. Maze tests enhance problem-solving skills. Someone who frequently solves maze tests can quickly come up with solutions to the problems they encounter. In this project, we will design a maze and the necessary mechanical parts to move the maze by using a 3D printer.

Let's create a maze project that can move in right, left, up, and down directions by assembling 3D printer parts as shown in the visuals. To ensure the movement of the maze in this project, we will utilize two servo motors connected to the PicoBricks motor driver. The direction keys on the PicoBricks Touch & Piano module will be used to move the servo motors in the desired direction. By using the Right, Left, Up, and Down direction keys, we will control the direction and attempt to navigate the ball placed inside the maze to the exit.

Connection Diagram:

You can prepare this project by breaking down PicoBricks modules at proper points.


Project Images:

 

The STL Files of The Project


You can access the STL files of the project by scanning the QR code or opening the link in
your browser.

 https://rbt.ist/thingiverse

MakeCode Code of The Project


Python Code of The Project:


#3D Labyrinth Project
from microbit import *
from picobricks import *

# Function Initialization
oled = SSD1306()
oled.init()
motor = motordriver()
apds = APDS9960()
apds.init_gesture_sensor()
pin15.set_pull(pin15.PULL_UP)
ir = IRM()

def labyrinth_image():
    display.show(Image('90090:'
                       '99990:'
                       '00099:'
                       '99999:'
                       '00009'))
labyrinth_image()
servo1Value=45
servo2Value=45

while True:
    gesture = apds.read_gesture()
    oled.clear()
    motor.servo(1,servo1Value)
    motor.servo(1,servo2Value)
    sleep(100)
    if gesture == "UP":
        servo1Value=servo1Value-1
        if servo1Value==15:
            servo1Value=16
    if gesture == "DOWN":
        servo1Value=servo1Value+1
        if servo1Value==58:
            servo1Value=57
    if gesture == "RIGHT":
        servo2Value=servo2Value+1
        if servo2Value==80:
            servo2Value=79
    if gesture == "LEFT":
        servo2Value=servo2Value-1
        if servo2Value==30:
            servo2Value=31
    oled.add_text(0,0,str(servo1Value))
    oled.add_text(0,1,str(servo2Value))
    if button_a.is_pressed():
        labyrinth_image()
        servo1Value=45
        servo2Value=45
    gesture=0


MicroBlocks Code of The Project

 

Prev Post
Next Post

Thanks for subscribing!

This email has been registered!

Shop the look
Choose Options

Picobricks
Sign Up for exclusive updates, new arrivals & insider only discounts

Edit Option

Back In Stock Notification

Compare

Product SKURatingDescription Collection Availability Product Type Other Details
this is just a warning
Login
Shopping Cart
0 items
Same Day Shipping No Extra Costs
Easy Returns Guarantee Return with Ease
Secure Checkout Secure Payment