Smart Glasses for Blind Prototype

This are the smart glasses which can tell you about how much far/near the object is in front of you. Helpful for blind people.

Project description

I am strong believer of technology can be very useful to human beings, if put to good use. Just like that, a little piece of tech – “Arduino(mini computer)'” is so much powerfull.

So I thought why not make a prototype of glasses which can be able to detect the objects in front of them, and tell the user by speaking.

This smart_glasses can make a huge impact in the lives of blind people. So I thought to make atleast a prototype.

Working:

This works as in the utrasonic sensor which is mounted on the head of the glasses, constantly keep on detecting the objects in front of them, if the object comes near than 30 cm, the arduino is programmed along with a high-level language python3, to speak to the user to "STOP! STOP! THERE IS A OBJECT VER NEAR TO YOU." through the earphones.

Python3 code

import serial #serial import for serial communications
import time
import  pyttsx3
import speech_recognition as sr

engine = pyttsx3.init('sapi5')
voices  = engine.getProperty('voices')
#print(voices[1].id)
engine.setProperty('voice',voices[1].id)

ArduinoSerial  = serial.Serial('com3',9600) #Create Serial port object called arduinoSerialData


def  speak(audio):
    engine.say(audio)
    engine.runAndWait()

def takecommand():
    #It takes microphone input from the user and returns string as output

    r = sr.Recognizer()
    with sr.Microphone() as source:
        print("Listening....")
        r.pause_threshold = 1
        audio = r.listen(source)

    try:
        print("Recogninsing....")
        query = r.recognize_google(audio,  language = 'en-in')
        print(f"User said: {query}\
")

    except  Exception as e:
        print(e)
        print("Say that again please...")
        return "None"
    return query

if __name__ == "__main__":
    while True:
     
        query = takecommand().lower()
        #logic  for executing tasks based on query

        distance = int(ArduinoSerial.readline())  #read the serial data and print it as line
        dist=str(distance)
        print(dist)
        if "where is the object" in query:
            if (distance<20):
                    speak("StopStop, Close object in front.")
            
                
            elif (20<distance<60):
                    speak("object  is quite a distance away.")
                    
            elif (40<distance<100):
                    speak("object is 1 meter away.")

            else:
                    speak("Object is far away.")
        
        else:
            print("nothing")
        

Similar Posts

Leave a Reply