Software apps and online services
The culture and technologies in the Star Trek series have captured the imaginations of generations of science fiction fans since the first airing of the original series in 1966.
So much of current technology was inspired by devices used in the series, from flip phones to tablet computers. Police use Tasers to safely immobilize criminals without inflicting serious injuries, inspired by the Phasors used to stun enemies in the series. One of the underlying technologies used in Star Trek that every character takes for granted, is the ships computer. Integrated into every part of the ship, it controls the doors, the lighting, and life support while maintaining the ships defenses and keeping track of the crew, all built around a voice activated control system.
While modern computer systems have yet to reach this level of integration, some aspects of this technology are available to us today, and what better place to start than the awesome Alexa Voice Services made available by Amazon. Speaking with the Echo is very much like the characters in Star Trek asking the computer of the Enterprise to perform a task or provide information, and there are many IoT and Home Automation devices that can be controlled by the Echo adn used to control your environment. You can create Alexa skills for the Echo, or other Alexa Voice Services enabled devices so you can control the lighting in your home, unlock the doors, fire photon torpedoes at your neighbors, or turn your home into your very own Star Ship.
This tutorial will introduce you to the technology made available through the Alexa Skills kit, the toolkit provided by Amazon, to build and even publish skills you've created.
I'll walk you through creating a simple trivia game that you can play on your Echo, and, as you become familiar with the process, you can personalize the code with extra features of your own design. Trivia games are always a fun way to pass the time and challenge our memories, so we will build a Star Trek Trivia game.
First you'll need is an AWS (Amazon Web Services) account to get started. You can create your account here:
Follow the instructions to create the account, once finished, sign in to the console. On the left hand side you'll see a link for creating a Lamda function, this is a response function that will run your code when a request is sent from the Echo to your skill.
Before you create your function select US East (N.Virginia) for the region in the upper right hand corner of the page, this is the only region with the Alexa/Lambda free tier service. Press the 'Create a Lambda function' button and you'll be asked to select a blueprint for the function, you can come back to this later to check out all of the preconfigured functions, but for now press the 'skip' button on the bottom right.
We have a blank function for our new skill, add a function name and description, these are for your reference and are only visible here in this portal, and then select the type of runtime language your application will be using, in this case we want to select Node.js 4.3.
The code entry type we want is the 'edit code inline' option, which should already be selected. If your function needs more than one file you will need to put them in a zip file and use the upload a .zip file option, but for now we can just copy and paste the Index.js code included below. Bellow the code entry window are the Lambda function handler and role options, we want to select the '*Basic execution role' in the 'Role*' drop down, a new window will open asking you to grant resource access permissions to your code, select 'Allow' in the bottom right corner and the window will close. We can leave all of the other options at the default and select the next button. Here you can review the options we've selected and then select 'Create function'.
Our new function is presented to us, with some configuration options, and the possibility to modify the code. Select the Event sources tab and add a new event source, select Alexa Skills Kit from the drop down list and submit. This will allow the skill we will configure next to communicate with this function. We will also need the ARN number that is located in the upper right hand corner of the page. The ARN is unique to the function and can be used to tell the Alexa skill which function we want it to call.
For the next step you'll need to sign into the developer portal at:
Once you've logged into the developer console select ALEXA on the top, select the Alexa Skills Kit Get Started button, and 'Add a New Skill'.
Here you can give your skill a name, this will be displayed in the Alexa compagnion app and should reflect what the skill does, below that is the invocation name, this is the name users will use to invoke your application from the Echo. Once you've entered your desired names select next.
On the next page we will need to add the intent schema, these are the intents that will be received from the voice service via Json packets. We need to handle intents like, start, stop, help, and the answers to the trivia quiz, these commands and responses will be passed to the lambda function from the skills kit. You can copy the intent schema bellow and paste it into this window. You'll notice that some of the intents begin with AMAZON, these are default responses that we also handle in lambda function code.
The Custom Slots Types are the custom responses that will be passed to our skill in the Json packets to be handed off to the lambda function, in this case they will be the answers to the trivia questions, which for simplicity are the numbers 1-4. Select the 'Add Slot Type' button, for the Entry Type we want to copy the type from the slots section of the schema we added above, enter "LIST_OF_ANSWERS" and the values to add are the numbers 1-4, each on a separate row. Then press OK.
Sample Utterances are the possible ways a user will respond to your skill and are used to create a voice model to help Alexa interpret what your user wants to accomplish. A basic set of utterances can be found below to copy and paste into this section. You can add additional utterances that a user might say depending on the functions your application offers, in this case these basic utternaces will be sufficient for our application. Once you've pasted the sample utterances into the dialog press the 'Next' button to go to the Configuration page.
Here you want to select the Lambda ARN (Amazon Resource Name) option for Endpoint, this directs the Alexa Skill to send application requests to the Lambda function that we created earlier, this is where we want to paste the ARN address for the Lambda function I pointed out earlier, copy and everything but the initial ARN- from the function page and paste it here. For account linking we want to select no and then press the next button.
On the test page we can enable our skill for testing with our Echo, if we have one, if not you can use the Alexa Skill Testing tool provided by Amazon at:
You'll need a microphone on your computer and be logged into the tool with the same account you used for the development portal to create the Alexa skill. On this page you will also find a voice simulator so you can hear how Alexa will pronounce your text, this was very helpful with the Star Trek trivia skill, since there are many alien names, I had to adjust some of the text so it would be pronounced correctly.
The service simulator allows you to send commands to your Lambda function and view the responses, this also helps check that the application is communicating correctly.
The next two pages are for information you will need to enter when you are ready to submit a skill for publication.
The status box in the upper left hand corner will show green check marks when all of the information in each section is complete, if there is one missing go back and check out what's missing.
That's it! You've created your first Alexa Skill. Be sure to check out my Trekkie Trivia skill by enabling it in the companion app for your Amazon Echo.
Now you can start building your own Star ship, just don't start any intergalactic wars..