## Introduction: Distance Sensor (for White Cane)

A typical distance sensor has been covered widely by Instructables already. Therefore, I wanted to try an adaptation of this well-known concept, as an application for a white cane.

White canes are the canes used by the blind to tell them where the path is. The circuit and code that I developed with the HC-SR04 sensor sound a beep with greater frequency as the sensor gets closer to an object. Therefore, if the circuit was attached to the end of the white cane, it could be used in unfamiliar terrain or places with no distinct path for the blind. This could help them avoid large objects in areas that they are not too comfortable with.

On top of that, the circuit can also state the distance between the sensor and the object facing it, using an LCD display. This can prove particularly useful in other scenarios such as measuring the size of a room when you don't have a measuring tape on hand.

Here is an Instructables that I believe does the distance sensor aspect of this project quite well, as I won't be going into too much detail with the circuitry

## Supplies

1) 1 x 3V piezo buzzer (link)

2) 1 x LCD screen (link)

3) 40 x Male to Male and Male to female jumper wires (link). You need an assortment of male to male and male to female wire OR if you are comfortable with soldering, you can use any type of wire you want.

4) 1 x HC-SR04 Ultrasonic sensor (link)

6) 1 x Arduino Uno or Arduino Nano with its connecting cable (link)

8) 1 x Potentiometer or trim pot for controlling the LCD's contrast (link)

## Step 1: Wiring the LCD

Pins 2, 3, 4, 5, 11, and 12 of the Arduino is connected to pins 14, 13, 12, 11, 6, and 4 of the LCD, respectively.

Pins 1, 5, and 16 of the LCD are connected to ground.

Pins 2 and 15 of the LCD are connected to +5V.

Pin 3 of the LCD is connected to the middle terminal of the Potentiometer or trim pot. The other two terminals of the Potentiometer or trim pot are connected to ground and +5V.

Pins 7, 8, 9, and 10 of the LCD are not connected to anything.

## Step 2: Connecting the Buzzer and Ultrasonic Sensor

How the circuit works:

The HC-SR04 ultrasonic sensor works on the principle of sound wave reflection. One side of the sensor sends an ultrasonic wave and the other side of the sensor detects it. These two sides are used in conjunction, the trig pin of the HC-SR04 is activated, which causes the sensor to shoot an ultrasonic sound wave. The Arduino then measures the time that is taken for the sound wave to reflect off the object and be detected by the ultrasonic sensor. Knowing this time difference and the speed of sound can help determine the distance between the sensor and object. Here is a link that explains the circuit in more detail.

Once you know the distance, it is pretty easy to set the frequency of the beeps. The frequency is inversely proportional to the distance so that was the equation right there. I played around a bit with the constant to make sure that the beeping was not too annoyingly frequent or too sparsely placed. The ultrasonic sensors are not the most reliable as they give an improper value if the surface that it is pointed at is tilted, or too far, or too close. Therefore, I also implemented a failsafe mechanism which gave a constant beep to inform the user that the ultrasonic sensor has been misoriented.

The connections:

The positive terminal of the buzzer is connected to pin 6. This connection is shown as the pink wire. The negative terminal of the buzzer is connected to ground.

The ultrasonic sensor has 4 pins. The outermost pins, named Vcc and GND, are connected to the +5V rail and ground rail, respectively. The pin labelled trig is connected to pin 9 of the Arduino. This connection is shown as the green wire. The pin labelled echo on the ultrasonic sensor is connected to pin 10 of the Arduino. This connection is shown as the orange wire.

## Step 3: The Code

The code has all been annotated for your reference