This blog is to describe how to set up the nRF52840 DK board communicating with an Echo device over Bluetooth Low Energy (BLE) / Bluetooth Smart.

What is the Alexa Gadgets?

Amazon provides Alexa Gadgets Toolkit which can build your own Alexa Gadget and then communicate/interacts with compatible Amazon Echo devices over Bluetooth.

You can build up your own Alexa Gadget and connect as below features.

Alexa Gadgets Overview

Details can be found at the Amazon online documentation.

https://developer.amazon.com/en-US/docs/alexa/alexa-gadgets-toolkit/understand-alexa-gadgets-toolkit.html

Nordic nRF5 on the Alexa Gadgets

Nordic Semiconductor press release has announced that the latest version of its nRF Connect SDK (Software Development Kit) (version 1.4) includes example application software code for Alexa Gadgets. By using the code as the basis for software development, developers can accelerate time-to-market for Alexa Gadgets based on Nordic’s nRF52 Series or nRF5340 Bluetooth® 5.2/Bluetooth Low Energy (Bluetooth LE) Systems-on-Chip (SoCs).

https://www.nordicsemi.com/News/2020/11/nRF-Connect-SDK-includes-example-application-software-code-for-Alexa-Gadgets

nRF Connect SDK

nRF Connect SDK 1.4 version has started to support on the Alexa Gadgets. The example code be found at the nrf\samples\bluetooth\alexa_gadgets.

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/alexa_gadget/README.html

The Peripheral Alexa Gadgets sample demonstrates how a Bluetooth LE device can connect to an Amazon Echo device using the Alexa Gadgets Bluetooth Service and Profile.

Documentation for the Gadgets Service and Profile can be found at Alexa Gadgets Bluetooth LE.

Before a Gadget can be connected to an Amazon Echo device, you must register it with Amazon. See Alexa Gadgets Setup for information on how to do this.

Dependence Tool

You need to install the Nanopb on your platforms.

This sample depends on an external protobuf compiler tool – Nanopb.

 unzip -d nanopb nanopb-0.4.4-windows-x86.zip

After unzip the package, you need to add the PATH inside the system environmental path.

You can use the command to refresh the environmental path.

refreshenv

How to compile the nRF52840 DK firmware on the Alexa Gadgets.

Gadget registration

When registering the Gadget, you will receive two identifier strings:

  1. Device Amazon ID
  2. Device secret

You must update the CONFIG_GADGETS_AMAZON_ID and CONFIG_GADGETS_DEVICE_SECRET configuration options in prj.conf with the values that you received during registration.

User interface

LED 1:

On when connected.

LED 2:

On when handshake with peer is completed.

LED 3:

On when wakeword directive (Alexa.Gadget.StateListener) is received.

LED 4:

Toggles when Color Cycler skill is used.

Button 4:

Erases bond information when button is held during power cycle or reset.

Testing

After programming the sample to your board, test it by performing the following steps:

  1. Optionally, set up log monitoring:
  1. Connect the board to the computer using a USB cable. The board is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager. Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
  2. Reset the board.
  3. Follow these instructions to pair your Echo device with the sample: Alexa Gadgets Pairing.
  4. Observe that LED 1 turns on to indicate that a connection has been established.
  5. Observe that LED 2 turns on to indicate that the Alexa Gadgets handshake has completed.
  6. Speak the “Alexa” wake word to your Echo device and observe that LED 3 turns on.
  7. If you are monitoring the log output from the COM port, observe log activity during Alexa queries.

Further information

Resource from Alexa Gadgets

Basically, you can find much demo code at the Alexa Gadgets github as below.

https://github.com/alexa-samples/Alexa-Gadgets-Raspberry-Pi-Samples

Alexa Gadget Raspberry Pi example includes:

  • Kitchen Sink Gadget: Create an Alexa Gadget that prints messages in response to directives from Alexa Gadgets Toolkit interfaces, including wake word detection, alarms, timers, notifications, and reminders.
  • Color Cycler Gadget: Create an Alexa Gadget with an LED and a button, that uses Custom Directives to cycle through different colors and uses Custom Events to report the LED color when the button is pressed. This project requires an Alexa skill.
  • Wake Word Gadget: Create an Alexa Gadget that turns an LED on and off in sync with the detection of the wake word.
  • Notification Flag Gadget: Create an Alexa Gadget that rotates a servo motor to raise and lower a flag when a notification is received or cleared on a paired Echo device.
  • Timer Gadget: Create an Alexa Gadget that reacts to a single timer set on an Echo device. A servo rotates a disc to indicate the remaining duration of the timer, when the timer expires, and when a timer is canceled.

On the nRF Connect SDK, it uses the example code from Color Cycler Gadget. You can also get the online training from Nordic Webinar.

Contents: 

  • What is Alexa Gadgets?
  • How gadgets interact with Alexa
  • Which features are supported?
  • How to set up the Alexa Gadgets sample in the nRF Connect SDK with the nRF52840 DK
  • How to build on the sample and add more features