michael ma
Created September 4, 2024

Home Asistant with Voice Control

Using Voice Control home equipment for convinient or help.

11
Home Asistant with Voice Control

Things used in this project

Hardware components

Seeed Studio Grove Vision AI V2
×1
Seeed Studio XIAO ESP32S3 Sense
Seeed Studio XIAO ESP32S3 Sense
×1
nRF52 Development Kit
Nordic Semiconductor nRF52 Development Kit
×1

Story

Read more

Code

voice recognize result analysis

Arduino
voice recognize result analysis
#include <Arduino.h>
#include <Seeed_Arduino_SSCMA.h>
#define LIGHT_ON 1
#define LIGHT_OFF 2
#define THRESHOLD 0.7
SSCMA AI;
void turnon_light(){
    Serial1.write(LIGHT_ON);
}
void turnoff_light(){
    Serial1.write(LIGHT_OFF);
}
void setup()
{
    //initial and setup Grove Vision 2
    AI.begin();
    //initial serial debug monitor.
    Serial.begin(9600);
    //initial serial1 for forward control to nRF52830
    Serial1.begin(9600);
    //message application started.
    Serial.print("Voice Control App start!");
}
void loop()
{
    String analysis = "";
    // invoke once, no filter , get image
    if (!AI.invoke(1, false, true))
    {
        for (int i = 0; i < AI.classes().size(); i++)
        {
            if (AI.classes()[i].score > THRESHOLD)
            {
                if (AI.classes()[i].target == LIGHT_ON)
                    turnon_light();
                if (AI.classes()[i].target == LIGHT_OFF)
                    turnoff_light();
            }
        }
    }
    //interval 3 seconds.
    delay(1000);
}

Credits

michael ma

michael ma

6 projects • 2 followers

Comments