DEV Community

Cover image for Day 7: Making Cool Raspberry Pi Projects even Cooler with Voice AI (2/4)
Dilek Karasoy for Picovoice

Posted on

Day 7: Making Cool Raspberry Pi Projects even Cooler with Voice AI (2/4)

Continue to show how to make your cool Raspberry Pi projects even cooler with voice AI.

Building an end-to-end voice recognition:
Interested in building something similar to Alexa which understand commands such as "Alexa, turn on all the lights"? with a Raspberry Pi? You've come to the right place. Picovoice Platform SDK is what you're looking for. It consists [Porcupine Wake Word] and Rhino Speech-to-Intent Engines.

In this demo we'll use Raspberry Pi Zero - ReSpeaker.

Let's get started!


sudo apt-get install libasound2-dev
Enter fullscreen mode Exit fullscreen mode

Access Key
If you don't have one, you can get your AccessKey from the Picovoice Console for free.


gcc -std=c99 -O3 -o demo/respeaker-rpi0/picovoice_demo_mic \
-I sdk/c/include/ demo/respeaker-rpi0/picovoice_demo_mic.c \
-ldl -lasound
Enter fullscreen mode Exit fullscreen mode

Say Picovoice
The demo outputs: [wake word]
Say turn on the lights

You should see the lights turned on and the following message in the terminal:

is_understood : 'true',
intent : 'turnLights',
slots : {
'state' : 'on',

Try changing the color by saying Picovoice, set the lights to orange

The list of commands you can try:
- "[switch, turn] $state:state (all) (the) [light, lights]"
- "[switch, turn] (all) (the) [light, lights] $state:state"
- "[change, set, switch] (all) (the) (light, lights) (color) (to) $color:color"
- "off"
- "on"
- "blue"
- "green"
- "orange"
- "pink"
- "purple"
- "red"
- "white"
- "yellow"

You can check out the GitHub repo to see more open-source demos

Top comments (0)

Here is a post you might want to check out:

Regex for lazy developers

regex for lazy devs

Sorry for the callout 😆