In this tutorial, you will learn how to configure DevKit to use Azure Speech Service and Oxford dictionaries API. This example includes:
- Create and use Azure Speech Service.
- Register and use Oxford Dictionaries API.
Notice: This project is archived and not actively maintained.
The MXChip IoT DevKit (a.k.a. IoT DevKit) is an all-in-one Arduino compatible board with rich peripherals and sensors. You can develop for it using Azure IoT Device Workbench . And it comes with a growing projects catalog to guide you prototype Internet of Things (IoT) solutions that take advantage of Microsoft Azure services.
To complete the steps in this tutorial, you need to do the following:
- Prepare your DevKit with Getting Started Guide.
- Upgrade to latest firmware (>= 1.6.0) with Firmware Upgrading tutorial.
-
Log in to the Azure portal.
-
Create a new Speech Service by searching Speech in Azure portal and click Create.
-
Provide the information including Name, Location, Price Tier and click Create. Wait for the deployment to finish and pin it to your dashboard for easy access.
-
Once the Speech Service was created, navigate to its main page. Click Keys. Copy KEY 1 and we will use it in the later session.
-
Visit the developer site of Oxford Dictionaries
-
Click the GET YOUR API KEY and setup your account. This will prompt you to enter some information about your project.
- Application type: Learning
- Platform: Other-> IoT
- Agree to terms and conditions
-
The website will send you an email and please follow the instruction to activate your account.
-
Sign into your account and click on “Credentials”
-
Copy the Application Id and Application Keys. We will use them in the following session.
-
Start VS Code first, and then connect the IoT DevKit to your computer.
-
Use
F1
orCtrl+Shift+P
(macOS:Cmd+Shift+P
) to open the command palette, type Azure IoT Device Workbench, and then select Open Examples....Select IoT DevKit.
Then the IoT Device Workbench Example window is shown up.
-
Find the example of IoT DevKit Dictionary and click Open Sample button.
-
A new VS Code window with a project folder in it opens.
-
Open the DevkitDictionary.ino file. Replace the first three variables with the keys copied earlier.
Variable Value SpeechServiceAppKey Key 1 from Azure Speech Service OxfordDictionaryAppId ApplicationId from the Dictionary API OxfordDictionaryAppKeys ApplicationKeys from the Dictionary API -
Open the iot_speechAPI_client.h file. Update the following code based on the location of your Speech Service. You could find all the supported values in Speech Service Rest APIs
/*Replace the following definitions from the value in https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-apis*/ #define COGNITIVE_API_TOKEN_URL "https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken" #define COGNITIVE_API_TOKEN_HOST "westus.api.cognitive.microsoft.com" #define INTERATIVE_SPEECH_URL "https://westus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=en-US"
-
Open the command palette and select Azure IoT Device Workbench: Upload Device Code.
-
VS Code then starts verifying and uploading the code to your DevKit.
-
Press and hold the A button while saying the word. The recording time is 2 seconds.
-
Release Button A to stop recording. Wait for the request to be processed.
-
The definition of the word will appear on the screen. Press button B to scroll the definition.
-
To start another quest, press A and say another word.
The dictionary language can also be changed. The URL in the function app (named string url) can be changed to a variety of languages, documented Supported languages
API Documentation shows how to call each API and other functions provided by Oxford Dictionaries. These include translations, synonyms (Thesaurus) and other functionalities.
If you encounter problems, you can find FAQs if you encounter problems or reach out to us from the channels below.