Build your own privacy-friendly Raspberry Pi smart speaker with Mycroft

Voice-activated virtual assistants and smart speakers such as Google Home and Amazon Alexa are increasingly found in millions of homes around the world. Ask them a question, they’ll answer, they tell jokes, they check the weather and they play music.

But smart speakers are a privacy nightmare, and it can be disconcerting to have one in your home, knowing that data about what you say is transferred to companies that don’t have your best interests at heart. .


Personalized voice assistants are easier than you think

If you value your privacy but want some of the features a smart speaker offers, it’s easy to make your own. All you need is a Raspberry Pi or other computer capable of running Linux, Mycroft.ai software, a decent USB microphone, and some speakers.

The beauty of a voice assistant is that you use your voice to control it, and the feedback or response is given in an audible form. You speak to him, and he responds directly to you. This is a monitor surplus to requirements, saving you money on display technology.

Plug in the USB microphone and speakers, then connect the power supply.

Install Mycroft AI on your Raspberry Pi

When you initially install an operating system on your Raspberry Pi, make sure you have configured it to accept SSH connections.

Open a terminal or use an SSH client such as PuTTY to connect to your Pi. If your username is pi and your Pi’s local IP address is 192.168.1.32, you would type:

ssh pi@192.168.1.32

Update and upgrade packages installed with

sudo apt update
sudo apt upgrade

Now your Raspberry Pi has the latest software and security updates by default.

Install git:

sudo apt install git

Clone the Mycroft kernel to your home directory and put a cd there:

git clone https:
cd mycroft-core

The directory will contain several cloned files from the Mycroft repository. You can inspect them with:

ls

The two you should pay the most attention to are README.mdwhich contains useful information about the software, and dev_setup.sh, a script that will help automate the installation. Use:

cat README.md

to read the file, then run the script with:

./dev_setup.sh

You’ll be asked a number of questions, including whether you want to run the stable or unstable branch (hint: you want the stable branch), whether Mycroft should automatically check for updates, whether you want a locally generated robotic voice (called ” Mimic”), and whether the script should add Mycroft helper commands to your local path.

Building the Mimic voice locally will take several hours on a Raspberry Pi, but it means Mycroft will be able to talk to you even if the Pi doesn’t have internet access. Adding commands to your path means they’ll be easier to find and use later.

Once you’ve made your choices, the script will download and install several dozen Python packages. This process should take around 10 minutes, but may vary depending on your connection speed.


Once you have returned to the command line, you can start Mycroft AI with:

./start-mycroft.sh all

Mycroft is now online, listening through your microphone and ready to respond through the speakers.

Add skills to Mycroft

Mycroft comes with some basic skills built in. You can ask it to tell you the weather for your location, you can turn the volume up or down with your voice, or you can say “Listen to the news” to get news relevant to your area. RSS feed read by Mimic robotic voice.

ls /opt/mycroft/skills

Each of the directories displayed following this command will contain a README.md file, which will specify the requirements and instructions for use. Use the cat command to read the content.

For example, if you want to know the instructions for Mycroft’s jokes, you would type:

cat /opt/mycroft/skills/mycroft-joke.mycroftai/README.md

Other skills can be added by downloading them from the Mycroft Marketplace, which involves creating an account linked to your Mycroft AI, or cloning directly from the Mycroft Skills GitHub repository.

To add a new skill through the terminal, select the URL of the skill you want Mycroft to learn:

cd /opt/mycroft/skills/
git clone address/of/the/skill/repository

Develop your own Mycroft skills

You have now installed Mycroft AI on a Raspberry Pi and are able to add new skills to it. Why not take the project further by helping to develop skills that others can use and add to other Mycroft installations?

Comments are closed.