Introduction: Raspberry Pi Voice Navigation Helping Blind People
Hi In this instructable we are going to see how a raspberry pi can help the blind people using the user-defined voice instruction.
Here, With the help of the Ultrasonic sensor input to measure the distance we can voice guide the blind people to follow the path. Also, I am planning for the cheap module which could solve this problem guiding the way to the Blind people.
This is the Idea to implement them in the raspberry pi, which is being the very tiny full-featured computer in our palms. I will also soon make a software in the ubuntu os, So that person without the technical background can make use of it help Blind people.
Also If you have any Idea or suggestions feel free to make a comment.
Output is below
" frameborder="0" allowfullscreen>
Step 1: RASPBERRY PI Setup
Without wasting much time in the intro I will get into the setup of the Raspberry pi here, If you are familiar you may skip these Steps:
- After buying the raspberry pi, Download the os from the any of the one mentioned in this link https://www.raspberrypi.org/downloads/
- Mount the Os Image onto the SD card using any of the mounting software such as Etcher.
- Using any one of the display devices, set the IP address of the raspberry pi and install the VNC server in the raspberry pi (NOTE: you may also use the X-ming and putty ssh or any other )
- Install the VNC viewer in your laptops and connect the raspberry pi to the LAN cable. Enter the IP address and password for the VNC ( you will be directed to the Graphical interface of the raspberry pi in your laptop or computer screen.
- Thus you are ready with your raspberry pi to program things with ease.
If you could not follow these setup steps you may watch my video I will upload it soon.
- This is the method I follow to connect the raspberry pi to the computer or the laptop
- If you are having a separate Monitor, Keyboard, and mouse dedicated for your raspberry pi, you may not follow these steps, you may skip directly.
After you set up the raspberry pi you may proceed to the next step to follow with me...
Step 2: Ultrasonic Sensor
The ultrasonic sensor is a sound based sensor which we would be using it to measure the distance of the obstacle.
It can be used to measure the distance from the obstacle precise to 2 meters(200 cm). Before going to the construction, let us see its basic working.
Working is very simple as we all know the speed formula is Distance divided by time.
- The speed of the sound is approximately around 343 meters/ sec.
- The time between the transmitter and the receiver is measured by the sensor.
- Thus applying this formula distance is measured by the microcontroller.
Here we are giving the time values to our raspberry pi and depending on the values of the time it calculates the value of the distance of the obstacle.
There are 4 outputs in the Ultrasonic Sensor module:
2 for the power supply and remaining 2 are Trigger and Echo :
As the name indicates it will trigger the transmitter of the module for certain time intervals.
Echo pin will receive the reflected sound wave and give it to the controller (here raspberry pi in this case)
Step 3: Connections
In the raspberry pi there are set of around 40 pins called as GPIO(General Purpose Input Output Pins). Make the voltage divider circuit before connecting the Ultrasonic sensor to the raspberry pi.
you may follow this link to get more info about the connections and selection of the resistors.
Ultrasonic sensor :
- Here we connected the Trigger pin to 23 and Echo to 24(BCM)
- Power supply to the ultrasonic sensor can be given from the 5v and GND of the raspberry pi.
- The speaker or the headphone has to be connected to the audio jack of the raspberry pi.( as simple as connecting a headphone to the phone or laptop's audio jack)
There are 2 sets of the Pin mode in the raspberry pi so be clear before connecting the ultrasonic sensor to the Raspberry pi. Here I use the BCM pin mode for connection to the raspberry pi. Also, you may also choose any pin of your need.
Step 4: Setting Up VOICE on the Raspberry Pi
Thus for each distance below certain critical value, we need to introduce the voice alert to the blind people.
Thus there are many such options for the Voice setup in the raspberry pi. Be it a single beep sound to the Engish or any language voice alert can be made as per our wish.
If you want the distance to speak out like "distance is 120cm Caution..!!!" we need to a program such as it speaks out the text message to the voice.
PYTHON TEXT TO SPEECH :
As the raspberry pi runs the python script it is easy for us to make the text to speech in the raspberry pi. There are many options for the text to speech in the python. There are basically two main methods of the text to speech one is Online mode and Offline mode.
- Online Text to speech: it requires the stable internet connection for this. Clarity of these is very high. The popular are google text to speech, amazon's, windows one. There are API for this to connect to the python script.
- OffilenText to speech: It is rather simple means. It does not require any internet connections. Clarity is little low and also robotic and can only be used in the English language.
Here I have used the offline text to speech considering the fact that we cannot ensure the stable internet connection in all the places.
Make a look at this website for more details regardin:https://elinux.org/RPi_Text_to_Speech_(Speech_Synt...
INSTALLING TEXT TO SPEECH IN RASPBERRY PI (PYTTX and espeak):
- Download the py text to speech in raspberry pi from here in this link below: https://pypi.python.org/packages/source/p/pyttsx/...
- Unzip the the folder either by the command line code or on the GU screen.
- In the terminal go to the folder where you have the file setup.py by entering the code "cd pyttsx-1.1/" in the terminal.
- Install the setup by typing the following code "sudo python setup.py install"
- Also from the terminal install the espeak module by typing "sudo apt-get install espeak"
cd pyttsx-1.1/ sudo python setup.py install sudo apt-get install espeak
Thus we have set up the voice in the raspberry pi finally. Thus we are ready to compile the program and see the results.
Step 5: CODING
Thus we have come to the final part of this we are ready to get our raspberry pi working.
Thus in the loop, we are going to check the distance of the obstacle. If it was higher than that distance limit we are going to alert the people.
Github link > https://github.com/ranga95/instructables-voice-nav...
import RPi.GPIO as GPIO
import time import pyttsx engine = pyttsx.init() GPIO.setmode(GPIO.BCM)
TRIG = 23 ECHO = 24 while 1:
GPIO.setmode(GPIO.BCM) print "Distance Measurement In Progress" GPIO.setup(TRIG,GPIO.OUT) GPIO.setup(ECHO,GPIO.IN)
GPIO.output(TRIG, False) print "Waiting For Sensor To Settle" time.sleep(2)
GPIO.output(TRIG, True) time.sleep(0.00001) GPIO.output(TRIG, False)
while GPIO.input(ECHO)==0: pulse_start = time.time()
while GPIO.input(ECHO)==1: pulse_end = time.time() pulse_duration = pulse_end - pulse_start
distance = pulse_duration * 17150
distance = round(distance, 2)
print "Distance:",distance,"cm" if distance <= 10: engine.say("Alert") engine.runAndWait() time.sleep(2) GPIO.cleanup()
Save this code in the raspberry pi and execute the code form the terminal by entering
also, you can change the text to voice as per your wish.
sudo python name.py
Where sudo describes the administrative power in the raspberry pi.
Step 6: Practical Output
Output video is posted at the top of this instructables make a look at it.
Step 7: Conclusion
This is my Idea of doing something to blind people. If you have any suggestions or idea make a comment, it could be a great impact to the life of the blind people.
The people who don't have the raspberry pi can try these with their computer and Arduino or simply with the computer just by executing the software simulator which will produce the voice for the press of the key. I have designed so that you can visualize the output of this.
Also If you have tried any of the other text to speech or any other kindly comment.
Also, make a visit to my website at www.engineerthoughts.com for many technologies related projects.
I will soon upload my simulator software of the windows version in my Github here :https://github.com/ranga95
Thanks for reading
With Gods blessing let the difficulties of the differently able people be over.