Picroft
Quick links
About Picroft
Picroft is a ready-made way to run Mycroft on a Raspberry Pi 3 or Raspberry Pi 3B+ and is provided as a disk image that you can burn to a Micro SD card. Picroft will not work properly on other Raspberry Pi models.
Picroft is based on Raspbian Stretch Lite.
Picroft is entirely open source, and PRs and Issues are warmly welcomed on the Picroft GitHub repo.
As of December 2018, Picroft includes built-in support for the Google AIY voice HAT.
What do I need to run Picroft?
In order to set up Picroft, you will need to have a basic understanding of the Linux (Raspbian) command line, be comfortable connecting devices to WiFi networks, and have a little patience when setting up audio devices.
Hardware requirements and compatibility chart
As well as a Raspberry Pi, you will also need:
Micro SD card, 8GB or larger highly recommended
Power adapter with micro USB for your country. The Raspberry Pi Foundation has some excellent recommendations.
An analog Speaker that can be plugged into the 3.5mm audio jack on the RPi 3 or a USB Speaker (Bluetooth on Picroft is difficult to get working and is not recommended)
USB Microphone
Installing Picroft may be easier if you also have:
USB keyboard
Monitor or TV connected via HDMI cable
Ethernet cable (if not connecting via WiFi)
While we don't currently offer a Picroft kit with microphone and speaker to purchase from our Shop, we've provided links below to components we know to work "out of the box".
NOTE: We do not gain any profit or benefit from the links below, they are provided only to assist you in acquiring compatible components.
A note on USB speaker/headphones/soundcards
If mycroft audio output fails (No speech or audio) when using some sort of USB soundcard for output it might be worth trying to reset the play commandlines used by mycroft.
To accomplish this, edit /home/pi/.mycroft/mycroft.conf
and insert
If no other edits has been applied to the file it should look something like
Getting started with Picroft
Downloading the disk image
First, download the Picroft disk image.
We also have a Picroft disk image available of our unstable
branch if desired.
Burn the disk image to the Micro SD card
Next, the disk image needs to be burnt to the Micro SD card.
The Raspberry Pi official documentation provides an excellent tutorial on this, using Etcher software. We recommend that you burn the Picroft image to the Micro SD card using Etcher.
If you prefer to use the Linux command line tool dd
to burn the disk image instead, follow these instructions:
Download the Picroft disk image
Insert the Micro SD card you wish to burn the image to. It must have a storage capacity of 8GB or higher.
Identify the path where the MicroSD card is mounted by running the command
sudo fdisk -l
. You will be able to tell the path based on the storage size of the device.Keep a note of this - it will be something like
/dev/sdb1
Unmount the disk so that no other operation can write to the device while it is being imaged using the command
sudo umount /dev/sdb1
. Make sure to substitute for the location of your device.Run the command
sudo dd if=path-to-your-image.img of=/dev/sdb1 bs=20M
. Make sure to substitute the location of your device, and the path to the.img
file you downloaded.This will take several minutes to run. The command prompt will return if successful, otherwise an error message will be displayed on your terminal.
Seeing the output from Picroft
There are two ways to see the output from a Picroft Device:
Plug Picroft into a HDMI monitor or television, and attach a USB keyboard. If you are planning to connect Picroft to a WiFi network, you will first need to connect to a HDMI monitor or television so that you can manually configure Picroft's WiFi settings.
ssh
into Picroft once Picroft is connected to a wired or wireless network
Connecting Picroft to a keyboard and monitor
If you would like to see the output of Picroft on a monitor (rather than SSH'ing in to Picroft), you can plug a HDMI monitor in to the HDMI slot on the Raspberry Pi.
If you would like to connect a keyboard or mouse (rather than SSH'ing in to Picroft), connect them via the USB slots on the Raspberry Pi.
In our experience, we've found most monitors, keyboards and mice are plug-and-play - ie. you shouldn't have to install any additional drivers.
Connecting Picroft to a wired or WiFi network
To connect to a wired network
Simply plug the ethernet cable into the RJ45 (ethernet) socket on the RPi. Picroft will then attempt to connect to the network, and request a DHCP address.
You will need to connect to your router, or use other networking diagnostics, to identify what IP address your Picroft has been allocated on the network.
To connect to a WiFi network
By default, Picroft is not configured for WiFi. Picroft can connect to most 2.4GHz WiFi networks, but this has to be manually configured.
First, you need to be able to edit files on the filesystem of the Picroft. There are two ways to do this.
Plug the Picroft into a keyboard and HDMI monitor then type
Ctrl + C
to get to the command line orif you are already connected using a wired connection and you know the Picroft's IP address, SSH in to the Picroft device
Editing the wpa_supplicant.conf
file
wpa_supplicant.conf
fileNext, we edit the wpa_supplicant.conf
file. This file controls WiFi connections for the Raspberry Pi.
Type
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Using the down arrow key, navigate to the bottom of the file, and add credentials for your SSID
Type
Ctrl + X
to exit andY
thenEnter
to save your changes.Type
sudo reboot now
You will need to connect to your router, or use other networking diagnostics, to identify what IP address your Picroft has been allocated on the network.
Manually configuring WPA2 Enterprise WiFi with MSCHAPV2 authentication
If you are on an enterprise network, your network security might use WPA2 with MSCHAPV2 authentication. Configuring Picroft to use MSCHAPV2 is similar to the above, but requires some additional steps.
First, we need to generate a hash of your SSID's password.
This will use the NTLM hash which is a 16 bit MD4 hash. Make sure to copy this as we will need it for later steps.
Next, run the following commands:
Add the following to the bottom of the wpa_supplicant.conf
file, replacing ssid
with your SSID name, identity
with your username and password
with the hash generated earlier. Type Ctrl + O
to save, then Ctrl + x
to exit.
Next, reboot the Picroft using sudo reboot now
. If these steps have worked, you will be connected to your enterprise WiFi shortly after rebooting.
You will need to connect to your router, or use other networking diagnostics, to identify what IP address your Picroft has been allocated on the network.
Known errors with Picroft and WiFi
NOTE: Picroft cannot connect to WiFi networks that operate in the 5GHz band. You must select a WiFi network that operates in the 2.4GHz band.
NOTE: Picroft cannot connect to WiFi networks that operate on Channels 12 or 13 (2467MHz and 2472MHz frequencies). Please configure your SSID to use a different channel or frequency. These channels are often used in Germany and other European countries.
Booting up Picroft
Once you've burned the disk image to the Micro SD card, insert the Micro SD card into the Micro SD card slot on the Raspberry Pi. Plug in your microphone, speakers, and if you're using a monitor and/or keyboard, plug these in too.
Next, plug in the power and connect the Micro USB cable to the RPi. This "power on" the device.
If you have a HDMI monitor connected, you should start to see some output on screen.
If you're going to ssh
into Picroft, do the following:
ssh
into Picroft
ssh
into PicroftSSH access to Picroft is enabled by default, so you don't have to enable SSH access.
Ensure you know the IP address of your Picroft Device on your network. If your Picroft is already paired, then a handy way to do this is to install the IP Address Skill, and then Speak:
Hey Mycroft, what's your IP address?
"here are my available IP addresses: wlan IP address ... Those are all my available IP addresses"
If not, you will need to know what IP address your Picroft has. You may need to log in to your router to find out the IP address of your Picroft.
Open up your favorite terminal program, like PuTTy on Windows, or a new terminal on Linux
ssh pi@IPADDRESS
The default password is
mycroft
, so enter this when prompted.If you have successfully logged in via SSH you will see a command prompt like the one below:
You are now connected to Picroft via SSH.
Setting up Picroft
On first boot, you will see a screen which looks similar to the one below:
Picroft will then ask you whether you would like to do the guided setup, or drop straight to a command line. If you are new to Picroft, we recommend that you complete the guided setup.
Selecting audio output and audio input
NOTE: Audio output and audio input is the single most problematic part of Picroft setup; we've tried to provide lots of guidance here to get you up and running, but you may need to experiment to find a solution for your chosen audio output and input devices.
The guided setup will then ask you to select your audio output device, as shown below:
Enter the number 1
, 2
, 3
or 4
corresponding to:
Next, test and adjust the volume. You may need to reboot your Picroft in order for the audio output device to be correctly selected.
The final step of the guided setup is microphone configuration. You will be asked to select your audio input device, as shown below:
Enter the number 1
, 2
, 3
or 4
corresponding to:
The guided setup will then do a microphone test to ensure your chosen microphone is working OK.
What can I do if the guided setup doesn't set my audio input or output device correctly?
There are a few tricks that we know of to get your audio input or output device working correctly - however, these are somewhat technical and will require typing commands on the Linux command line interface (CLI).
Alsamixer
alsamixer
is a utility provided by the ALSA sound system on Raspbian Stretch that allows you to select an audio playback (output) and input (capture) device.
To run alsamixer
, type Ctrl +C
to exit the guided setup and you will be at the Linux command line. Type alsamixer
as shown below:
You will see a screen similar to the one below, and may have different options depending on which audio devices you have connected.
Different devices will have a different command key for choosing 'Capture' devices, in this case it is F4
.
If you do not see any capture devices, as shown below, then you may need to select a different sound card.
To select a different sound card, follow the instructions on your version of alsamixer
. In this case, the command key for choosing 'Select sound card' is F6
. Use the arrow keys on your keyboard to navigate up and down the list to choose your preferred soundcard.
alsamixer
usually has an option to see all capture and playback devices. In this case, the command key to see all devices is F5
.
pulseaudio
If alsamixer
does not work for you, then you may have some success with pulseaudio
. We've recently updated the Picroft repo to include pulseaudio
, but if you haven't updated for a little while then you may need to manually install it.
Pairing the Picroft
Once the Picroft is connected to the internet, and you have run through the guided setup, Picroft will reboot. Picroft will boot into the mycroft-cli-client
screen, and a Registration Code will be spoken, and will also be shown on the mycroft-cli-client
screen, as shown below:
View the home.mycroft.ai documentation to learn how to add your Device to home.mycroft.ai.
Once paired, you can then use basic Skills to get started. For example, you can ask questions like 'Tell me about Abraham Lincoln' - shown below:
Maintaining your Picroft
How to reimage a Picroft Device
To reimage a Picroft Device, download the latest disk image. Burn that to a MicroSD card using Etcher, and insert the burned MicroSD card into the Raspberry Pi, then connect the Raspberry Pi to power.
Keeping your Picroft updated
To keep mycroft-core
and the Skills on your Picroft updated, first ssh
in to Picroft, then run the update.sh
script:
This script will update both mycroft-core
and the Skills on your Picroft device.
Important file locations for Picroft
If you plan to do Skills development work, or other development work with Picroft, you'll find knowing these file locations useful.
Skills - have a shortcut in
/home/pi
that points to/opt/mycroft/skills
mycroft-core
- is located at/home/pi/mycroft-core
Logs - are located at
/var/log/mycroft/
mycroft.conf
- is located at/home/mycroft/.mycroft/mycroft.conf
Identity file (do not share) - is located at
/home/mycroft/.mycroft/identity/identity2.json
Useful commands for Picroft
There are several commands that are packaged into Picroft to help you with advanced functionality:
mycroft-cli=client
: This command will start the Mycroft CLI client if you are on the Linux command linemycroft-help
: This command brings up help informationmycroft-mic-test
: This command re-runs the microphone test from the guided setupmycroft-msk
: This command runs the Mycroft Skills Kitmycroft-msm
: This command runs the Mycroft Skills Managermycroft-pip
: This command runspip
within the Mycroft Pythonvirtual environment
(venv
). This is useful if you are installing dependencies for Skills.mycroft-say-to
: This command sends a command to Picroft, just like you had 'spoken' a command. This is useful if your microphone is not working.mycroft-setup-wizard
: This command re-runs the guided setupmycroft-skill-testrunner
: This command runs thetestrunner
- used to run unit tests for a Skill. This is useful if you are doing Skills development with Mycroftmycroft-speak
: This command gets Mycroft to 'speak' using Text to Speech.mycroft-venv-deactivate
: This command deactivates the Mycroft Pythonvirtual environment
and is useful if you want to install other software on the Picroft device.mycroft-wipe
: This command wipes Picroft back to factory default status. This will unpair the device and remove any configuration changes you have made.
Building your own Picroft image
The Picroft image building instructions can now be found on GitHub at; https://github.com/MycroftAI/enclosure-picroft/blob/stretch/image_recipe.md
Next steps
Congratulations! You now have a fully functional Picroft, and can start exploring all the options you now have. Consider using it as a stand-alone voice assistant, or connect it to a monitor and keyboard, and develop straight away. If you don't have a monitor and keybaord, SSH is enabled by default so you can remotely connect to it straight away.
Picroft uses a Raspbian Stretch Lite image under the hood - with Mycroft pre-installed - so everything you can do with Raspbian, you can do with Picroft. You can download other packages, get it running as a server - or more!
For more help or ideas, consider joining our Picroft channel on Mycroft Chat or reading through our Picroft topic on the Mycroft Forum.
Using the GPIO pins on the Raspberry Pi 3
One common question we get is - "Can I use the general purpose input output pins (GPIO) on the Raspberry Pi 3 with Picroft?".
The answer is 'Yes' - but this requires some additional configuration.
You need to add the mycroft
user to the gpio
group with the command
sudo usermod -g gpio mycroft
You also need to install some additional packages:
sudo apt-get install python-rpi.gpio && sudo apt-get install python3-rpi.gpio
This example GPIO Skill provides some good examples of how to use GPIO input and output in your Mycroft Skill.
Last updated