Introduction: Ultrasonic Sonar for the Blind and Visually Impaired
This article is intended to show how to build and use an accessibility device I've designed to assist people who are at various levels of visual impairment. The idea behind the device is to use an ultrasonic range-finder sensor, and translate its reading into an audible indication of distance of objects up to 4 meters away, thereby giving a person who is visually impaired a better sense of their immediate surroundings. Aside from the utility of the device, several other key features of the device include that it is wearable, has a long battery life, is fairly light-weight, and is built from rather inexpensive parts.
- Raspberry Pi model B (any revision)
- HC-SR04 ultrasonic sensor
- AYL Portable Speaker Capsule ( Amazon )
- 1k resistor (R1)
- 3 or 4 x Velcro Cinch Straps 3/4"x8" ( Amazon )
- Anker Astro E5 16000mAh Portable Charger ( Amazon )
- Perma-proto board kit ( Adafruit 26 pin for original Raspberry Pi )
- Ribbon cable ( Adafruit 26 pin for original Raspberry Pi OR 40p to 26p downgrade cable if using Raspberry Pi B+/2/3 )
- Printed parts (.STL files provided)
- Assorted screws
- Soldering iron and solder
- Dremel with cutting disc or other sharp tool for removing select traces from the perma-proto board
Fair disclosure at this point, I have only tested this procedure using the oldest revision of the Raspberry Pi model B. I tentatively believe that it should work with the newer revisions since the 40p to 26p ribbon makes it GPIO pin compatible, but I know also that the power requirements vary from one revision to the next, so if you choose to use a newer revision, your mileage may vary.
Step 1: Prepare the Raspberry Pi
I've chosen to base the firmware on the Raspberry Pi for this project on Raspbian, which you can obtain here, along with installation instructions. I've created a basic shell script to help set the Pi up for its role in this project. Once you've installed the Raspbian OS, make sure your Raspberry Pi is connected to the internet and execute the following commands:
sudo sh setup.sh
Running the setup script will take a while. Its purpose is to set some python scripts to run on startup, and also to the set the filesystem to be read-only. Once it is complete, shut the Raspberry Pi down (i.e. "shutdown -h -P now"). If everything went well with the setup script, you won't need to issue the shutdown command from here on out (until you reinstall the OS or mess with fstab to undo the 'ro' setting).
For reference, the setup script and python-based software that will be doing the work on the Raspberry Pi was all developed against 2016-05-27-raspbian-jessie.
Step 2: Print 3D Printable Parts
The .STL files for the 3D printed parts are attached to this instructables article. For this step, grab the files and print the pieces. In terms of print settings, I recommend a 50% infill, with supports, and I also found enabling brims on the first layer to be helpful to support some of the taller supports.
Step 3: Break Traces on Perma-proto Board
The HC-SR04 is going to live on the perma-proto board, but as the board ships, every thru-hole on the board has traces running to it. So we're going to put an end to that. Using a a dremel, a flat-head screwdriver or other sharp utensil, scratch away traces as indicated in the photograph. Take careful note of which side the numbers are printed on, or you may accidentally remove traces on the wrong end of the board.
Step 4: Assemble Perma-proto Board and Components
The components will go on the board as shown in the diagram. Note the direction of the pin header relative to the components, the notch faces away from the sensor and resistor, as we'll be using pins 23 and 24 to connect to the echo and trigger of the HC-SR04 sensor.
For reference, the connections are summarized as follows:
raspi Vcc 5v -> sensor Vcc
raspi pin 24 -> R1 (1k ohms) -> sensor echo
raspi pin 23 -> sensor trigger
raspi Gnd -> sensor Gnd
Step 5: Secure Assembled Perma-proto to Handpiece
Using 4 screws approx. 1/4 inch in length, attach the assembled perma-proto board to the 3D-printed hand piece. At this point, you may also wish to flex the leads of the sensor back a little bit, as the sensor has about a 30 degree field-of-vision, angling it slightly away from the hand may prevent occasional false readings.
Complete this piece by securing one end of the 26-pin ribbon to the header on the perma-proto board so that the ribbon runs away from the HC-SR04 sensor, and then secure the cover piece with 2x approx. 1/2 inch screws. Finally, run a single Velcro strap through the loops on the underside of the piece.
Step 6: Assemble Arm Piece
The 3D printed arm piece has areas for the raspberry pi, speaker, and battery. The orientation of each object is important, note the micro-USB port of the speaker is at the back of the arm-piece. For this step, place the pieces in their respective areas of the 3D printed arm piece as shown in the image, and then secure the cover pieces. Then, run a Velcro strap through each loop of the arm-piece. For additional comfort, a second Velcro strap can be daisy-chained with the rear strap to increase the arm size that it can accommodate.
Step 7: Connect the Arm and Hand Bands
Using your ribbon cable, connect the GPIO pins of the Raspberry PI to the 26 pin header of the hand piece. Be careful not to force either side if it isn't fitting, as doing so may result in bent pins on either side.
At this point, also connect the speaker to the Raspberry Pi using the provided micro-USB to USB and 3.5mm jack. Specifically, you will want to use only the 3.5mm jack and micro-USB connectors. Do not plug the speaker into the Raspberry Pi's USB ports, as this will likely prevent the Pi from booting up due to brown-out.
Step 8: Usage
Now you are ready to test the device. To turn the device on, use the USB-to-USBotg cable that was included with your battery, and run it from a USB port on the battery to the USB-otg power port of the Raspberry Pi. Also, you will need to make sure that the power switch on the speaker is in the "on" position. Bear in mind that the device is using a traditional Linux distribution under the hood, meaning that it will require a moment to boot up. In a moment, the device should begin to emit tones indicating the distance of nearby objects (up to a maximum distance of 4 meters). The sensor can be aimed in any direction to get a reading.
When you're finished with the device, there is no need to issue any type of shutdown to the Raspberry Pi, because it is using a read-only file system. To turn it off, gently remove the USB-to-USBotg cable out of the battery's USB port, and also change the position of the speaker's power switch to "off". The battery and speaker can then be recharged using most standard phone chargers.