Siddharth Nhce
Created September 4, 2024

Smart Navigation Glasses

Smart Navigation Glasses for Visually Impaired Individuals

35
Smart Navigation Glasses

Story

Read more

Schematics

image 1

image 2

Code

sensor code

C/C++
#include <Wire.h>
#include <Adafruit_VL53L0X.h>

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(115200);
  if (!lox.begin()) {
    Serial.println("Failed to initialize VL53L0X");
    while (1);
  }
}

void loop() {
  VL53L0X_RangingMeasurementData_t measure;
  lox.rangingTest(&measure, false);
  if (measure.RangeStatus != 4) {
    Serial.print("Distance (mm): ");
    Serial.println(measure.RangeMilliMeter);
  } else {
    Serial.println("Out of range");
  }
  delay(100);
}

navigation

Python
import cv2
import numpy as np

def detect_obstacles(frame):
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    edges = cv2.Canny(gray, 100, 200)
    return edges

def main():
    cap = cv2.VideoCapture(0)
    while True:
        ret, frame = cap.read()
        if not ret:
            break
        obstacles = detect_obstacles(frame)
        cv2.imshow('Obstacles', obstacles)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    cap.release()
    cv2.destroyAllWindows()

if __name__ == "__main__":
    main()

feedback

C/C++
#include <BLEPeripheral.h>

BLEPeripheral blePeripheral;
BLECharacteristic feedbackCharacteristic("feedbackChar", BLERead | BLEWrite, 1);

void setup() {
  blePeripheral.setLocalName("SmartGlasses");
  blePeripheral.setAdvertisedService(feedbackCharacteristic);
  blePeripheral.addAttribute(feedbackCharacteristic);
  blePeripheral.begin();
}

void loop() {
  BLECentral central = blePeripheral.central();
  if (central) {
    if (feedbackCharacteristic.value()) {
      triggerHapticFeedback();
    }
  }
}

void triggerHapticFeedback() {
  // Code to activate haptic motor
}

remote communication

Python
import requests

def send_data_to_server(data):
    url = "https://example.com/api/data"
    response = requests.post(url, json=data)
    return response.json()

data = {
    "location": "latitude,longitude",
    "obstacle_detected": True
}

response = send_data_to_server(data)
print(response)

Credits

Siddharth Nhce

Siddharth Nhce

1 project • 1 follower

Comments