BlueMaze - Android Accelerometer Controlled Maze

Introduction: BlueMaze - Android Accelerometer Controlled Maze

About: unexpected

Hi have a nice day, this projectis an upgrade of my second instructable. It is a maze toy controlled using a custom app that sends the accelerometer values via bluetooth.

I used an esp32 as it have bluetooth integrated but you can use other board with a bluetooth module. I programed the esp32 using Arduino but you could use the esp-idf (I would really like to see that).

The Android app was made with MIT App inventor 2. As it is block coding it is really easy and useful. For the connections i made a custom PCB, But you can use a perfboard or breadboard.

The maze is made of cardboard and it's moved by two servos for each axis. The base is an MDF board with balsa sticks to suport the motors. It would be great to make it on a 3D printer and modular so you can change the maze as you can get bored of always solving the same.

Plese check all the pictures to follow the process, If you have any question, feel fee to ask.

Supplies

Esp32 Dev Board

x2 Servo Motors (sg90)

Android Device

Powerbank

MDF frame or board

x2 3 pins male connector (for the servos)

one good usb cable for the esp32 and an old one to supply power to the servos.

x2 smal screws

Balsa sticks (1*1cm)

Wooden stick (like the one for marshmallows)

Cardboard

Acrylic paint

Perfboard, protoboard or custom PCB

Wires

Aluminium foil (for making the balls)

TOOLS:

Scalpel

Screwdriver

Drill and 1/4 in wood bit

Hot glue gun (with hot glue)

Rule

Paint brush

Step 1: CONNECTIONS AND CODE

I etched a custom PCB for the connections but you can use a breadboard or perfboard for it. Check how i made the PCB on: https://www.instructables.com/Etch-Copper-Using-a-... I used terminal blocks to connect all the wires to the board and female headers for the esp32 (i cut an old usb cable to suply 5v to the motors).

Download the code and upload it on your ESP32 using the Arduino IDE (make sure to have the right drivers and add the board to the board manager, use a nice USB cable to upload the code as i had some issues). Please check the code, you can change the Bluetooth device name and change the servos ports and adjust them.

Connect your servos and power supply following the schematic, i used 3 pins male connector to extend the servo's cable with wires and covered it with heatshrink. i connected the servos motors to a different 5v port as if we take it from the esp32 we could damage it, i used a power bank with two usb outputs and both grounds are connected but i think in this case it is not necesary as it is from the same power bank but i designed the PCB like that.

If you are using a perfboard you can directly solder the wires following the connections.

Step 2: ANDROID APP

The android app was made with MIT app inventor 2, find the apk and .aia project on the rar file.

I started first on the designer part adding the necessary labels, a listpicker for the bluetooth devices, the accelerometer sensor, bluetooth client and clock. I added the background image and organized the texts and layout.

Then I made the block coding. First enabled the accelerometer sensor when the screen is initialized, Then added the bluetooth devices to the listpicker. When bluetooth device is selected (listpicker element), call bluetooth client and connect it to the selected device. When bluetooth is connected Then change a text to connected and its color to green. When the acceleration change set x and y values to two labels multipliying by 10.

We will send the data vía bluetooth using the timer of the clock, this is really important as I could not get this to work properly couse I sent the data when acceleration changed. You can set the timerinterval (the minimum is 30 ms). I decide to add 100 to the values, so I receive only positive values on my esp32.

Step 3: BUILD YOUR MAZE

I made the maze with a nice cardboard from an old box. i started by designing the maze on a squared sheet, mine is 16 * 20 cm and leaved 2cm gaps (my design is easy to solve, but you can make a better design).

I used the scalpel to carefully cut the cardboard, i started by cutting the rectangle of the maze (16*20cm) and its four edges. i cutted a lot of cardboard strips of 1,5cm for the walls, and two little strips of 2cm to help keep the space between the walls.

Cut each internal wall to the exact lenght following the design on the sheet. Once you have all the walls prepared, glue them on the cardboard rectangle using a little amount of hotglue, following your design and using the 2cm spacers to place the walls. Once you have your maze fully glued clean the hotglue excess.

Then glue the servo connector accessory to the center of one of the sides of the maze and on the center of the opposite side glue a little piece of the wooden stick to add support.

Cut two pieces of balsa of 23 cm and other two of 19cm, this is to form the ouder rectangle that holds one of the servo. glue the four balsa stick making sure to keep it flat and keeping 90° angles, making a rectangle of 23*21cm.

Take the stickers from the side of the servos that will be hotglued and glue one to the rectangle making sure to place it on the right side that connects with the servo's accesory glued on the maze. Then glue the other servo connector accessory to the outer side of the rectangle to move the other axis and glue another little piece of wooden stick on the opposite side to support.

Cut two pieces of balsa stick one to 13cm and the other one to 12cm. use the scalpel to make a dent of 0,5cm on the top of the 13cm stick so the balsa rectangle can rest. glue and screw the balsa sticks to the MDF frame 25cm appart from each other. then glued the other servo to the 12cm piece making sure it aligns with the hole on the other side so the rectangle can rest.

I drilled a hole of 1/4 inch for the wires so i can hide averything below the MDF frame.

We can now mount all the pieces to see they move nice and free, make the connections and test it before painting. (please check the step "HOW TO CONNECT AND PLAY")

Step 4: PAINT AND FINISH IT

clean all the parts and hotglue excess before painting.

I started by painting the cardbord maze using red acrylic paint, i painted several times so it is really nice. Then i painted the balsa rectangle and MDF base with black acrylic paint and let it dry.

mount all of the part and organize your wires and circuit. I hid everything below the MDF base (the wires, circuit and power bank)

Step 5: HOW TO CONNECT AND PLAY

I used aluminium foil to make the balls as they are lightweightand, you can make it to any size. But it also add a difficulty cause of its irregularities.

First connect the esp32 to the power bank and the usb cable of the servos too

Activate bluetooth on your device and connect it to "Bluemaze"

Open the app, tap the bluetooth logo and select "Bluemaze"

Now we are connected to the device via the app and it should be working.

you can put the android device on a Flag surface to assemble the maze and calibrate it.

Toys & Games Contest

Participated in the
Toys & Games Contest

Be the First to Share

    Recommendations

    • One Board Contest

      One Board Contest
    • Raspberry Pi Contest

      Raspberry Pi Contest
    • Jewelry Challenge

      Jewelry Challenge

    Comments