Sonicsee project, that explains to the deaf what the lecturer is saying

#include <Wire.h> // Include the Wire library for I2C communication
#include <LiquidCrystal_I2C.h> // Include LCD library
#include <SoftwareSerial.h> // Include SoftwareSerial library for speech recognition module

#define SPEECH_RX_PIN 2 // Speech Recognition Module RX pin (connects to Arduino TX pin)
#define SPEECH_TX_PIN 3 // Speech Recognition Module TX pin (connects to Arduino RX pin)
#define VIBRATOR_PIN 5
#define IR_SENSOR_PIN 8

SoftwareSerial mySerial(2, 3); // RX, TX pins for speech recognition module
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD I2C address to 0x27

unsigned long lastSeenTime = 0;
const unsigned long eyeContactDuration = 60000; // 1 minute in milliseconds

void setup() {
// Initialize serial communication with speech recognition module
mySerial.begin(9600);

// Initialize LCD display
lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Listening...");

// Initialize IR sensor pin
pinMode(IR_SENSOR_PIN, INPUT);
// Initialize vibrator pin
pinMode(VIBRATOR_PIN, OUTPUT);

// Wait for the speech recognition module to start
delay(500);
}

void loop() {
// Check if the user is making eye contact
if (digitalRead(IR_SENSOR_PIN) == LOW) {
lastSeenTime = millis();
} else {
// If the user is not making eye contact for 1 minute, vibrate
if (millis() - lastSeenTime >= eyeContactDuration) {
digitalWrite(VIBRATOR_PIN, HIGH);
delay(1000); // Vibrate for 1 second
digitalWrite(VIBRATOR_PIN, LOW);
}
}

// Check if there is data available from the speech recognition module
if (mySerial.available() > 0) {
// Read the incoming byte
char receivedByte = mySerial.read();

// If the received byte is not noise (e.g., a spoken word)
if (receivedByte != ' ') {
  // Display the received byte on the LCD
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Spoken: ");
  lcd.setCursor(0, 1);
  lcd.print(receivedByte);
}

}
}

Your topic has been moved. Please do not post in "Uncategorized"; see the sticky topics in Uncategorized - Arduino Forum.

Please use code tags (as described in How to get the best out of this forum) when providing code; it makes it easier to read, easier to copy and the forum software will display the code properly.


Does it work? Or do you have a question?

Which speech recognition module?

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.