Introduction: AIY Voice Controlled MeArm

About: Scientist working in in-vitro diagnostics industry. Playing with all types of sensor as a spare time hobby. Aiming for simple and inexpensive tools and projects for STEM, with a bit of science and a bit of sil…

A DIY voice controlled robot arm! For less than 150 US$ / Euros!
What seemed nearly impossible a year ago, can now be build by anyone, without being an engineer.
That's what I call progress.

I received my Mime Industries MeArm Pi robot arm from their Kickstarter project recently and have been playing with the AIY voice HAT for a few weeks now. Based on an earlier concept for a voice controlled jumping jack I have optimized the script, so I now can control all four servos of the MeArm via the AIY voice HAT.

Which results in a voice controlled robotic toy for children of any age.

To tell the truth, replacing the pretty brilliant control system of the Mime MeArm Pi with the AIY system does not really make much sense, but hey, its voice-controlled now.

You will start voice recognition by pressing the button in the AIY box and give it your order by saying a number of keywords. They are left, right, up(ward), down, for(ward), back and grip. The first of these work in combination with the keywords maximum, center, twenty, eleven and five. The numbers will move the servos for the given number of degrees. "Grip" works in combination with keywords open, close and center. "Goodbye" will shut down the program.

More complex procedures, like "pick up something in the lower left, move it to the upper right and release it there" can easily be coded and combined with a individual keyword to activate them.

One nice thing about a voice controlled robot arm, in comparison e.g. to a robot car, is that latency time, being a major problem of voice controlled devices, does not play a critical role here. Have a look on the videos, and you will see what I mean.

Step 1: Materials Used

- Raspberry Pi 3, 35 Euros at

- AIY voice kit, 27 Euros at

- Mime Industries MeArm Pi, 70 GBP at
the bare MeArm (Pimoroni, 34 GBP) might be sufficient as well.

- headers and some jumper cables

- microSD card (8 GB or more)

Step 2: The Code and Connection of the Devices

Attached you find the code. It is a bit to long to be listed here. It uses some features (volume and pitch as parameters in "say”) requiring the January 2018 version (or later) of the AIY image.

To set up the AIY voice system, please follow the instructions given in the AIY manual and the AIY web site, and have a look on the chapter how to connect and control a servo. To simplify the connection of the servos of the MeArm with the AIY voice HAT, I would recommend to solder headers to the servo ports on the AIY HAT. To be able to control the servos more precisely, I used the AngularServo function from the GPIOzero library.

To implement the script, copy the code to the src folder, and make it executable by a right click on the file, then go to permissions, and make it executable for anyone. Then use the dev console and enter "src/". In principle it should be possible to run the device headerless, but I have not tried yet.

I had connected the HAT with the six port adaptor cable of the MeArm PI using female-male jumper cables. Please be very careful to connect the correct ports, as I accidentally bricked a Pi this way. You may find more information on the Mime website.

Edit April 2018: The four servos are drawing a lot of power and are getting hot after a while, so it might be advisable to connect the power and ground not to just one of the servo ports, but to one of the motor ports instead. I have not tested this so far and it may require some minor change ion the script.

The code as such is a bit long, lots of repetitions, but not too complicated. The process is the following: you press the button, then verbally give the system a phrase with some keywords, and you will get back a text string. Using the python "... in ..." function, the text string is first analyzed for the occurrence some primary keywords as "right" or "left", then for secondary keywords as "maximum" or "eleven". You may get better voice recognition results if you add some "neutral" words into the phrase, e.g. start with "move ... ". The order of the keywords do not play a role. If the values are increased or decreased by a certain number (five, eleven, twenty) of degrees, the results are checked if they are above or below predefined minimum or maximum values. Then the arm will move accordingly. If no complete order was recognized, you will be told. You may stop the program by telling it "goodbye".

Please be aware that the voice recognition system can give strange results, e.g. "grip close" will give "grip clothes", "eleven" can give "eleven" or "11", "right eleven" is translated to "write 11" and so on. "ten" was omitted, as it gave various erroneous results. And as e.g. "right center" gives "Right Center", the text string is converted to lower case before analysis.

Please note: The code has not been completely optimized and debugged yet. Use at your own risk. The system is not completely stable and some further optimization might be required. This is especially true for the grip. Here an adjustment of the servo arm position might be necessary.

Voice Activated Challenge

Participated in the
Voice Activated Challenge

Raspberry Pi Contest 2017

Participated in the
Raspberry Pi Contest 2017