Preparing the Raspberry Pi

The first phase of getting our voice-directed robot in place after assembling the bot itself is creating a snips device, and to do that we need to set up a Raspberry Pi

Prerequisites. Though this guide will be quite detailed and hopefully include each step needed to build the project, I am assuming some familiarity with electronics and programming…also, my development box is a PC, not a Mac, and so references and preferences are directed from that point of view…virtually all of the software related tools mentioned herein are free…if you go through this and think some things could be more complete, leave a comment and let me know – good luck!

Raspberry Pi (RPi) Configuration. There are several current models of the RPi, including a brand new one, the RPi 4, and, different versions of Linux that will run on the RPi’s…we will use Raspbian, which is a flavor of Linux put out by the folks that define and the RPi and serves to probably be the most reliable and stable version to run on the RPi…unfortunately, the latest version of Raspbian, Buster, has not yet been implemented by snips, so, we will use Stretch…

Also, because it seems to fit on the Robotis Bioloid Premium (RBP) better, I suggest you ultimately use an RPi 3 A+ for the robot – it is a smaller form factor than the 3 B+ – it uses the same MPU, but the memory is less (but fine for this initial development)…it also only has one USB port and no NIC (network interface card)…if you use the 3 A+, you will need a USB hub for a keyboard and mouse, and, a USB-to-Ethernet adapter (not necessary, but facilitates initial setup)…since it contains multiple USB ports and a NIC, I used a 3 B+ for development, then a 3 A+ for the robot…also, you’ll need a monitor – if it is HDMI it will connect directly to the RPi, if not, you’ll need an adapter…

Raspberry Pi 3 A (lower) vs 3 B+ footprint…

Raspbian Stretch. Firstly, you’ll need a microSD card, at least 4GB but 8GB will leave room for future enhancement…I suggest a thorough re-format of the card, especially if it has been used previously – I prefer SD Card Formatter…SD cards are somewhat finicky…after you have formatted the card (it will take awhile using the Overwrite mode), note its drive letter (e.g., F: )…

You’ll need to download Raspbian Stretch (do not use the Lite version – it will work with snips but you will not be able to as easily follow this guide)…the current Raspbian.org web site is featuring Buster, so you’ll need to go here to do the download – remember its download location…once you have the Stretch zip file, you’ll need to create an image using another tool called balenaEtcher…it is easy to use – when it opens, point to your Raspbian Stretch zip file, enter the card’s drive letter and hit the Flash button…it will take awhile for the transfer…

This is the file you want to download from the site…

RPi Initial Setup. Plug your keyboard and mouse into USB ports and connect the RPi NIC via an Ethernet cable to your network…plug in your monitor…I will assume you have a Respeaker 2-mic Pi Hat – you can mount it to the RPi now…insert the microSD card into the RPI…finally, connect the power supply…

  1. Welcome screen shows, hit Next
  2. Choose your country, language, time zone and check the Use US keyboard box if appropriate, then Next
  3. For this guide I’ll use the default password of Raspberry – you can change here, the Next
  4. If appropriate, check the box re black border condition, then Next
  5. If you connected using Ethernet, it will look for your WiFi network – choose your preferred WiFi connection, hit Next and enter your password, then Next
  6. It will now want to update your software, hit Next…it may take awhile…
  7. While you are waiting, note that the network symbol in the bar at the top of the screen shows a WiFi icon – you can hover your mouse over the icon and see the IP assignments – make a note of the WiFi network address, e.g., 192.168.160.101…we will be wanting in a bit to set a static IP address for the WiFi connection so we always know where to find the RPi…
  8. you will see a system is up-to-date message, hit OK, and hit the Restart button on the next screen and allow the system to re-boot…

Raspberry Pi Configuration.

  1. click on the LXTerminal icon at the upper left of the title bar, at the $ prompt, enter:
  2. sudo nano /etc/dhcpcd.conf <enter>
  3. the nano file editor will open…use the arrow keys to scroll down to the bottom of the file and insert these lines at the bottom (note – be sure to hit your keyboard’s NumLock key if you’re going to use the keypad for number entry):
interface wlan0

static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
  1. of course, change the network ID to fit your situation – note the IP address you jotted down above…
  2. hit <ctrl>O, hit <enter>, hit <ctrl>X to save and exit the file
  • Note that you may need to permission your network router to allow the static IP address…
  • Check to be sure the system set the WiFi SSID configuration during the initial setup up by using the File Manager (top bar “folder” icon) to go to the /etc/wpa_supplicant folder and double click on the wpa_supplicant.conf file – you should see the info you entered earlier for your WiFi network…
  • if not, you should add/change this info in the file:
    • sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
      • (change testing to your SSID info)
network={
     country=US 
     ssid="testing"
     psk="testingPassword"
 } 
  1. click on the Raspberry icon at the top left corner of the RPi screen, scroll down to Preferences, then click on the Raspberry Pi Configuration menu…
  2. click Interfaces and enable: SSH:, SPI:, I2C, and Serial Port:
  3. click OK and you will get a request to re-boot – click OK…
  4. after re-booting, when you get the Desktop screen this time, if you did not change your pi login password earlier, you will see a Warning screen saying that SSH has been enabled, click OK…
  5. also, at this time, check by hovering over the WiFi icon and see that your static IP is being used…

SSH. We need our PC to be able to communicate with the RPI, for this we will use a service called SSH…

  1. be sure that SSH has been enabled by going to the Preferences, Raspberry Pi Configuration and into the Interfaces screen…
  2. download and install PuTTY
  3. open Putty and type your RPi’s static IP address into the Host Name window, hit <enter>
  4. when the terminal opens, it will ask you to login – if you kept the defaults, use pi, and raspberry…
  5. type exit <enter> to close the window…
  6. open a terminal session on your PC…(Windows key, Windows System, Command Prompt)
  7. at your prompt, enter your pi user at your static IP address, e.g.,: C:\Users\JoeBlow>ssh pi@192.168.152.22<enter>
  8. it will ask if your are sure you want to connect – type yes<enter>
  9. it will add you to a Known Hosts file in a .ssh folder under your C:\Users\yourUser\ (which you can edit and delete the name if you get stuck down the road with a conflict)
  10. it will prompt you for your RPi pi password – enter raspberry if you retained the default – you will be connected to the terminal of your RPI via WiFi!
  11. you can type exit<enter> to close the session…