We can create this simple and beginner DIY Smart Cane project using an ultrasonic sensor and Arduino Nano board.

About DIY Smart Cane Project

In this project, we will make an intelligent Smart Cane for the visually impaired. I believe the words of Hugh Herr “Humans are not disabled. A person can never be broken. Our built environment, our technologies, is broken and disabled. We the people need not accept our limitations, but can transfer disability through technological innovation”. When I see the Arduino nano and Ultrasonic sensor, I think, let’s make an ultrasonic blind walking stick.

Smartcains detect the obstacle in front of the person and respond to the person by vibrating the stick and with a warning sound. Through this, the visually impaired person can know the obstacles in front of him.

The components used to make this is really cheap and readily available. The total cost does not exceed 12$

We have other tutorials about the Ultrasonic and Buzzer that you may find helpful:

Complete Guide on Arduino and HC-SR04 Ultrasonic sensor

Interfacing Buzzer with Arduino nano step-by-step guide

Parts Required

  • Arduino Nano – Purchase on Amazon
  • Copper Wire- Purchase on Amazon
  • Ultrasonic Sensor-Purchase in Amazon
  • Buzzer _Purchase on Amazon
  • Battery and connecter 9V
  • Switch -Purchase on Amazon
  • Small Vibrating Motor- Purchase in Amazon

Other tools and parts used in this project

  • 1 inch PVC pipe
  • 1 inch PVC elbow
  • Soldering Iron -Purchase on Amazon
  • Soldering Lead -Purchase in Amazon
  • Corrugated plastic
  • Adhesive Glue
  • M-Seal

Vibrator motor I collected from my old phone. If you don’t have a batter connecter and switch, you can try it with a regular power bank and USB cable to connect Nano for programming. Once you collect all the components, the next is to use solder and connect wires to the Buzzer, vibratinMotoror, etc. It’s an easy job. You can see the video tutorial for reference purposes.

After completing the same, We can move to make connections.

Prerequisites for DIY Smart Cane

We’ll program the Arduino nano using Arduino IDE. So, make sure you have the Arduino IDE installed before proceeding:

Arduino IDE Installation guide

Let’s Make the Stick

Here I am using a PVC available in my house. Just take 1.5 meter PVC and 1 Elbow connecter, and the Bottom of the PVC I connected small corrugated plastic and stuck together using M-SEAL. That setup is for holding the Ultrasonic sensor.

Schematics

Refer to the schematics and make connections accordingly. First, we are going to connect the Ultrasonic sensor with Nano.

Here we use Digital pins 10 and 9 to connect the Trigger pin and Echo Pins. VCC connect to %V, and Gnd is connected to the GND pin in Nano.

Next, we will connect the Buzzer, the Positive terminal of the Buzzer to Digital pin 11, and the Negative terminal to the ground.

Next, we connect the Vibrating motor +ve terminal to digital pin 12 and another pin to the ground.

The battery connecter and switch module are connected separately. Arduino Nano Vin pin can take voltage from 9 to 12v, so we connect the pin for the Button switch to Vin and –ve terminal from battery to GND Nano.

After that, I Assembled these items in the PVC stick I created

We are making this a separate circuit because we don’t need this module while programing. If Those who don’t have a battery connecter and switch can avoid this circuit and try with the power bank you have, you need to power the Nano using the same USB cable used for programming

Code

Now it’s time to upload the Arduino sketch to Nano. Just copy and paste the code to your Arduino IDE and plug your Arduino nano into the PC. Verify the code and Upload it. After successfully uploading, unplug the Arduino board and connect the power supply

// defines pins numbers

const int trigPin=9;
const int echoPin=10;
const int motor=12;
const int buzzer=11;

// define the duration and distance variables

long duration, distance;
void setup()
{ 
  pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin, INPUT);  // Sets the echopin as an Input
  pinMode(motor, OUTPUT);  // Sets the motor as an Output
  pinMode(buzzer,OUTPUT);   // Sets the buzzer as an Output
}

void loop()
{
    // Clears the trigPin
  digitalWrite(trigPin, LOW); 
  delayMicroseconds(2); 
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10); 
  digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration*0.034/2;

if (distance < 20) // Checking the distance, you can change the value
{ 
digitalWrite(motor,HIGH); // When the the distance below 20cm
digitalWrite(buzzer,HIGH);
} else
{
digitalWrite(motor,LOW);// when greater than 20cm
digitalWrite(buzzer,LOW); 
} delay(500);
}

Watch the Demonstration Video

How code Works

First, you need to set the PINs you will use for connecting Arduino nano with Buzzer, ultrasonic sensor and vibratinMotoror. We declare variables to store the PINs and Duration and Distance.

// defines pins numbers

const int trigPin=9;
const int echoPin=10;
const int motor=12;
const int buzzer=11;

// define the duration and distance variables

long duration, distance;

Next, you want to set which pin control as an OUTPUT and Which pin to INPUT, for buzzer pin 11 as OUTPUT, Vibrating Motor pin 12 as OUTPUT and Echopin 10 as INPUT, and Trigger pin 9 as OUTPUT.

pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin, INPUT);  // Sets the echopin as an Input
  pinMode(motor, OUTPUT);  // Sets the motor as an Output
  pinMode(buzzer,OUTPUT);   // Sets the buzzer as an Output

In the loop(), trigger the sensor by sending a HIGH pulse of 10 microseconds. But, before that, give a short LOW pulse to ensure you get a clean HIGH pulse.

    // Clears the trigPin
  digitalWrite(trigPin, LOW); 
  delayMicroseconds(2); 
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10); 
  digitalWrite(trigPin, LOW);

Then, you can read the signal from the sensor – a HIGH pulse whose duration is the time in microseconds from the sending of the signal to the reception of its echo to an object.

// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

Finally, you need to convert the duration to a distance. We can calculate the distance

// Calculating the distance
distance = duration*0.034/2;

Next, we check the length by implementing an If Loop Function. If the distance between the obstacle and the Smart cane is less than 20 cm, it triggers the Buzzer and vibrator; otherwise, it remains off

if (distance < 20) // Checking the distance, you can change the value
{ 
digitalWrite(motor,HIGH); // When the the distance below 20cm
digitalWrite(buzzer,HIGH);
} else
{
digitalWrite(motor,LOW);// when greater than 20cm
digitalWrite(buzzer,LOW); 
} delay(500);

Smart-Cane

DIY smart cane
binary comment

Get Started with Arduino Development board
Arduino IDE Installation guide
Getting Started with Arduino IDE in Windows OS
Complete Guide on Arduino and HC-SR04 Ultrasonic sensor
Interfacing Buzzer with Arduino nano step-by-step guide

Author

Write A Comment