AJ-Explains-It-All
Published © GPL3+

Intelligent Multi-Utility Shoes For The Blind

A smart embedded system for the visually impaired so that they no longer have to rely on walking sticks or canes

AdvancedFull instructions provided20 hours3,222
Intelligent Multi-Utility Shoes For The Blind

Things used in this project

Story

Read more

Code

GPS-NodeMCU code

Arduino
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

 

static const int RXPin = 4, TXPin = 5;   // GPIO 4=D2(conneect Tx of GPS) and GPIO 5=D1(Connect Rx of GPS

static const uint32_t GPSBaud = 9600; //if Baud rate 9600 didn’t work in your case then use 4800

 

TinyGPSPlusgps; // The TinyGPS++ object

 

WidgetMapmyMap(V0);  // V0 for virtual pin of Map Widget

 

SoftwareSerialss(RXPin, TXPin);  // The serial connection to the GPS device

 

 

BlynkTimer timer;

 

 

float spd;       //Variable  to store the speed

float sats;      //Variable to store no. of satellites response

String bearing;  //Variable to store orientation or direction of GPS

 

char auth[] = “93c74fed09574fca8555e792f04ff7ed”;              //Your Project authentication key

char ssid[] = “electromaniaweb”;                                       // Name of your network (HotSpot or Router name)

char pass[] = “123456789*/-+”;                                      // Corresponding Password

//unsigned int move_index;         // moving index, to be used later

unsigned int move_index = 1;       // fixed location for now

 

 

void setup()

{

Serial.begin(115200);

Serial.println();

ss.begin(GPSBaud);

Blynk.begin(auth, ssid, pass);

timer.setInterval(5000L, checkGPS);

// every 5s check if GPS is connected, only really needs to be done once
}

void checkGPS() {

if (gps.charsProcessed() < 10)

{

Serial.println(F(“No GPS detected: check wiring.”));

Blynk.virtualWrite(V4, “GPS ERROR”);

// Value Display widget  on V4 if GPS not detected

}
}

void loop()

{

while (ss.available() > 0)

{

// sketch displays information every time a new sentence is correctly encoded.

if (gps.encode(ss.read()))

displayInfo();

}

Blynk.run();

timer.run();

}

void displayInfo()

{

if (gps.location.isValid() )

{

float latitude = (gps.location.lat());     //Storing the Lat. and Lon.

float longitude = (gps.location.lng());
Serial.print(“LAT:  “);
Serial.println(latitude, 6);  // float to x decimal places
Serial.print(“LONG: “);
Serial.println(longitude, 6);
Blynk.virtualWrite(V1, String(latitude, 6));
Blynk.virtualWrite(V2, String(longitude, 6));
myMap.location(move_index, latitude, longitude, “GPS_Location”);
spd = gps.speed.kmph();               //get speed
Blynk.virtualWrite(V3, spd);
sats = gps.satellites.value();    //get number of satellites
Blynk.virtualWrite(V4, sats);
bearing = TinyGPSPlus::cardinal(gps.course.value()); // get the direction
Blynk.virtualWrite(V5, bearing);
}
Serial.println();
}

Ultrasonic feedback code

Arduino
This code is used for interfacing the HC-SR04 with the vibrator feedback
#define trigPin1 3

#define echoPin1 4

//#define echoPin2 7

//#define trigPin2 8

#define trigPin3 6

#define echoPin3 5

#define vibrator 10

#define vibrator1 8

long duration, distance, RightSensor,BackSensor,FrontSensor,LeftSensor;

 

void setup()

{

Serial.begin (9600);

pinMode(trigPin1, OUTPUT);

pinMode(echoPin1, INPUT);

//pinMode(trigPin2, OUTPUT);

//pinMode(echoPin2, INPUT);

pinMode(trigPin3, OUTPUT);

pinMode(echoPin3, INPUT);

pinMode(vibrator,OUTPUT);

pinMode(vibrator1,OUTPUT);

}

 

void loop() {

SonarSensor(trigPin1, echoPin1);

RightSensor = distance;

/*SonarSensor(trigPin2, echoPin2);

LeftSensor = distance;*/

SonarSensor1(trigPin3, echoPin3);

LeftSensor = distance;

Serial.print(LeftSensor);

Serial.print(” – “);

Serial.print(FrontSensor);

Serial.print(” – “);

Serial.println(RightSensor);

}

void SonarSensor(int trigPin,int echoPin)

{

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = duration*0.034/2;

 

if(distance<3)

analogWrite(vibrator,0);

else if(distance>=3 && distance<5)

analogWrite(vibrator,255);

else if(distance>=5 && distance<7)

analogWrite(vibrator,210);

else if(distance>=7 && distance<9)

analogWrite(vibrator,180);

else if(distance>=9 && distance<11)

analogWrite(vibrator,150);

else if(distance>=11 && distance<13)

analogWrite(vibrator,100);

else if(distance>=13 && distance<15)

analogWrite(vibrator,80);

else if(distance>=15 && distance<17)

analogWrite(vibrator,60);

else if(distance>=17 && distance<19)

analogWrite(vibrator,30);

else

analogWrite(vibrator,0);

}

void SonarSensor1(int trigPin,int echoPin)

{

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = duration*0.034/2;

 

if(distance<=3)

analogWrite(vibrator1,0);

else if(distance>3 && distance<5)

analogWrite(vibrator1,70);

else if(distance>=5 && distance<7)

analogWrite(vibrator1,100);

else if(distance>=7 && distance<9)

analogWrite(vibrator1,120);

else if(distance>=9 && distance<11)

analogWrite(vibrator1,150);

else if(distance>=11 && distance<13)

analogWrite(vibrator1,190);

else if(distance>=13 && distance<15)

analogWrite(vibrator1,210);

else if(distance>=15 && distance<17)

analogWrite(vibrator1,220);

else if(distance>=17 && distance<19)

analogWrite(vibrator1,240);

else

analogWrite(vibrator1,255);

}

Credits

AJ-Explains-It-All

AJ-Explains-It-All

12 projects • 10 followers
Experienced embedded firmware and software developer. I have a great affinity towards ARM cortex based MCU's.

Comments