Skip to content
This repository was archived by the owner on Jan 14, 2020. It is now read-only.

DevKitExamples/DevkitDictionary

Repository files navigation

IoT Devkit Dictionary

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.

About IoT DevKit

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.

The status flow of the example:

Status flow

Before you begin

To complete the steps in this tutorial, you need to do the following:

Set up the Environment

Setting up the Azure Environment (Bing Speech API)

  1. Log in to the Azure portal.

  2. Create a new Speech Service by searching Speech in Azure portal and click Create.

    Create Bing Speech API

  3. 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.

  4. 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.

    Copy Bing Speech API key1

Register for Oxford Dictionaries APIs

  1. Visit the developer site of Oxford Dictionaries

  2. 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
  3. The website will send you an email and please follow the instruction to activate your account.

  4. Sign into your account and click on “Credentials”

  5. Copy the Application Id and Application Keys. We will use them in the following session.

    Register Oxford Dictionaries

Run the application

  1. Start VS Code first, and then connect the IoT DevKit to your computer.

  2. Use F1 orCtrl+Shift+P (macOS: Cmd+Shift+P) to open the command palette, type Azure IoT Device Workbench, and then select Open Examples....

    IoT Device Workbench: Examples

    Select IoT DevKit.

    IoT Device Workbench: Examples -> Select board

    Then the IoT Device Workbench Example window is shown up.

    IoT Device Workbench, Examples window

  3. Find the example of IoT DevKit Dictionary and click Open Sample button.

  4. A new VS Code window with a project folder in it opens.

    IoT Device Workbench: open workspace

  5. 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
  6. 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"
    
  7. Open the command palette and select Azure IoT Device Workbench: Upload Device Code.

    IoT Device Workbench: Device -> Upload

  8. VS Code then starts verifying and uploading the code to your DevKit.

Test the project

  1. Press and hold the A button while saying the word. The recording time is 2 seconds.

  2. Release Button A to stop recording. Wait for the request to be processed.

  3. The definition of the word will appear on the screen. Press button B to scroll the definition.

  4. To start another quest, press A and say another word.

Coding Exercises

Changing Dictionary Language

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

Changing Dictionary Type

API Documentation shows how to call each API and other functions provided by Oxford Dictionaries. These include translations, synonyms (Thesaurus) and other functionalities.

Problems and feedback

If you encounter problems, you can find FAQs if you encounter problems or reach out to us from the channels below.

About

Configure DevKit to use Azure Bing Speech API Service and oxford dictionary API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •