peicen xie
Published © GPL3+

Blindness-aiding environment sensing device

Sensing environmental information and outputting information by voice

BeginnerWork in progress8 hours205
Blindness-aiding environment sensing device

Things used in this project

Hardware components

Seeed Studio XIAO ESP32S3 Sense
Seeed Studio XIAO ESP32S3 Sense
×1
Raspberry Pi 4 Model B
Raspberry Pi 4 Model B
×1
Camera Module
Raspberry Pi Camera Module
×1
Seeed Studio Grove - Vision AI Module V2
×1

Software apps and online services

Seeed Studio Sensecraft AI
Arduino IDE
Arduino IDE

Story

Read more

Code

Arduino code

C/C++
#include <Seeed_Arduino_SSCMA.h>

SSCMA AI;

void setup()
{
  AI.begin();
  Serial.begin(600);
}

void loop()
{
  if (!AI.invoke())
  {
    Serial.println("invoke success");
    Serial.printf("perf: prepocess=%d, inference=%d, postprocess=%d\n",
           AI.perf().prepocess, AI.perf().inference,
           AI.perf().postprocess);
    for (int i = 0; i < AI.boxes().size(); i++)
    {
      Serial.printf(
        "box %d: x=%d, y=%d, w=%d, h=%d, score=%d, target=%d\n", i,
        AI.boxes()[i].x, AI.boxes()[i].y, AI.boxes()[i].w,
        AI.boxes()[i].h, AI.boxes()[i].score, AI.boxes()[i].target);
    }
    for (int i = 0; i < AI.classes().size(); i++)
    {
      Serial.printf("class %d: target=%d, score=%d\n", i,
             AI.classes()[i].target, AI.classes()[i].score);
             delay(2000);
    }
    for (int i = 0; i < AI.points().size(); i++)0
    {
      Serial.printf("point %d: x=%d, y=%d, z=%d, score=%d, target=%d\n",
             i, AI.points()[i].x, AI.points()[i].y,
             AI.points()[i].z, AI.points()[i].score,
             AI.points()[i].target);
    }
  }
}

Raspberry code

Python
#!/usr/bin/env python
import time
import serial
import os
#Set the parameters of the serial port connection for communicating with the device
ser = serial.Serial(
        port='/dev/ttyACM1', # Specifies port to which the device is connected.
baudrate = 115200, # Setting the baud rate for serial communication
parity=serial.PARITY_NONE, # No parity bit is used
stopbits=serial.STOPBITS_ONE, # Using a stop bit
bytesize=serial.EIGHTBITS, # Each byte has 8 data bits
timeout=1 # Set the timeout for reading the serial port to 1 second
)
# Enter an infinite loop that keeps reading the serial port data
while True:
        receive_msg=ser.readline() # Read a line of data from the serial port
        print(receive_msg) # Print received data
# If the received data contains the word "1", perform the following operations:
        if b'1' in receive_msg.lower():
            os.system('echo "people in front" | festival --tts')
# If the received data contains the word ‘0’, do the following:
        if b'0' in receive_msg.lower():
            os.system('echo "chair in front" | festival --tts')
# If the received data contains the word ‘2’, perform the following operations:
        if b'2' in receive_msg.lower():
            os.system('echo " table in front" | festival --tts')

Test results: 

Credits

peicen xie
1 project • 1 follower

Comments