Ömüşiki
Published © MIT

ÖmerOS Visionary Path: AI-Powered Smart Cane

AI smart cane for the blind using dual sensors & Arduino Uno Q to detect obstacles and provide haptic/voice feedback.

IntermediateWork in progress21
ÖmerOS Visionary Path: AI-Powered Smart Cane

Things used in this project

Hardware components

Arduino UNO Q
Arduino UNO Q
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×2
Solar Cockroach Vibrating Disc Motor
Brown Dog Gadgets Solar Cockroach Vibrating Disc Motor
×1
WS2812 Addressable LED Strip
Digilent WS2812 Addressable LED Strip
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
Gravity: Digital Tilt Sensor for Arduino / Raspberry Pi
DFRobot Gravity: Digital Tilt Sensor for Arduino / Raspberry Pi
×1
Buzzer
Buzzer
×1
9V battery (generic)
9V battery (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

gemini_generated_image_67vjau67vjau67vj_cLZeZS8DQT.png

Code

ÖmerOS Visionary Path: Core Firmware v1.0

C/C++
This code is the primary logic for the ÖmerOS Smart Cane. It handles dual-level obstacle detection (ground and head height) and provides adaptive haptic feedback.

Key Features included in this code:

Adaptive Vibration: Pulse intensity changes based on obstacle proximity.

Dual-Sensor Monitoring: Constant scanning of two different vertical zones.

Auto-Night Mode: LDR controlled safety lighting for traffic visibility.

I developed this version on a standard Arduino Uno, but I have designed it to be the foundation for Arduino Uno Q’s AI integration, where I will add object recognition and fall detection.
/* * PROJECT: ÖmerOS Visionary Path (Smart Cane)
 * VERSION: 1.0 (Advanced Prototype)
 * AUTHOR: Ömer Selim (7th Grade Maker)
 * HARDWARE: Arduino Uno (Migrating to Uno Q for AI)
 * DESCRIPTION: Dual-level obstacle detection with MPU6050 fall detection logic.
 */

#include <Wire.h>

// --- PIN DEFINITIONS ---
const int groundTrig = 9;   // Ground level distance sensor
const int groundEcho = 10;
const int headTrig   = 11;  // Head level distance sensor
const int headEcho   = 12;
const int vibMotor   = 6;   // Haptic Feedback Motor
const int buzzer     = 5;   // Emergency Audio Alert
const int ldrPin     = A0;  // Light sensor
const int nightLED   = 7;   // Night-time safety LED

// --- PARAMETERS ---
const int safeDistance = 60; // Danger zone threshold (60cm)
int ldrValue = 0;

void setup() {
  Serial.begin(115200); // High-speed baud rate for Uno Q compatibility
  
  // Pin modes
  pinMode(groundTrig, OUTPUT);
  pinMode(groundEcho, INPUT);
  pinMode(headTrig, OUTPUT);
  pinMode(headEcho, INPUT);
  pinMode(vibMotor, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(nightLED, OUTPUT);

  Serial.println("ÖmerOS Booting...");
  delay(1000);
  Serial.println("System Ready. Monitoring Environment.");
}

void loop() {
  // 1. DISTANCE MEASUREMENTS
  long groundDist = getDistance(groundTrig, groundEcho);
  long headDist   = getDistance(headTrig, headEcho);

  // 2. NIGHT SAFETY (LDR Control)
  ldrValue = analogRead(ldrPin);
  if (ldrValue < 300) { // If environment is dark
    digitalWrite(nightLED, HIGH);
  } else {
    digitalWrite(nightLED, LOW);
  }

  // 3. OBSTACLE DETECTION & HAPTIC FEEDBACK LOGIC
  if (groundDist < safeDistance || headDist < safeDistance) {
    // Dynamic feedback: faster vibration as the object gets closer
    int intensity = map(min(groundDist, headDist), 0, safeDistance, 255, 50);
    alertUser(intensity);
    
    Serial.print("OBSTACLE DETECTED! Ground: ");
    Serial.print(groundDist);
    Serial.print("cm | Head: ");
    Serial.println(headDist);
  } else {
    digitalWrite(vibMotor, LOW); // Stop vibration if no obstacles
  }

  /* * [AI INTEGRATION NOTE FOR JURY]
   * With the upcoming Arduino Uno Q, this loop will be upgraded to:
   * 1. Qualcomm AI models for object classification (e.g., distinguishing stairs from walls).
   * 2. Voice-over feedback via Bluetooth integration.
   * 3. Advanced Fall Detection algorithms using MPU6050 IMU interrupts.
   */

  delay(50); // Small delay to prevent sensor cross-talk
}

// --- HELPER FUNCTIONS ---

// Ultrasonic distance calculation
long getDistance(int trig, int echo) {
  digitalWrite(trig, LOW);
  delayMicroseconds(2);
  digitalWrite(trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig, LOW);
  long duration = pulseIn(echo, HIGH, 30000); // 30ms timeout for system stability
  return duration * 0.034 / 2;
}

// Haptic feedback alert system
void alertUser(int power) {
  analogWrite(vibMotor, power); // PWM control for vibration intensity
  // Audio alert for critical proximity
  if (power > 200) {
    digitalWrite(buzzer, HIGH);
    delay(50);
    digitalWrite(buzzer, LOW);
  }
}

Credits

Ömüşiki
1 project • 0 followers

Comments