Alexa does Dolly, Part 2: Setting up Raspberry Pi and node.js

amazon echo

In the last post I explained how, in the pursuit of home entertainment nirvana (playing Dolly Parton’s greatest hits by voice command), I set myself the task of integrating Amazon Echo and Sonos. That post contains a list of things you’ll need to follow along at home. In this post, we move into the build phase by setting up our Raspberry Pi and getting node.js running on it.

Raspberry hooray!

So, here we go, I have my shiny new Raspberry Pi. I opted for a Raspberry Pi starter Kit from U Create. This contains everything you need to get up and running including the Pi itself, a case, an SD card containing the NOOBS software and all the required cables.

raspberry pi and node.js

Getting the Raspberry Pi up and running couldn’t have been more straightforward with this kit: simply slot in the SD card, plug in a mouse and keyboard, and plug into an HDMI monitor, et voila!

Installing node.js on our Raspberry Pi

The next job is to get node.js installed. This guide from Dave Johnson was pretty handy. This covers everything from the initial set up and configuration of your Raspberry Pi, including setting up remote desktop access.

If you bought the same starter kit as me, you can skip straight to the section entitled ‘Prep the Hardware’ in Dave’s guide (you also won’t need to connect a Wi-Fi adapter, as the Pi 3 already has one on board). I also didn’t need to worry about localisation, as I’m in the UK. I’m connected to a wired network at home, so wasn’t worried about configuring my WiFi, but go ahead and do this if you need to.

I’m using a Mac, which means establishing remote access is a bit different to what’s described in Dave’s article. Instead, I used the instructions at TechTonic.

Next, just follow Dave’s instructions to set up node.js, and we have all the basic building blocks in place.

As easy as A-P-I

The next step is to get our node-sonos-API up and running. To do this we’ll need to jump back to the instructions we looked at in our first part (by rgraciano on GitHub) and follow the section called ‘Get jishi’s node-sonos-http-api working’.

This should be pretty straightforward and, all being well, you should be happily be able to control your Sonos system from a browser by typing in some URLs.

Try playing around with some of the API endpoints provided in jishi’s readme file to test it out.

But what about Alexa?

In the next part we’ll look at how to connect your new integration to the outside world. And we’ll create an Alexa skill so that, with the right commands, you can play ‘9 to 5’ without lifting a finger.

Leave a reply

You can use these tags:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  1. Ben Fozard says:

    Good to hear you’re playing with this too! I now have one of my PI3s is being used as a NodeRed/node.js/homebridge proxy for control, including Siri. It mainly controls lights and sockets, but the most complex flow turns on the projector, turns off the lights, sets my AV Receiver to the projector’s HDMI out (as opposed to TV), all from a single Siri command. The reverse turns off the projector, switches the AV receiverto TV HDMI output and turns the lights back on.

    Not tried it with the Sonos yet, but will give it a go now I’ve seen this!

  2. Tony James says:

    Simon why not use LinkPlay – the whole ecosystem APP with OTA updates, SW, Firmware all complete and fully AVS approved together with all services licences and best in class Far Field performance .
    Good luck with setting up the Microphones . !

Sign up for the Manifesto newsletter and exclusive event invites