Smart Blind Stick using ESP32 with GPS and SOS - Proteus Simulation: an HC-SR04, a coin vibration motor, a water sensor, a NEO-6M GPS and an SOS button on an ESP32

Smart Blind Stick using ESP32 with GPS and SOS - Proteus Simulation

40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the Smart Blind Stick using ESP32 with GPS and SOS - Proteus Simulation, project 111 of our IoT Projects series. A white cane tells a blind person what is right in front of the tip, but not the open door at head height, the low wall one step ahead or the puddle on the path. A smart blind stick adds the senses the cane is missing: it feels obstacles ahead with ultrasound and tells its user by vibration and sound, it warns about water on the ground, and with a press of a button it calls the family for help with its GPS position. It is one of the most popular final year and science fair projects, and here is a complete one on an ESP32, with the circuit, the Arduino code and a Proteus simulation you can run before you build the stick.

An HC-SR04 ultrasonic sensor looks ahead 16 times a second. Under one metre, a small coin vibration motor in the handle starts to buzz gently; the closer the obstacle comes, the stronger it vibrates, and under half a metre a buzzer beeps faster and faster, until a steady tone at 20 cm says stop. A water sensor at the tip notices a puddle, an LDR turns a white light on at dusk so drivers can see the stick, and an SOS button beeps S O S in Morse and shows the GPS position on a web dashboard that the family can open on any phone. In this tutorial, we will go through the circuit, how each warning works, the GPS sentence the ESP32 reads by itself, and the code. Then we walk the stick towards a wall, into a puddle and into the night in the simulation, and press SOS. At the end, you can download the project with the sketch and every library file.

NOTICE: Our team has put a lot of effort into this project: the circuit, the code and every part in the simulation are our own work, and you get them all free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below. And if our free projects help you, you can buy us a coffee. So, let's get started with the smart blind stick using ESP32 in Proteus simulation:

Smart Blind Stick using ESP32 with GPS and SOS - Proteus Simulation: an HC-SR04, a coin vibration motor, a water sensor, a NEO-6M GPS and an SOS button on an ESP32
Figure: The smart blind stick in a Proteus simulation.
Smart blind stick using ESP32 Proteus simulation: an obstacle coming closer, water, the night light and an SOS
Figure: The project working in the Proteus simulation (an animation of the main steps).

What Does This Smart Blind Stick Do?

  • Obstacle warning by touch: a coin vibration motor in the handle, stronger as the obstacle comes closer, so the user feels the distance.
  • Obstacle warning by sound: beeps that speed up under 50 cm and a steady tone under 20 cm.
  • Water ahead: a water sensor at the tip; three short beeps and buzzes every 1.5 s while it is wet.
  • A light at night: an LDR turns a bright white LED on in the dark so drivers and cyclists see the stick.
  • SOS with GPS: a button sends an SOS with a Google Maps link to the family's dashboard and beeps S O S in Morse.
  • Help is coming: ACK on the dashboard gives the user three long buzzes; FIND makes a lost stick beep for 10 s.

In the simulation, the HC-SR04's pop-up moves a wall in front of the sensor, the water sensor's pop-up fills its little tank, the LDR's pop-up turns the day into night, and the coin motor's pop-up shows how fast it spins and how hard it shakes.

Components Used in the Proteus Simulation

All the parts come from our Proteus libraries, each with its own tutorial. The project zip at the end includes every LIB and DLL file.

The parts of the smart blind stick and their library posts
PartProteus deviceLibrary postConnection
ESP32 DevKit V1ESP32 DEVKIT V1ESP32 DevKit V1 Library for ProteusU1, ESP32_Blind_Stick.hex, TEP-WiFi 192.168.1.101
HC-SR04 ultrasonic sensorHCSR04ADVTEPUltrasonic Sensor Library for ProteusU2: TRIG D5, ECHO D18, 5 V
Water sensorWATERLEVELADVTEPWater Sensor Library for ProteusU3 at the tip: S on D35, 3.3 V
NEO-6M GPSNEO6MADVTEPNEO-6M Library for ProteusU4: TX to RX2 (GPIO16), RX from TX2 (GPIO17)
LDR moduleLDRADVTEPLDR Sensor Library for ProteusU5: A0 on D34, 3.3 V
DRV8833 motor driverDRV8833TEPDRV8833 Motor Driver Library for ProteusU6: IN1 D25 (PWM), EEP D27
Coin vibration motorCOINVIBTEPCoin Vibration Motor Library for ProteusM1 on OUT1 / OUT2
Active buzzerBUZZERACTIVETEPActive Buzzer Library for ProteusBZ1 on D26
Push buttonBUTTONREDTEPPush Button Library for ProteusSW1 SOS: 3.3 V to D4
SMD resistorsRESISTORSMD1206TEPSMD Resistor Library for ProteusR1 100 ohm (the LED), R2 10k (pull-down)
White 5 mm LEDLED5MMWHITETEP5mm LED Library for ProteusD1 the light, from D13
Laptop WiFi MonitorLAPTOP WIFI MONITORLaptop WiFi MonitorPC1
Mobile WiFi MonitorMOBILE WIFI MONITORMobile WiFi MonitorMOB1

Proteus Simulation of the Blind Stick: the Circuit

Smart blind stick Proteus simulation circuit: an ESP32, an HC-SR04, a water sensor, a NEO-6M, an LDR, a DRV8833 and a coin motor
Figure: The complete circuit of the smart blind stick on an A3 Proteus sheet.
The connections of the smart blind stick
SignalESP32 pinGoes to
TRIG / ECHOD5 / D18the HC-SR04: a 10 us trigger, the echo pulse back
WATERD35 (ADC1)the water sensor's S output, above 0.6 V = wet
LDRD34 (ADC1)the LDR module's A0, rising in the dark
GPSTX / GPSRXRX2 GPIO16 / TX2 GPIO17the NEO-6M at 9600 baud
VIB / EEPD25 / D27the DRV8833: the PWM on IN1, its sleep pin
BUZD26the active buzzer
LIGHTD13the white LED through R1
SOSD4SW1 to 3.3 V, R2 10k to ground

The HC-SR04, the GPS and the DRV8833 run from the 5 V rail; the water sensor and the LDR module from 3.3 V, so their analog outputs stay inside the ESP32's ADC range. Both analog inputs are on ADC1 (D34 and D35), which keeps working while Wi-Fi is on; ADC2 pins do not. The coin motor never connects to a GPIO pin directly: it draws around 70 mA, so the DRV8833 drives it, and the ESP32 only sends the PWM.

How the Smart Blind Stick Works

Measuring the Distance

Every 60 ms the ESP32 sends a 10 microsecond pulse to TRIG. The HC-SR04 answers with a burst of ultrasound and holds ECHO high until the echo comes back. Sound travels about 343 metres per second, there and back, so the length of the ECHO pulse in microseconds divided by 58 is the distance in centimetres. If nothing echoes within 30 ms, about 5 m there and back, the way ahead is clear. 60 ms between pings lets the last echo die away before the next one.

Three Zones and a Little Hysteresis

The distance falls into one of four zones. Over a metre is CLEAR and the stick is silent. Under 100 cm is AHEAD: something is coming, and the handle buzzes gently. Under 50 cm is NEAR: the buzz gets stronger and the buzzer beeps, faster as the gap closes. Under 20 cm is STOP: full vibration and a steady tone. A wall at exactly 50 cm would make the stick flip between two zones with every ping, so going back to a farther zone needs 5 cm more than coming in: from NEAR to AHEAD only above 55 cm. The user feels a steady warning instead of a nervous one.

Telling the Distance by Touch

A blind person often prefers vibration to sound, because the ears are busy listening to traffic. The vibration motor's strength follows the distance: 60 percent of full at 100 cm, rising in a straight line to full at 20 cm. Why not start lower? Our first simulation run started at 30 percent, and the coin motor's pop-up showed why that does not work: at 1.16 V the motor turned at only 1,784 RPM and shook with 0.02 g, far too little to feel. The shaking force grows with the square of the speed, so a coin motor needs about half its rated voltage before a hand notices it. Full is 60 percent of the PWM, because the coin motor is a 3 V part and the DRV8833 runs from 5 V; 60 percent of 5 V is 3 V on average. When there is nothing to tell, the ESP32 pulls the DRV8833's EEP pin low and the driver sleeps, which saves battery in a stick that runs all day.

Water on the Ground

The water sensor is a board with long exposed traces at the bottom of the stick. Dry, its output is near 0 V; in water, the traces conduct and the output rises. When it has stayed above 0.6 V for half a second the stick says WATER, and below 0.4 V DRY again. The half second keeps a single splash or a wet leaf from raising the alarm, and the gap between the two voltages stops it from chattering at the edge of a puddle. The warning has its own pattern so the user cannot mix it up with an obstacle: three short beeps and three short buzzes every 1.5 seconds.

A Light for the Night

A blind person does not need light, but drivers and cyclists need to see the stick at night. The LDR module's output rises as the light falls. Above 2.0 V the stick decides it is DARK and turns on the white LED near the tip; below 1.5 V, DAYLIGHT, and the LED goes off. The gap between the two numbers stops the light from flickering at dusk.

SOS with the GPS Position

The NEO-6M sends NMEA sentences, lines of text, once a second. The sketch reads them without any library: it collects a line, checks the checksum after the star, and uses the $GPRMC sentence, which has the time, a fix flag, the latitude, the longitude and the speed. The latitude comes as degrees and minutes, ddmm.mmmm, so the sketch turns it into decimal degrees for a Google Maps link. A press of the SOS button starts the alarm at once: the buzzer beeps S O S in Morse code, three short, three long, three short, the LED flashes, and the dashboard shows SOS with the map link. If the press was a mistake, holding the button for 3 seconds cancels it.

The Family's Side: ACK and FIND

The dashboard at http://192.168.1.101/ is the family's view. During an SOS it shows the time and the place. ACK tells the stick that someone is coming: the Morse stops, and the handle gives three long buzzes so the user knows the call was received. FIND makes the stick beep for 10 seconds, for the everyday problem of a stick left somewhere in the house. A real stick would need to reach the family over the mobile network rather than the home Wi-Fi; the logic stays the same.

The Arduino Code Explained

The sketch is ESP32_Blind_Stick.ino, for the ESP32 DevKit V1 with the board's own WiFi and WebServer libraries; no other library is needed. The loop reads the GPS, the button and the sensors, sets the outputs and serves the dashboard. The pins and the zones:

const byte TRIG = 5, ECHO = 18, WATER = 35, LDR = 34, VIB = 25, EEP = 27, BUZ = 26, LIGHT = 13, SOS_BTN = 4;
const float AHEAD_CM = 100, NEAR_CM = 50, STOP_CM = 20, HYST_CM = 5;

One ping, and the 5 cm of hysteresis that keep a zone steady at its border:

  const unsigned long us = pulseIn(ECHO, HIGH, 30000);            // 30 ms: about 5 m and back
  if (z < now && cm < border + HYST_CM) z = now;

The vibration grows from 60 to 100 percent of a 3 V maximum, the beeps come closer together, and the driver sleeps when there is nothing to say:

const int VIB_MAX = 153;                                          // 60 % of 255: 3 V for the 3 V motor from the 5 V supply
  return (int)(VIB_MAX * (0.6f + 0.4f * k));
  else if (zone == NEAR) buz = ms % (150 + (unsigned long)((dist - STOP_CM) / (NEAR_CM - STOP_CM) * 450)) < 60;   // 150 .. 600 ms apart
  digitalWrite(EEP, vib > 0);                                     // the DRV8833 asleep while there is nothing to tell

The GPS sentence: the checksum, the fix flag and degrees with minutes turned into decimal degrees:

  for (const char *p = s + 1; p < star; p++) x ^= *p;
  const bool ok = f[2][0] == 'A';                                 // A = a valid fix, V = no fix yet
  const double deg = d + (x - d * 100) / 60.0;

S O S in Morse as a string of units, played by the buzzer, and the 3 second hold that cancels it:

const char SOS_MORSE[] = "1010100011101110111000101010000000";    // S O S: a dot 1 unit, a dash 3, the gaps 1 / 3 / 7 units
  if (sos) buz = SOS_MORSE[(ms - sosAt) / MORSE_MS % (sizeof SOS_MORSE - 1)] == '1';
  if (btnDown && cancelArmed && ms - pressAt >= HOLD_MS) { cancelArmed = false; sos = false; event("SOS CANCELLED - the user held the button 3 s"); }

The dashboard's links are Refresh, FIND and ACK; /data gives the zone, the distance, the water and light readings, the GPS position, the map link and the counts as JSON.

How to Run the Proteus Simulation

  1. Download the project zip below and install the library files (the steps are under the download button).
  2. Open ESP32-Blind-Stick.pdsprj from the Proteus Simulation folder. Keep ESP32_Blind_Stick.hex and the DLL files next to it.
  3. Press Play. On the water sensor's pop-up press Empty: the model starts with 20 mm of water. READY and, after about 10 s, the GPS fix.
  4. Move the wall on the HC-SR04's pop-up: 90 cm, 25 cm, 10 cm. Feel it on the coin motor's pop-up and hear it on the buzzer's.
  5. A puddle: 10 mm on the water sensor. Night: Night on the LDR's pop-up. SOS: Press on the push button's pop-up.
  6. The dashboard on the Laptop or the Mobile WiFi Monitor (press Go) has FIND and ACK.

Simulation Results: a Walk with the Smart Stick

We pressed Play and took the stick for a walk: a wall coming closer, a puddle, nightfall, an SOS, and a false alarm cancelled by the user. The HC-SR04's pop-up moved the wall, the water sensor's pop-up filled its tank, and the LDR's pop-up turned the day into night. The times are the sketch's clock; the whole run took 49.6 simulated seconds.

Ready

The sketch printed READY - ahead 197.9 cm (CLEAR): the HC-SR04 measured an echo of 11,648 microseconds, 200.8 cm on its pop-up. At 10.1 s the NEO-6M had its fix: GPS FIX - 31.52039, 74.35872, Lahore, with 9 satellites in use.

Smart blind stick Proteus simulation ready: the way clear at 200 cm, a GPS fix, the motor still
Figure: Ready: the way clear.
HC-SR04 pop-up in the smart blind stick simulation: the wall at 200 cm, an 11,648 us echo
Figure: The HC-SR04: 200 cm.
NEO-6M pop-up in the smart blind stick simulation: a 3D fix in Lahore with 9 satellites
Figure: The GPS fix.
Mobile WiFi Monitor showing the smart blind stick dashboard in the simulation: CLEAR, the GPS position
Figure: The dashboard on the phone.

An Obstacle Coming Closer

We moved the wall to 1 metre. The HC-SR04 read 99.7 cm and at 12.0 s the stick said AHEAD - 99.7 cm; at 90 cm the coin motor ran at 1.92 V, 5,979 RPM, and shook with 0.20 g, a gentle but clear buzz. At 25 cm, 13.9 s: NEAR - 24.9 cm, the motor at 2.89 V and 11,358 RPM (0.72 g), and the buzzer beeping 5.6 times a second. At 10 cm, 16.4 s: STOP - 9.8 cm. The DRV8833 drove the motor at 60 percent, 2.96 V and 0.07 A, the motor turned at 11,789 RPM with 0.78 g, and the buzzer sounded a steady tone, 26.3 mA at 4.47 V. When the wall went away, the stick was quiet again: CLEAR - 198.4 cm at 19.1 s.

Smart blind stick Proteus simulation: an obstacle 90 cm ahead, the coin motor buzzing gently
Figure: AHEAD at 90 cm.
Coin vibration motor pop-up in the smart blind stick simulation: 1.92 V, 5,979 RPM, 0.20 g at 90 cm
Figure: The gentlest buzz.
Smart blind stick Proteus simulation: the obstacle NEAR at 25 cm, a stronger buzz and beeps
Figure: NEAR at 25 cm.
Coin vibration motor pop-up in the smart blind stick simulation: 2.89 V, 11,358 RPM, 0.72 g at 25 cm
Figure: A stronger buzz.
Active buzzer pop-up in the smart blind stick simulation: the NEAR beeps, 5.6 a second
Figure: The NEAR beeps.
Smart blind stick Proteus simulation: STOP at 10 cm, full vibration and a steady tone
Figure: STOP at 10 cm.
Coin vibration motor pop-up in the smart blind stick simulation: full vibration, 2.96 V, 0.78 g
Figure: Full vibration.
DRV8833 pop-up in the smart blind stick simulation: bridge A forward at 60 %, 2.96 V, 0.07 A
Figure: The DRV8833 at 60 percent.
Active buzzer pop-up in the smart blind stick simulation: the steady STOP tone, 26.3 mA
Figure: The steady tone.

Water on the Path

We filled the water sensor's tank to 10 mm, a puddle at the tip. After half a second of wet readings, at 21.0 s: WATER at the tip - 1.18 V, with the stick's own pattern of three short beeps. Emptied again, it said DRY again at 24.1 s.

Smart blind stick Proteus simulation: water at the tip, the three-beep warning
Figure: Water at the tip.
Water sensor pop-up in the smart blind stick simulation: a 10 mm puddle, the output at 1.24 V
Figure: The puddle.

Nightfall

Then we turned the day into night on the LDR's pop-up, 0.2 lux. At 24.6 s: DARK - the LDR at 2.22 V: the light on, and the white LED near the tip lit up with 15.7 mA, so drivers can see the stick.

Smart blind stick Proteus simulation at night: the white LED on
Figure: The light on at night.
LDR module pop-up in the smart blind stick simulation: night, 0.2 lux, the output at 3.1 V
Figure: Night on the LDR.

SOS, ACK and FIND

At 26.6 s we pressed the SOS button: SOS! at 31.52040, 74.35868. The buzzer beeped S O S in Morse, three short, three long, three short, and the LED flashed. The laptop's dashboard showed SOS with the Google Maps link. At 29.8 s ACK on the laptop: ACK from the dashboard - help is coming, and the handle gave its three long buzzes, 0.72 g each, so the user knows the family has seen the alarm. At 30.6 s FIND on the phone made the stick beep for 10 seconds.

Smart blind stick Proteus simulation: SOS pressed, the buzzer beeping S O S, the LED flashing
Figure: SOS.
Active buzzer pop-up in the smart blind stick simulation: S O S in Morse code
Figure: S O S in Morse.
Laptop WiFi Monitor showing the smart blind stick dashboard in the simulation: SOS with the Google Maps link
Figure: The SOS on the dashboard.
Laptop WiFi Monitor in the smart blind stick simulation: ACK sent, help is coming
Figure: ACK from the laptop.
Coin vibration motor pop-up in the smart blind stick simulation: the long buzzes after ACK, 0.72 g
Figure: Help is coming.
Mobile WiFi Monitor in the smart blind stick simulation: FIND pressed, the stick beeping for 10 s
Figure: FIND my stick.

A False Alarm

Finally a second SOS at 42.7 s, as if pressed by mistake. We held the button for 3 seconds with the push button pop-up's Hold down chip, and at 46.7 s the sketch printed SOS CANCELLED - the user held the button 3 s. The serial monitor kept every step.

Smart blind stick Proteus simulation: a false SOS cancelled by the user
Figure: A false SOS cancelled.
Mobile WiFi Monitor in the smart blind stick simulation: the SOS cancelled, 2 SOS and 1 ACK counted
Figure: The dashboard at the end.

Our first run taught us two things that made the stick better. The water sensor's model starts with 20 mm of water in its tank; we emptied it at once, but while it drained, the first reading said WATER for a quarter of a second. Now the sketch needs half a second of wet readings, which also keeps a splash from raising the alarm on real hardware. And the first run started the vibration at 30 percent: 1.16 V turned the motor at 1,784 RPM with only 0.02 g, too weak to feel through a handle. Starting at 60 percent gave the 0.20 g you see above. The buzzer and the LED draw 26.3 mA and 15.7 mA because the simulation's GPIO HIGH is Proteus's 5 V logic level; a real ESP32 pin gives 3.3 V, so drive both through a transistor.

ESP32 serial monitor in the smart blind stick simulation: every zone, the water, the light, SOS, ACK and FIND
Figure: The serial monitor: every step.

Download the Project Files

Click the button below to download Smart-Blind-Stick-ESP32-GPS-SOS-Proteus-Simulation-v1.0.zip (about 6.3 MB, without the source code of the models):

Smart Blind Stick using ESP32 with GPS and SOS - Proteus Simulation V1.0
  • Proteus Simulation: ESP32-Blind-Stick.pdsprj, ESP32_Blind_Stick.hex and copies of the models.
  • Arduino Code: ESP32_Blind_Stick.ino, the sketch.
  • Proteus Library Files: the LIB files of every part.
  • Proteus Model Files: the DLL models.
  • README.txt: the installation steps, the properties, the test results and the links to every library post.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install the Project Files

  1. Close Proteus and extract the whole zip file, for example to your Desktop.
  2. Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
  3. Copy the DLL files from Proteus Model Files into the MODELS folder.
  4. Start Proteus and open the project from the Proteus Simulation folder.

Changing the Code

Open ESP32_Blind_Stick.ino in the Arduino IDE with the TEP Boards for Proteus installed, change the zones, the vibration strength or the patterns, and compile with Sketch > Export Compiled Binary; put the new HEX file next to the project and press Play again. On a real ESP32, select the normal ESP32 Dev Module and upload.

Ideas to Extend the Project

  • Send the SOS as an SMS with a SIM800L, so the family gets it anywhere, not only on the home network.
  • A second ultrasonic sensor aimed upwards for branches and open windows at head height.
  • A fall detector with an accelerometer: a stick lying flat for 30 s sends an SOS by itself.
  • Power the water sensor from a GPIO pin only while reading, so its traces do not corrode.
  • Short voice messages from a DFPlayer Mini instead of beeps: "obstacle", "water", "SOS sent".
  • A rechargeable battery with a low-battery warning pattern on the motor.

From Simulation to Real Hardware

  • The HC-SR04 at 3.3 V: its ECHO output is 5 V; put a divider (1k and 2k) between ECHO and D18, or use a 3.3 V sensor like the RCWL-1601.
  • The white LED: a white LED needs about 3 V, so a 3.3 V pin with 100 ohm lights it only faintly; drive it from 5 V through a small transistor.
  • The motor: mount the coin motor in the handle where the hand rests; keep the PWM at or below 3 V average.
  • The sensor angle: tilt the HC-SR04 slightly upwards so it does not see the ground ahead as an obstacle.
  • Not a medical device: a smart stick helps, but it does not replace training with a white cane or a guide dog.

Troubleshooting

  • WATER at once: the water sensor's model starts with 20 mm in its tank; press Empty on its pop-up.
  • The stick says NEAR at the start: the HC-SR04's DISTANCE property is 200 cm in this project; a new sensor starts at 50 cm.
  • No GPS fix: the NEO-6M needs about 10 s for its first fix; check that its TX goes to RX2.
  • No dashboard: the sketch connects to TEP-WiFi at the start; press Go on the monitor again after a few seconds.

Limitations of the Simulation

  • The HC-SR04, the water sensor, the GPS, the LDR, the driver, the motor and the buzzer are our libraries' models, built from their datasheets and the parts' behaviour, not every detail of real parts.
  • The obstacle is a flat wall straight ahead; real objects reflect sound in every direction and soft ones hardly at all.
  • The simulation's GPIO outputs drive Proteus's 5 V logic level, so the LED draws more current than from a real ESP32's 3.3 V pins.
  • The GPS position is the NEO-6M model's chosen place, Lahore in this project; the dashboard runs on the simulated TEP-WiFi network.

So, that was all about the Smart Blind Stick using ESP32 with GPS and SOS - Proteus Simulation. I hope it helps you understand how an ultrasonic sensor measures distance, how vibration and sound can tell a person how far away an obstacle is, how the ESP32 reads a GPS sentence by itself, and how an SOS button with a map link can bring help, all tested in a simulation before you build the stick. More popular projects with the ESP32 and the Raspberry Pi 5 are coming. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!


Comments

0

Join the conversation