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.
Details can be found at the Amazon online documentation.
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).
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.
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.
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.
How to compile the nRF52840 DK firmware on the Alexa Gadgets.
When registering the Gadget, you will receive two identifier strings:
- Device Amazon ID
- Device secret
You must update the
CONFIG_GADGETS_DEVICE_SECRET configuration options in
prj.conf with the values that you received during registration.
On when connected.
On when handshake with peer is completed.
On when wakeword directive (
Alexa.Gadget.StateListener) is received.
Toggles when Color Cycler skill is used.
Erases bond information when button is held during power cycle or reset.
After programming the sample to your board, test it by performing the following steps:
- Optionally, set up log monitoring:
- 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.
- Reset the board.
- Follow these instructions to pair your Echo device with the sample: Alexa Gadgets Pairing.
- Observe that LED 1 turns on to indicate that a connection has been established.
- Observe that LED 2 turns on to indicate that the Alexa Gadgets handshake has completed.
- Speak the “Alexa” wake word to your Echo device and observe that LED 3 turns on.
- If you are monitoring the log output from the COM port, observe log activity during Alexa queries.
Resource from Alexa Gadgets
Basically, you can find much demo code at the Alexa Gadgets github as below.
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.
- 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