Abhinav Dhakal

change to light
← Back to Home
$ cat ~/projects/smart-cane/README.md

Smart Cane with Warnings and Weather Alerts

Smart cane project thumbnail
Smart cane main system thumbnail
GPIO WiFi I²S HC-SR04 ultrasonic 0.8 m Weather API WiFi · REST ESP32 · FreeRTOS sensor task queue alert task queue api task Speaker TTS · I²S

Class group project for an intelligent cane system that combines ultrasonic sensing, weather alerts, and audio feedback. My work covered WiFi connectivity, API integration, text-to-speech playback, and the full FreeRTOS restructure that made the integrated system actually stable.

My Contribution

The Integration Problem

Each module worked fine in isolation. Once we integrated everything: sensor reads, API polling, TTS playback: the system became unreliable. Sensor updates were delayed, alerts misfired, and behavior was inconsistent under any real processing load. The single-loop architecture meant every operation was blocking everything else.

I isolated the timing of each component to figure out where delays were accumulating. The issue wasn't in any individual module: it was the architecture. Putting everything sequentially in loop() meant a slow API call would starve the sensor, and a TTS output would block the whole system.

FreeRTOS Restructure

I split the system into independent FreeRTOS tasks, each pinned to a core or given a priority appropriate to its timing requirements:

Tasks communicate through FreeRTOS queues instead of shared variables, so there's no race condition risk and each module stays decoupled. After restructuring, sensor readings were consistent, alerts fired in real time, and the system ran stably through extended testing. Adding new features also became straightforward: each new module just becomes another task with a well-defined interface.

Process Diagrams

Full smart cane team process diagram
Full team process diagram
Smart cane subsystem process diagram
My subsystem process diagram

Source Code

View the firmware source (.ino)

Tech Stack

ESP32, FreeRTOS, C, WiFi, Ultrasonic Sensing, Google Translate API, Weather API, Text-to-Speech