1NH21CE014_Dhanush_V
Created September 4, 2024

A Wearable Navigation DeviceforVisually Impaired Individuals

a wearable navigation device for the visually impaired, enhancing mobility with real-time audio guidance and obstacle detection.

11
A Wearable Navigation DeviceforVisually Impaired Individuals

Things used in this project

Story

Read more

Code

visual

C/C++
// Include necessary libraries
#include <WiFi.h> // For ESP32 Wi-Fi
#include <TinyGPS++.h> // For GPS
#include <Notecard.h> // For Blue’s Notecard Wi-Fi v1
// Ultrasonic sensor pins
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distance;
// Notecard setup
Notecard notecard;
J *req;
J *rsp;
// GPS setup
TinyGPSPlus gps;
HardwareSerial gpsSerial(1);
void setup() {
// Initialize serial communication for debugging
Serial.begin(115200);
// Initialize ultrasonic sensor pins
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
// Initialize GPS module
gpsSerial.begin(9600, SERIAL_8N1, 16, 17);
// Initialize Notecard
notecard.begin();
req = notecard.newRequest("hub.set");
if (req != NULL) {
JAddStringToObject(req, "product", "your_product_uid"); // Replace with your
product UID
JAddStringToObject(req, "mode", "continuous");
notecard.sendRequest(req);
}
// Connect to Wi-Fi
WiFi.begin("your_ssid", "your_password"); // Replace with your SSIDandpassword
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to Wi-Fi...");
}
Serial.println("Connected to Wi-Fi");
}
void loop() {
// Measure distance using the ultrasonic sensor
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
// Output the distance to the serial monitor
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
// Check GPS data
while (gpsSerial.available() > 0) {
gps.encode(gpsSerial.read());
if (gps.location.isUpdated()) {
Serial.print("Latitude: ");
Serial.println(gps.location.lat(), 6);
Serial.print("Longitude: ");
Serial.println(gps.location.lng(), 6);
// Send location data to Notecard
req = notecard.newRequest("note.add");
if (req != NULL) {
JAddStringToObject(req, "body", "Location Update");
J *body = JCreateObject();
JAddNumberToObject(body, "lat", gps.location.lat());
JAddNumberToObject(body, "lon", gps.location.lng());
JAddItemToObject(req, "body", body);
notecard.sendRequest(req);
}
}
}

Credits

1NH21CE014_Dhanush_V

1NH21CE014_Dhanush_V

1 project • 1 follower
Thanks to adarsh reddy.

Comments