Labyrinth AI2-MIOIO

In this project we are going to make a small demonstration of the practical use of the accelerometer sensor of the Android device for the control of a labyrinth.
In this case we will use the MIOIO App Inventor 2 development environment, since for this purpose it is more than enough.

It consists of mounting two servos on the axes of a labyrinth-shaped board and connected to the MIOIOBot shield to make them move depending on how we move our Android device.

We are going to need:
MIOIO card
Shield MIOIOBot
1 Bluetooth usb compatible
1 battery holder
2 servos SG90
Pieces Labyrinth MIOIOBot in STL format to print.
Screws and flanges to hold the servos and the labyrinth structure.


pieza 3


pieza 4

Soportes laberinto

pieza 1

Base laberinto 1

pieza 2

Base laberinto 2

 pieza 5

Base laberinto 3

You will also need:

1 bluetooth usb

2 mini servos S9

1 battery compartment.

Once the structure has been assembled with the servos, we proceed to connect the servos to the Shield MIOIOBot in the auxiliary pins as follows:



Now let's run the program that will control these servos.

The blocks in the part of the designer that we are going to need are:

2 servo blocks MIOIOBOT.
2 buttons to start / stop the application.
4 blocks labels that will show the state of the sensors, to know if we are doing well.
1 accelerometer sensor block.

Drag all those blocks into the designer with the following structure:


aplicacion MIOIO Appinventor 2 01



Now we go to the part of blocks and put the blocks according to the following figure:

We observe how the function performed by the buttons is to turn the accelerometer on or off.

Then, in the other blocks, what is done is to obtain the accelerometer data (X, Y) and treat them as we are interested so that the servos behave as we want.
The idea is that position 90 of the servos is the origin 0 of coordinates, in this way, when the sensor of a negative value, the servo will be positioned to a value less than 90 °, and if it is positive, it will do so in a position Greater than 90 °. It is the same for both the X axis and the Y axis.


aplicacion MIOIO Appinventor 2 02

The only thing left to put the program is the limit of movement of the axes, since if you tilt the Android device a lot is more likely to trip over the structure, you can break some piece of plastic, this is left as a task for Who wants to do it.

Leave a Reply

Your email address will not be published.