element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Andy Clark's Blog Voice activated robot
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Workshopshed
  • Date Created: 21 Oct 2017 8:03 PM Date Created
  • Views 486 views
  • Likes 8 likes
  • Comments 3 comments
Related
Recommended

Voice activated robot

Workshopshed
Workshopshed
21 Oct 2017

I decided to wire up the Google AIY box to Marty the Robot.

image

OK Google!

 

The first thing to do was to upgrade the software so I did not have to press the button to work the robot. I followed Eric Duncan Google AIY upgrade steps.

 

After stopping the service

sudo systemctl stop voice-recognizer.service

 

I then edited the config file to switch to "Ok Google" mode rather than button mode.

 

nano ~/.config/voice-recognizer.ini

 

And set the trigger to be

trigger = ok-google

 

Configuring for Marty

 

Next I installed the Marty Python library from Robotical

 

cd ~/voice-recognizer-raspi
source env/bin/activate
pip install martypy

 

Next up is adding some custom actions to google AIY
I edited the actions file and included the Marty library.

 

import datetime
import logging
import subprocess
import martypy

import phue
from rgbxy import Converter

 

Then in the make_actor function I added my own command.

 

# =========================================
    # Makers! Add your own voice commands here.
    # =========================================

    actor.add_keyword(_('raspberry power off'), PowerCommand(say, 'shutdown'))
    actor.add_keyword(_('raspberry reboot'), PowerCommand(say, 'reboot'))

    actor.add_keyword(_('marty walk'), MartyCommand(say, 'walk'))

    return actor

 

Then finally I added a class to process that command, I based the flow on the Hue Lightbulb one provided. I used the "calibrate tool" to find my Marty but I think it's also possible to find them in code. I'd also recommend enhancing the code to cope with exceptions.

 

# Control Marty the robot #
#

class MartyCommand(object):
    """Control Marty the Robot"""

   def __init__(self, say, command):
        self.say = say
        self.command = command
        mymarty = self.connect()
        mymarty.hello()  # Move to zero positions and wink
        mymarty.enable_motors()

    def connect(self):
        return martypy.Marty('socket://192.168.1.77') # Change IP to match your Marty

    def run(self, voice_command):
        if self.command == "walk":
            self.say("Walking forward 5 paces")
            mymarty = self.connect()
            mymarty.walk(5)

        else:
            logging.error("Error identifying Martys command.")
            self.say("Sorry I didn't identify that command")

 

Finally to test run

 

src/main.py

 

Once you are happy with testing you can restart the recogniser service with

 

sudo systemctl start voice-recognizer

 

My biggest issue was that Google did not like my accent so I ended up adding lots of keywords with the combinations that the voice recognition had detected. Also the detection needs to match exactly so you'd end up having to add lots of different commands. One approach is the approach taken by Marcin Gorecki to use wild cards. You could then say "Marty Walk Forward Five Paces" and have the recognition software parse the number of steps.

 

Adding wildcards to Google AIY actions on Raspberry Pi. – geek.mgorecki.net

  • Sign in to reply

Top Comments

  • DAB
    DAB over 7 years ago +2
    I remember when we tested the early voice recognition algorithms back in the early 1980's we discovered that the basic settings worked for everyone but our female engineer from Georgia. Her southern accent…
  • dougw
    dougw over 7 years ago +1
    Our voice recognition software also has had some problems with UK accents, but it is mostly that there seems to be an automatic tendency to speak louder and slower when one is not understood. This does…
  • balearicdynamics
    balearicdynamics over 7 years ago in reply to dougw

    This is an issue that probably can't be reviewed. Also with good mic the problem persists. It is possible to speak loud, as far as I know based on my experience, but you should always keep almost the same sound level and tone. That is difficult if you don't concentrate on what you are doing.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 7 years ago

    I remember when we tested the early voice recognition algorithms back in the early 1980's we discovered that the basic settings worked for everyone but our female engineer from Georgia.  Her southern accent was too pronounced for the device to catch.  When we changed the settings so that it would work with her, it would not work for anyone else in the office.

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dougw
    dougw over 7 years ago

    Our voice recognition software also has had some problems with UK accents, but it is mostly that there seems to be an automatic tendency to speak louder and slower when one is not understood. This does not work with voice recognition software.  Also plosive sounds are great for recognition, but some mics go crazy with plosives pops. You can get/make "pop" shields though. The software seems to work better with clear diction at a reasonably quick pace and even volume. For Australians, we needed to create a whole special language. image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube