Build it step by step
0 of 8 doneSet the boost module
Adjust to 5.0 V with no load.
Wire the Nano and sensors
On a breadboard first.
Wire the motors with transistors
Diodes across the motors.
Upload and bench test
Hand in front of each sensor.
Check the vibration feel
Strong when close, none beyond 150 cm.
Mount on a cane
Angles as described.
Test outdoors in a safe place
With a helper.
Ask the user for feedback
Adjust distances and strength.
How do you build a smart cane for blind users?
Two ultrasonic sensors on a cane warn of obstacles at waist and head height with vibration that grows stronger as the object gets closer. You need Arduino Nano, HC-SR04 Ultrasonic Sensor × 2, Vibration motor (coin type) × 2, BC547 NPN transistor × 2, Resistor 1 kΩ × 2, Signal Diode 1N4148 × 2, 18650 cell 2600 mAh (branded), Battery holder 18650 single, TP4056 module with protection (USB-C), MT3608 Boost Module and Jumper wires male to male (40 pcs, 20 cm). It takes 8 steps and about 180 minutes.
- Level
- Intermediate
- Time
- About 180 min
- Parts
- 11
Wiring
| From | To | Why |
|---|---|---|
| Low HC-SR04 VCC, GND | 5 V rail and GND | Sensor pointing forward and slightly down |
| Low HC-SR04 TRIG, ECHO | Nano D2, D3 | Waist-level obstacles |
| High HC-SR04 VCC, GND | 5 V rail and GND | Sensor pointing forward and up |
| High HC-SR04 TRIG, ECHO | Nano D4, D5 | Head-level obstacles |
| Nano D9 | 1 k to BC547 base, emitter to GND | Low-sensor motor driver |
| Nano D10 | 1 k to BC547 base, emitter to GND | High-sensor motor driver |
| Each coin motor | Plus to the 5 V rail, minus to its BC547 collector, 1N4148 across the motor (stripe to plus) | Vibration |
| 18650 holder | TP4056 module with protection B+ and B- | Charging and cell protection |
| TP4056 OUT+ and OUT- | MT3608 IN+ and IN- | Boost input |
| MT3608 OUT | Nano 5V pin and the 5 V rail, set to 5.0 V before connecting | Regulated 5 V |
Code
Each HC-SR04 sends a burst of sound and times the echo; distance in centimetres is the echo time in microseconds divided by 58. One sensor points forward and slightly down to catch things at waist level and the other points up for head-height hazards such as low branches. The two are read one after the other with a short pause, because their pings could confuse each other. Each distance becomes a vibration strength, stronger as the object gets closer, and the two sensors feel different: waist level is a steady buzz and head level is pulsing, so the user can tell them apart without looking. Coin motors are driven through BC547 transistors, with a 1N4148 diode across each motor to absorb the voltage spike when it switches off. The cane is powered by a single 18650 cell on a protected TP4056 module, boosted to 5 V by an MT3608. Turn the MT3608's trimmer to read exactly 5.0 V on a multimeter before you connect the Nano, because many modules ship at a higher voltage that would damage it. Never charge the cell unattended, and use a protected cell and the protected module only. Ultrasonic sensors miss thin poles, soft clothing and steps down, so this device warns of some obstacles only; it is an extra aid and must not replace a white cane or training. Test it first with a sighted helper in a safe open space, then with the actual users and ask for their feedback. Setup: Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Obstacle warning cane. An aid, never a replacement for a white cane or other mobility training.
const uint8_t TRIG_LOW = 2, ECHO_LOW = 3, TRIG_HIGH = 4, ECHO_HIGH = 5;
const uint8_t MOTOR_LOW = 9, MOTOR_HIGH = 10;
const int NEAR_CM = 20, FAR_CM = 150; // vibration starts at 150 cm and is strongest at 20 cm
const uint8_t MAX_PWM = 170; // about 67 percent, keeps a 3 V coin motor safe
int readCm(uint8_t trig, uint8_t echo) {
digitalWrite(trig, LOW); delayMicroseconds(2);
digitalWrite(trig, HIGH); delayMicroseconds(10);
digitalWrite(trig, LOW);
unsigned long us = pulseIn(echo, HIGH, 12000UL); // give up after about 2 m
if (us == 0) return 999; // nothing seen
return us / 58;
}
uint8_t strength(int cm) {
if (cm >= FAR_CM) return 0;
if (cm <= NEAR_CM) return MAX_PWM;
return map(cm, FAR_CM, NEAR_CM, 30, MAX_PWM);
}
void setup() {
pinMode(TRIG_LOW, OUTPUT); pinMode(ECHO_LOW, INPUT);
pinMode(TRIG_HIGH, OUTPUT); pinMode(ECHO_HIGH, INPUT);
pinMode(MOTOR_LOW, OUTPUT); pinMode(MOTOR_HIGH, OUTPUT);
}
void loop() {
int low = readCm(TRIG_LOW, ECHO_LOW);
delay(30); // let the first echo die before the second ping
int high = readCm(TRIG_HIGH, ECHO_HIGH);
analogWrite(MOTOR_LOW, strength(low)); // steady buzz for waist level
bool pulse = (millis() / 120) % 2; // pulsing buzz for head level
analogWrite(MOTOR_HIGH, pulse ? strength(high) : 0);
delay(30);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Hand at 100 cm in front of the low sensor | Gentle steady vibration |
| Hand at 20 cm | Strongest steady vibration |
| Hand in front of the high sensor | Pulsing vibration |
| Nothing in front | No vibration |
| Run for ten minutes | Nothing gets hot |
If it does not work
Constant vibration
Sensors seeing each other or a cane edge; adjust the angle.
No vibration
Check the transistor pins (E, B, C) and diode direction.
Nano resets when motors start
Boost module too weak or loose wire; add a 100 uF capacitor on 5 V.
Readings jump
Soft objects and angles confuse ultrasound.
Cell drains quickly
Motors at full strength; lower MAX_PWM.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the smart cane for blind users?
Arduino Nano, HC-SR04 Ultrasonic Sensor × 2, Vibration motor (coin type) × 2, BC547 NPN transistor × 2, Resistor 1 kΩ × 2, Signal Diode 1N4148 × 2, 18650 cell 2600 mAh (branded), Battery holder 18650 single, TP4056 module with protection (USB-C), MT3608 Boost Module and Jumper wires male to male (40 pcs, 20 cm).
How long does the smart cane for blind users take to build?
About 180 minutes for a intermediate maker, in 8 steps.
How do I know the smart cane for blind users works?
Hand at 100 cm in front of the low sensor: Gentle steady vibration. Hand at 20 cm: Strongest steady vibration. Hand in front of the high sensor: Pulsing vibration.
Constant vibration: what should I check?
Sensors seeing each other or a cane edge; adjust the angle.
No vibration: what should I check?
Check the transistor pins (E, B, C) and diode direction.
Nano resets when motors start: what should I check?
Boost module too weak or loose wire; add a 100 uF capacitor on 5 V.
Readings jump: what should I check?
Soft objects and angles confuse ultrasound.
