AIY - Let's talk

Ulises Gascón

I am Full Stack developer and proud co-organizer of Open Source Weekends (OSW)

I am an active contributor to the Open Source Ecosystem

I work as a freelance for technical organizations and projects and as devs' instructor at Fictizia.

  • User's Guide
  • Maker's Guide
  • Community
  • ¡Questions!

By 2019, 20% of brands will abandon their mobile apps.

By 2020, 40% of employees can cut their healthcare costs by wearing a fitness tracker.

By 2020, 30% of web browsing sessions will be done without a screen.

By 2021, 20% of all activities an individual engages in will involve at least one the top-seven digital giants.

By 2020, 50% of all searches will be voice.

By 2020, customers will manage 85% of their relationship with the enterprise without interacting with a human.

Sources: Gartner & ComScore

User's Guide

Kit Content


  • Voice HAT accessory board (×1)
  • Voice HAT microphone board (×1)
  • Plastic standoffs (×2)
  • 3” speaker (wires attached) (×1)
  • Arcade-style push button (×1)
  • 4-wire button cable (×1)
  • 5-wire daughter board cable (×1)
  • External cardboard box (×1)
  • Internal cardboard frame (×1)
  • Lamp (×1)
  • Micro-switch (×1)
  • Lamp holder

NOT Included

  • Raspberry Pi 3 (×1)
  • SD card (×1)
  • Size “00” Phillips screwdriver (×1)
  • Scotch tape (x1)

Assembly Hardware

Prepare the software

Start the application


Automatic (as a service)

#In terminal...
sudo systemctl start voice-recognizer

sudo systemctl stop voice-recognizer

Start on-boot

#In terminal...
sudo systemctl enable voice-recognizer

LED Status Codes

Led Signal Description
Pulse The device is starting up, or the voice recognizer has not been started yet
Blink (every few seconds) The device is ready to be used
On The device is listening
Pulse The device is thinking or responding
Pulse → off The device is shutting down
3 blinks → pause There’s an error

Maker's Guide

How it works?


# terminal
cd $HOME/voice-recognizer-raspi/

Source Code

Config Files

# terminal
cd $HOME/.config/voice-recognizer.ini

# backup
cd $HOME/voice-recognizer-raspi/config

Change activation trigger

# terminal

Key file

In manually start

# terminal
python3 src/ -T {trigger-name}


Trigger name Description
gpio Activates by pressing the arcade button
clap Activates from a single clap or snap

Create a new activation trigger

import RPi.GPIO as GPIO
import time
from triggers.trigger import Trigger
class GpioTrigger(Trigger):
    '''Detect edges on the given GPIO channel and call the callback.'''
    DEBOUNCE_TIME = 0.05
    def __init__(self, channel, polarity=GPIO.FALLING,
        super().__init__() = channel
        self.polarity = polarity
        if polarity not in [GPIO.FALLING, GPIO.RISING]:
            raise ValueError('polarity must be GPIO.FALLING or GPIO.RISING')
        self.expected_value = polarity == GPIO.RISING
        self.event_detect_added = False
        GPIO.setup(channel, GPIO.IN, pull_up_down=pull_up_down)
    def start(self):
        if not self.event_detect_added:
            GPIO.add_event_detect(, self.polarity, callback=self.debounce)
            self.event_detect_added = True
    def debounce(self, _):
        '''Check that the input holds the expected value for the debounce period,
        to avoid false trigger on short pulses.'''
        start = time.time()
        while time.time() < start + self.DEBOUNCE_TIME:
            if GPIO.input( != self.expected_value:

To add a new activation trigger, you’ll need to create a new source file in the trigger folder, implement a subclass of Trigger (see ~/voice-recognizer-raspi/src/triggers/ and add it to the command-line options.

Android Things

Voice commands

Voice command Response
Hello Hello to you too
What time is it? It is <time>. E.g. "It is ten to nine."
Tell me a joke (listen for the joke response)
Volume up Increase the volume by 10% and say the new level
Volume down Decrease the volume by 10% and say the new level
Max volume Increase volume to 100%

Create a new voice command

To control an LED that you've connected to GPIO 4 (Driver0).

# ~/voice-recognizer-raspi/src/

# =========================================
# Makers! Implement your own actions here.
# =========================================

import RPi.GPIO as GPIO

class GpioWrite(object):

    '''Write the given value to the given GPIO.'''

    def __init__(self, gpio, value):
        GPIO.setup(gpio, GPIO.OUT)
        self.gpio = gpio
        self.value = value

    def run(self, command):
        GPIO.output(self.gpio, self.value)

# ...

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

actor.add_keyword('light on', GpioWrite(4, True))
actor.add_keyword('light off', GpioWrite(4, False))

Use TensorFlow

Help your fellow makers experiment with on-device TensorFlow models by donating short speech recordings. This small web app will collect short snippets of speech, and upload them to cloud storage. We'll then use these recordings to train machine learning models that will eventually be able to run on-device, no Cloud needed.


# Terminal
sudo journalctl -u voice-recognizer -n 10 -f

See logs

Log sample

Clap your hands then speak, or press Ctrl+C to quit...
[2016-12-19 10:41:54,425] INFO:trigger:clap detected
[2016-12-19 10:41:54,426] INFO:main:listening...
[2016-12-19 10:41:54,427] INFO:main:recognizing...
[2016-12-19 10:41:55,048] INFO:oauth2client.client:Refreshing access_token
[2016-12-19 10:41:55,899] INFO:speech:endpointer_type: START_OF_SPEECH
[2016-12-19 10:41:57,522] INFO:speech:endpointer_type: END_OF_UTTERANCE
[2016-12-19 10:41:57,523] INFO:speech:endpointer_type: END_OF_AUDIO
[2016-12-19 10:41:57,524] INFO:main:thinking...
[2016-12-19 10:41:57,606] INFO:main:command: light on
[2016-12-19 10:41:57,614] INFO:main:ready...


Innovation happends



Google Cloud


Laser Cut Enclosure


Mocktails Mixer





Installed in the Sala Oró of the Museum of Science and Climate of the Science Park of Lleida.


MagPi #57



¡Thank U!

Dreams are extremely important. You can't do it unless you imagine it.  

- George Lucas