Shunchao GaoXinqi OuSiting ChenYu Wu
Published

Team Forty Thousand's Project: Wade Word Detection

Our team's name is Forty Thousand. This project aims at detecting wake words like 'Yes' and 'No'. It runs on the board Arduino Nano 33 BLE.

BeginnerWork in progress501
Team Forty Thousand's Project: Wade Word Detection

Things used in this project

Hardware components

Arduino Nano 33 BLE Sense
Arduino Nano 33 BLE Sense
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

TensorFlow Lite
TensorFlow Lite

Story

Read more

Schematics

Schematics

Code

arduino_command_responder.cpp

C/C++
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "command_responder.h"

#include "Arduino.h"

// Toggles the built-in LED every inference, and lights a colored LED depending
// on which word was detected.
void RespondToCommand(tflite::ErrorReporter* error_reporter,
                      int32_t current_time, const char* found_command,
                      uint8_t score, bool is_new_command) {
  static bool is_initialized = false;
  if (!is_initialized) {
    pinMode(LED_BUILTIN, OUTPUT);
    // Pins for the built-in RGB LEDs on the Arduino Nano 33 BLE Sense

    // First turn off all the lights.
    pinMode(LEDR, OUTPUT);
    digitalWrite(LED_BUILTIN, HIGH);
    is_initialized = true;
  }
  static int certainty = 220;

  if (is_new_command) {
    error_reporter->Report("Heard %s (%d) @%dms", found_command, score,
                           current_time);
    // If we hear a command, light up the appropriate LED.
    // Note: The RGB LEDs on the Arduino Nano 33 BLE
    // Sense are on when the pin is LOW, off when HIGH.
    if (found_command[0] == 'y') {
      // When the input is "Yes", turn on the light
      digitalWrite(LEDR, LOW); 
    }

    if (found_command[0] == 'n') {
      // When the input is "No", turn off the light
      digitalWrite(LEDR, HIGH);
    }
  }
}

Train_Speech_Model

Credits

Shunchao Gao
1 project • 0 followers
Contact
Xinqi Ou
1 project • 0 followers
Contact
Siting Chen
0 projects • 0 followers
Contact
Yu Wu
0 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.