Join the Ben Heck team every week for amazing hacks! Watch them build and mod community-inspired projects using electronics! | The Learning Circuit | |
sudo Sergeant | ||
See All Episodes |
Bob Badley, a local entrepreneur and engineer, stops by the shop to show Ben how team can use their Alexa device to automate their workbench. After walking Ben through the initial setup for building a skill, they’ll use a Python script to command a Raspberry Pi, works with any UART device, down to a USB port in a pinball. |
JavaScript Object Notation (JSON) is the standard text=based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications. In order to get this working, they’ll need to set up a Pi that can take in a JSonRequest and send back a JSonResponse. Then they’ll set up a skill in Amaazon that can send the request and handle the response. They’ll have to have all these parts working simultaneously in order to have anything work at all. Bob walks Ben through setting up an Amazon Developer Account. Since Ben already has an echo at the shop that is linked to his account, they can use Ben's existing Amazon account information to login to Amazon Web Developer. The echo dot they have at will automatically link to any Alexa skills that they build.
Once you sign in you have the option to get started with an Alexa Skills Kit or an Alexa Voice Service. The Voice Service is used when you are building a device that was Alexa enabled. Since they will be using an existing Amazon echo device they only need to go to Alexa Skills Kit. The two options that are frequently used are the custom interaction model and the smart home skill API. The smart home skill API is a little more complicated because it requires more configuring. The Custom Interaction Model, on the other hand, is easier to use but you have to invoke it using your custom word. There are a couple of ways you can use an “Invocation Word”, the trigger used to give commands. You could say “Alexa ask the to… ” or you could say “Alexa… “ while using the UART control that they are configuring. Nothing else to configure on this page so they move onto the interaction model.
They can either write their interaction model in pure JSon or they can launch Skill Builder, Amazon’s WYSIWG solution for those who don’t want to code. For those who remember XML, a machine and human readable way of formatting data, JSon is a much better way of doing something similar. Using the Amazon Skill Set you are presented with three built-in intents that every skill needs to handle.: Amazon cancel intent, help, and stop. Intents allow you to get out of back-and-forths with Alexa, something it’s enabled to do. Now that they’ve gone over the default intents, it’s time for Bob to show Ben how to create one of his own. The custom intent option allows you to setup your own keyword trigger. The name you give it is a label, for the creator, they’ll add their own sample utterance once that’s enabled. Intent slots are the variables you can use when setting up your commands, outside of the trigger command.
Bob walks Ben through what he needs to do in order to configure sample utterances and intent slots for the UART skill that they are building Once that's done they go over format formattypes and content Once they are done configuring the new skill Felix joins them to do a Pi to UART test As a special treat Ben pulls out a Radio Shack TRS-80 model 100 one of his favorite classic computers to run the test Its got an RS-232RS-232 port on it and an FTDI adapter that he's built in They'll eventually use Alexa to ping the shop IP address and tunnel in to control the Raspberry Pi but this will suffice for testing Next they run an Alexa to Server to UART test Bob walks Ben through the web service that will run Alexa to Serva to UART The code for content parameters etc is written in PHP It will call the Python used for the Pi and Python will be used to send the things that they are requesting Python will be the thing acting on the Raspberry Pi that communicates with their serial ports