Programming Voice-Controlled IoT Applications with Alexa and Raspberry Pi
on
Why Alexa?
Having purchased an Echo quite a few years ago, I started writing Alexa skills, only to find that there were very limited examples on both writing skills and controlling smart home devices. I found myself struggling through the Amazon documents and making my own notes and producing a few YouTube videos to help others. This became the outline for the book. Since then, Alexa devices have improved, now including screens, and skill development has become more detailed. The reader is taken from creating a basic skill to more comprehensive ones including controlling screen devices, publishing your skills and adding shopping skills and making money. It then moves on to communicating with Raspberry Pi and designing smart home devices.About the Book and How Alexa Works


Example code for all chapters is provided and available on GitHub, and some YouTube videos are also provided. Programming for more complicated skills, including saving data and using Amazon’s DynamoDB database and S3 storage, are covered. Designing with Alexa Hosted skills has limitations, and so alternative ways of creating your skills are discussed.

Certification and publication of your skills by Amazon follow. More detailed programming is included with chapters on designing for screen-based devices using Alexa Presentation Language (APL), displaying images and interacting with the user - which could be a book in its own right!
The first part of the book ends with how to access and extract data from the Internet, and eventually write skills that use in-skill purchasing to potentially make money.
The Hardware
In the second part of the book, you learn how to create a Raspberry Pi IoT 'thing'. The example uses MQTT message queuing and shows how to control a robot from an Alexa skill. In the coming part, smart home devices are described. These devices use friendly names such as ‘microwave’ or ‘Raspberry Pi’ and predefined utterances, e.g., "Alexa turn the Raspberry Pi LED off". Security, discovery of devices, linking with the Alexa app and controlling a virtual device are all covered. The following chapter takes this further and shows how to control an LED display on a Raspberry Pi, this time using Simple Queue Service, SQS.
Moreover, there is a chapter on the Node-RED flow-based development tool and controlling a Pi with a display using Node-RED running on a Pi follows. An example of a Node-RED MQTT IoT application is also given. MQTT messages sent from a user are displayed on a Raspberry Pi.

A Raspberry Pi can also provide proactive information to your Alexa devices, for instance a bad weather warning. This procedure for this is described, including security and obtaining permission with an access token and sending a notification to your device is demonstrated. The final chapter shows how to set up your Raspberry Pi as a standalone Alexa device. You can find more information on this subject in the upcoming months, in the form of an Elektor Magazine Article.
Final thoughts
The idea behind the book is to help the reader write Alexa skills and control a Raspberry Pi from an Alexa device. It covers a lot of ground, from the basic voice and screen display, security, distribution, certification and publishing. The latter chapters move on to controlling the Raspberry Pi, either as an IoT ‘thing’ or as a Smart Home device, or controlling the Pi with Node-RED. The software is provided and some of the chapters are linked to YouTube videos.I hope that the book gives you the background and confidence to write Alexa skills and encourages you to try your own designs.


Discussion (0 comments)