36 LXF249 May 2019 http://www.linuxformat.com
Open source smart home
he process of installing Picroft starts off the
same way as installing Raspbian: writing an
SD card image. There are stable and unstable
versionsavailable at https://github.com/MycroftAI/
enclosure-picroft. We’ll work with the stable image for
this tutorial, but do give the unstable one a shot later to
see some new features (and possibly bugs). Download
the image to your machine – any machine running any
OS; just be aware it’s 2.2GB zipped and 4.9GB
unzipped, so make sure you have enough space. The
image can be burned with a graphical program like the
multi-platform Etcher (https://etcher.io) or the old-
fashioned way using dd on Linux:
$ sudo dd if=raspbian-stretch_Picroft_2018-09-12.
img of=/dev/sdX status=progress bs=4K
replacing /dev/sdX with the appropriate device (the
lsblk command will help you figure this out if you’re
not sure). That will take some time to write, so now is a
great opportunity to make a cup of tea.
When it’s done, put the SD card into the Pi and fire it
up. You’ll need a display and keyboard connected to the
Pi to run the initial setup, but afterwards, these will not
be needed unless something goes wrong. On first boot
Picroft will resize its partition to use all available space
on the SD card. When it finishes booting a second time,
it will ask if you would like some help setting up your
system. Unfortunately, this help doesn’t include setting
up wireless networking, so you’ll need to say nay here,
unless you’re using a wired connection for your Pi.
If no network connection is found you’ll be
directed to a different script which will try to
sort this out. For the basic Wi-Fi case (WPA or
WPA2 with a password), just choose the first
option and enter your network’s SSID and
password. For more complicated setups use
option 3 to edit the /etc/wpa_supplicant/wpa_
supplicant.conf file directly.
The Mycroft CLI should start and you should be able
to pair your Pi to Mycroft Home, which we’ll get to in a
minute. First though, you’ll want to set up your
microphone and speakers via the setup wizard. Exit the
CLI by typing :quit then restart the setup wizard with:
$ mycroft-setup-wizard
First choose the sound output that best matches
your hardware: Analogue, HDMI or USB. Next, set the
desired audio level. If you’ve just plugged in a USB
speaker and aren’t getting any output, you may need
to reboot (by pressing R) for it to be picked up. Then
comes the microphone test; only a couple of USB mics
and the Google AIY kit are supported out of the box, but
other hardware (such as the Seeed ReSpeaker we used)
can be made compliant once the relevant drivers are
installed. Use option 4 to postpone setting this up if
your hardware needs further convincing.
Next you’ll be asked whether to auto-update the
master branch, which is a good thing to say yes to.
You’ll then be asked if you want to allow passwordless
sudo – the default behaviour, which is insecure
depending on who has access to your Pi. Finally you
have the option to change the default mycroft
password for the pi user, which you probably should
do. Setup then continues the same as on desktop, so
skip to the Creating a Mycroft Account section.
Mycroft on your desktop
For desktop Linux boxes, Mycroft provides a setup
script on GitHub that works on Debian, Ubuntu, Fedora
and Arch. It can be made to work on other distros, but
some manual setup will be required – the script will tell
you which libraries are missing and your job will be to
find the packages containing those. Whatever distro
you’re running, you’ll need Git to fetch the script. Grab
it with:
$ cd ~
$ git clone https://github.com/MycroftAI/mycroft-
core.git
$ cd mycroft-core/
Then have a look at the dev_setup.sh script because
it’s imprudent to run random things from the internet
that are going to ask for root privileges, even if the folks
at Mycroft are a trustworthy bunch. You’ll see that the
script sets up a virtual environment so as not to
interfere with your Python installation. Once you’re
happy the script is kosher, run it with:
$ ./dev_setup.sh
You’ll be asked which branch you want to check out.
The default master branch is considered more stable,
so go with this one first. Later, if you’re feeling
adventurous, you can try the development branch. Next
you should allow the script to automatically update the
repo, unless you have some reason not to. The next
question asks whether you want to build the Mimic TTS
This is the screen
you’ll want to type
your registration
code into. We’re
pretty sure this one
will have expired by
press day.
Set up Mycroft on your Pi or Linux box and let amusing
human-computer voice interactions ensue.
Installing Picroft, or Mycroft
T