Using Alexa to control Microchip PIC32

In this article, you will learn how to connect Amazon’s Alexa-controlled Echo speaker to Medium One and use it for voice control interaction with a Microchip PIC32 board powered by MIPS processors from Imagination. From there, you will create a workflow that will allow you turn on different LEDs on your Microchip IOT Ethernet Monitoring Kit using voice commands.   

For this tutorial you need:

  • Completion of the Microchip tutorial found here.
  • The Medium One project from the Microchip tutorial and the activation email that came with it
  • An Amazon Developer account (
  • An Echo Dot, Echo, or Tap

Step 1: Create your Alexa Skill

Log into your Amazon Developer account at Click on “Alexa” from your dashboard.


Click “Get Started” under the Alexa Skills kit:


Click “Add A New Skill”


On the Skill Information page, click “Custom Interaction Model” for skill type.  For name, put “Microchip LED Changing Demo.” For invocation name, put “microchip.”  In Global Fields, Audio Player is “no.”


Click next. Copy and paste the following into “Intent Schema”:


Next, click on “Add Slot Type.” A box will open up. For the name, enter “Led_options.” For the values, copy and paste the following:


Click “Save.” Click on “Add Slot Type” again. In the same box, enter “on_off” as the name. For the values, copy and paste the following:


Click “Save.” Copy and paste the following under “Sample Utterances”

Click on the save button. It will take a few seconds to build the model. Leave this page open for now, we’ll come back to it in the next step.


Step 2: Create an Alexa Stream

Log into Medium One. Open your Microchip project. 

Click on “Config→ Data Streams.” Scroll to the bottom and click “Create a new stream.” Name it “alexa_requests.”  Click “Save Data Stream.”


Step 3: Linking Alexa and Medium One

For this step, you will need to switch between the Amazon Developer configuration page and the OAUTH Clients Page. On Medium One, click “Manage OAuth Clients.” Click “Add New,” enter a name and a login message for the OAuth page. 


Under Permissions, leave Stream Access permission then click on the plus sign to the right. Check both the read and write permissions, and choose alexa_requests as the stream. This gives the Alexa Skill permission to send data to this stream.  Leave this and switch back to your Amazon Developer page.


We are assuming that you have not navigated away from anything on this page since Step 1. Click on the “Configuration” tab.


Under Global Fields, specify “HTTPS” for the Service Endpoint Type. Then select North America. In the box that comes up after clicking North America, paste: “”


Click on the “Yes” button for account linking.


Paste “ Authorization URL at the top, and “ down where it says Access Token URI. Make sure “Auth Code Grant” is selected.


Take note of the two URLs in the blue box.


Copy and paste these URLs back in Medium One. Use the plus button to add the second URL. Click Save.


This appears on the next page. Take note of the Client ID in the blue box, and the Client Secret in the green box. Copy and paste these into the blue and green boxes on the Amazon Developer page:

You do not need to put anything for Domain List and Scope.


For privacy policy, paste “”. Then click Save.


Finally, click on SSL Certificate on the sidebar. Select the middle option, then click save.


Step 4: Link your account

Go on the Alexa App on your phone or the desktop version here. Make sure you are logged into your Amazon Account and you have already configured your Echo device. This guide shows how to link your account to Alexa using your mobile device, but the mobile app and website look very similar. Navigate to skills.


Click on Your Skills on the upper righthand corner.


Navigate to the skill you created. We named ours “Microchip LED Changing Demo” .


Click “Link Account.” If you ever want to link to a new user, you’ll have to disable the skill then re-enable it to unlink.


Enter the username and password of the user “device” that you received the login info for in the activation email in this project.  (Do not use the password listed below; use the one from your email.)


You should see this on the next page, with your skill name:



Go to your Amazon Developer account. Click on the “Test” tab. Go to “Service Simulator” and type in “Turn on LED 4,” then click the ask button. You will see “The response is invalid.” because we haven’t created our workflows yet!  This is OK.


Go to your Sandbox account. Confirm that there is an event in the alexa_requests stream from the timestamp that you sent the request from Amazon. To do this, go to Data Viewer -> Data Streams and click on ‘alexa_requests.’ You should see one event like the photo below.


Step 5: Create Workflows

Go to your Workflow Studio and create a new workflow called “Toggle LEDs with Alexa.” Under Tags and Triggers, under alexa_requests, drag Go to modules and drag Base Python under Foundation.  Drag this onto the screen and connect in1 to the green box. Go to outputs and drag Processed Stream- Single to the screenConnect out1 from the blue box to in1 on the orange box.  Double click on the blue foundation box and replace the code in that workflow with the following:


Click Save and Activate. Your workflow should look like this:



Go back to the Test tab on the Amazon developers website. Type in “Turn on light 4.” You should see JSON come up in the response section:


Step 6: Talk to Alexa

Now, you’re ready to ask Alexa to get sensor data. Say “Alexa, ask Microchip to turn on light 2.” The second LED on your board should turn on. Try turning on and off each of the four lights. Congratulations, you’ve successfully connected up your Echo to Medium One! Now you can modify workflows to respond to different Alexa commands.

Comments are closed, but trackbacks and pingbacks are open.