Alexa, Ask Microbit to Turn LED Light

In this blog post, I would like to walk through how easy to control micro:bit with RGB LED with Alexa.

A user will say the following to Alexa enabled-device to control the LED light on micro:bit:

  • ask microbit to turn led to blue
  • ask microbit to turn led to green
  • ask microbit to turn led to red

Setting up Your Voice User Interface

  • In Developer Console, click Alexa > Alexa Skills Kit > Get Started.
  • Click Create Skill
  • Type skill name microbit and default language is English then click Next.
  • Select Custom and click Create Skill.
  • Under Build page, type microbit for invocation and press Save Model.
  • Create intent mbitlight and click Create custom intent.
  • Type sample utterance turn led {color} and click +.
  • Type new slot color and click Add.
  • Now we need to define the slot type. Select Slot Types and click Add. Type LIST_OF_COLOR and click Create Custom Slot Type.
  • We need to give the value for the LIST_OF_COLOR. Type red and click + sign. Repeat for other colors.
  • Go back again to Intent. Select Intent > mbitlight > color and under Slot Type select LIST_OF_COLOR. Click Save Model.
  • Click Build Model. It will take a while
  • Once it is success you will get the confirmation message.

Prepare the Node App for Amazon Lambda

npm init
npm install alexa-sdk lambda-log https
  • Archive the following all files and name it like Later we will upload the file to Lambda.
  • Download ngrok ( and run it with this command:
ngrok http 3000
  • Note the Https URL forwarding information and update the following code on index.js.
const hostname = “”;

Setting Up A Lambda Function Using Amazon Web Services

  • Type lambda under AWS services and press enter.
  • Click Create function.
  • Select Blueprints and under blueprints type alexa-skill-kit-sdk-factskill and press enter.
  • Select alexa-skill-kit-sdk-factskill and click Configure.
  • We need to create the role if doesn’t exist. Open a new tab and go to Services (menu) and type role. Select IAM.
  • Select Role and click Create role.
  • Select Lambda and click Next Permissions.
  • Once you have selected, click Next review.
  • Type role name microbit-executor and click Create role.
  • Once it is successfully created, you will see new role.
  • Go back to the step just before we created a new role and refresh the page.
    Name: microbit. Role: Choose an existing role, existing role: microbit-executor.
  • Click Create function to continue.
  • Under triggers, add Alexa Skills Kit. Leave this window open.
  • Open a new window and go o Amazon Developer Console > microbit. Note down the Application Id.
  • Or go to Alexa Console > Endpoint to get the skill ID.
  • Go back to Lambda screen again and enter the Application Id (skill ID) and click Add.
  • You will get the confirmation message then click Save.
  • Select the from the earlier step and upload it to Lambda. Click Save to continue.
  • Take note the Lambda’s ARN (Amazon Resource Name) which you can find at the top of the menu.

Setting Up the EndPoint on Alexa Skills Kit Developer Console

Go back to Alexa Skills Kit Developer Console and select Endpoint > AWS Lambda ARN and enter the ARN number. Click Save Endpoints.

Prepare and Running micro:bit Controller NodeJS App

yt build
node mbitcontroller.js

Testing the Skill

I am going to use Alexa simulator to test the skill. Go to Test page on Alexa Skills Kit Developer Console.

Type ask microbit to turn led to blue and if no error, you will get the JSON input and output as show in the screenshot below. Alexa will reply with Ok, the LED light has been set to blue and the LED light on micro:bit will be set to blue.

Demo Video

That’s all!