I like to play with labyrinth maze. I have always wanted to control one of those labyrinth maze games using gestures or mobile. I got inspired to create this Marble Maze by blic19933's 3D Printed Maze Controlled by Your Android Device
Instead of using a Bluetooth module for communication I have used WiFi module (ESP8266) for communication. So the advantage of this is I can control the maze eighter using a wearable band or mobile app.
What are the pros of my project?
1. It is simple and easy to build
2. It is cheap and needs a few electronic parts.
3.Detachable magnetic maze.
4. Easy to customize.
5. So much fun to build it and play with it.
The Maze is controlled via a wearable band as well as a Bluetooth app developed using MIT App Inventor. The gyroscope sensor data from the band is transmitted through the WiFi connection to the Wemos D1 Mini device (esp8266) which controls the servos that tilt the maze. You can also control the maze using an android app. Android app is created with the MIT App Inventor2. This gadget requires less components. It is easy to build.
You can download all the stuff required for this project from this GitHub link: https://github.com/siddhesh13/gesture_controlled_maze
Let's Start building...!!
Step 1: Parts and Materials
- 1x Wemos d1 mini
- 2x SG90s Servo Motor
- 1x ESP01
- 1x MPU6050
- 1x TP4056 LiPo Charger Module
- 1x 3.7v 400mAh LiPo Battery
- 1x Mini Slide Switch
- 1x Fitbit band or watch strap
- 4x 25mm Neodymium magnets
- 2x 5mm steel ball
- 2x Mounting screws
- 10cm X 10cm Wooden Ply
3D Printed Parts
The 3D print STL files are available on Thingiverse -
- 3D printer --> you can use online service
- Soldering iron and Tin
- Screwdriver and plier
- Wire stripper
- Glue gun
Step 2: 3D Print the Marble Maze Parts
I used Flashforge creator pro with 0.2mm nozzle and normal settings and with supports. You can also download all the files from Thingiverse. 3d print all the parts and clean the parts by removing support.
Step 3: Assemble the Gimbal Structure
There are 5 parts to build this structure. Its a Gimbal like structure. Before attaching servo motors to 3d printed parts, first, test the servo motors and then set both the motors at 90-degree angle. Now take 2 1-sided servo horns and fit it into the slot of x_axis_motor.stl and y_axis_motor.stl parts. Now Attach y_axis_motor.stl part to one of the servo motors and attach magnet_holder.stl part to the other servo motor. Fit it into the slot and attach to it using the 2 mounting screws come with the servo motors. Then attach this y_axis_motor and servo motor to the x_axis_motor and magnet_holder.stl and servo motor to the y_axis_motor.stl part. Attach both motors using screw comes with the servo motor. Now solder the servo motor wires to the Wemos board.
Servo Motor X = D3 pin of Wemos
Servo Motor Y = D1 pin of Wemos
Connect Ground and VCC pins of servo motors to GND and 5V pin of Wemos board respectively.
Now, place the Wemos board inside the base.stl part. Now cover the base plate by putting the Gimbal structure of servo motors on it and attach both the parts using 1-inch screws. Place the whole structure on a wooden plate and attach to it using screws.
Put the 25mm magnet in the slot of magnet_holder.stl part. Cover the magnet using the magner_holder_cover.stl part. Use glue to stick it.
Now maze is ready. Upload the code in the Wemos using Arduino IDE.
Step 4: Make the Wearable Band
The Wearable band consist of the following components:
TP4056 LiPo Charger Module
Mini Slide Switch
3.7V 400mAh LiPo Battery.
I use Nodemcu board to program ESP01. You can use a different programmer module to program ESP01. To program ESP01, connect ESP01 to Nodemcu board as shown in the picture. Then open Arduino IDE and select board as Nodemcu V1.0 and select the port and upload band.ino code. After uploading the code remove the header pins of the ESP01 using a soldering iron. Also, remove the header pins of the MPU6050 sensor. Now solder all the components as shown in the circuit diagram. Stick electric tape on the back side of all the modules to prevents short circuit. Place the soldered electronics parts in the 3d printed enclosure(wearable_band_case.stl). Attach the enclosure box to the band.
Step 5: Code Explanation
Code for the wearable band: https://github.com/siddhesh13/gesture_controlled_m...
code for the maze: https://github.com/siddhesh13/gesture_controlled_maze/blob/master/maze/maze.ino
I have programmed both the maze and the band using Arduino IDE. The band sends the gyroscope values (roll and pitch) to the maze. For data transmission, it uses the UDP protocol. For more information on UDP- ESP8266 visit this webpage https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/udp-examples.html
The maze is working in Access Point (AP) mode and the band is working in Station Mode.
The band first tries to connect to the maze which is working in AP (Access Point) mode. After the successful connection with the maze, ESP01 in the band initiates the communication with mpu6050 using I2C protocol. First, it calibrates the sensor for the current orientation of the sensor. Then it calculates the Roll and Pitch angle from MPU6050. It calculates angle every 4ms, i.e, 250 values per second. Then it transmits these angle values to the maze. To send UDP packet it requires an IP address and port number of a remote device that is the maze. The IP address of the maze is "192.168.4.1" and port number is "4210". After receiving the angle values from the band, servo motors on the maze rotates.
Step 6: Make an Android App Using MIT App Inventor
MIT App Inventor is the best platform to make a quick android app.
I have attached the aia and apk files. Download the apk file and install it in your android phone and start playing with the maze. You can also make changes in the app using aia file. Open the aia file MIT app inventor and make changes in the app according to you. I have used UDP extension to send data to the Wemos(esp8266) device.
Download the extension from here https://community.thunkable.com/t/free-udp-client-extension/5831
This app uses the gyroscope sensor of the smartphone to check the phone orientation and sends the value to the Wemos device using UDP protocol. I am working on an app for the iOS and will upload the files once it is done. Stay tuned!!!
Step 7: Design the Maze
I have designed the maze in four different shapes. You can download it and print it using a single color or multicolor in any color of your choice.
You can design your own maze using 3D/2D Maze Generator. How to use it is explained on their webpage.
But using this script you can only design a maze in a square/rectangle shape.
I have designed the maze using Inkscape and Fusion360 software.
First, download the image of the maze from the internet. Download black and white image for good results. Then open the image in Inkscape software. Then convert the image from JPG/PNG format to Bitmap format. To convert it to Bitmap, select the image and click on the Path--> Trace Bitmap. A new pop-up window will open, select Brightness cutoff and check the Live Preview check mark to see the results. Increase/decrease the Threshold value for Brightness cutoff to get best results and click OK. You will get a Bitmap image of the maze. Delete the original image of the maze which is in jpg/png format. Now resize the maze image by using Width and Height option from the top menu bar. After this save the maze image in SVG format.
Now open Fusion360 software, and click on Inset-->Insert SVG. Select the SVG file of the maze, and click OK.
You have a 2D sketch of your design ready, check its dimensions like width, length, diameter and the space for the ball inside the maze. If it is not proper then edit it in the Inkscape again and import the updated file again in the Fusion360. If all the dimensions are right then simply add a 26mm circle sketch in the center. This circle is for a magnet. Now extrude the maze. Keep wall height to 5-7mm, base thickness to 3-4mm, and cavity hole for the magnet to 2mm. After extruding save the file as STL and slice it using the slicer software and print it.
Step 8: Let's Play
This game is awesome! Put any maze and power it ON using a micro USB cable.
Wear the band and turn it ON, wait for 20 seconds to calibrate the sensor. Now you are ready to play.
If you are using the app to control the maze, first connect your mobiles WiFi to the maze. then open the app and you're ready to play.
If you design your own maze then don't forget to share your maze designs.
If you found it interesting, please vote for me in the Remix Contest. Thanks for reading through to the end!
Keep enjoying and Keep tinkering.
Participated in the