JuanVi
Created November 3, 2023

SwimSight

Smart Googles for Visually Impaired Swimmers

AdvancedWork in progress98

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
JSN-SR04T
×2
Vibrating Motor 1030
×2
2n2222
×2
1N4148 – General Purpose Fast Switching
1N4148 – General Purpose Fast Switching
×2
Capacitor 100 nF
Capacitor 100 nF
×2
Resistor 1k ohm
Resistor 1k ohm
×2
Resistor 10k ohm
Resistor 10k ohm
×2
SS12F15
×1
Boost Converter 5V
×1
Pin Socket 2.54mm 1x10
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

GooglesUltrasound

EnclousurePCB_Bottom

EnclousurePCB_Top

Schematics

Kicad Proyect

Modified Kicad PCB

Kicad Schematic

Gerber PCBWay/JLCPCB

Gerber files for your manufacture of choice (in this case JLCPCB or PCBWay)

Code

GooglesBlind

C/C++
//Right Ultrasound Sensor
#define trigPin_R 6
#define echoPin_R 7

//Left Ultrasound Sensor
#define trigPin_L 8
#define echoPin_L 9

long duration_R;
long duration_L;

int distance_R;
int distance_L;

//Right Vibrating Motor
int motorPin_R = 3;

//Left Vibrating Motor
int motorPin_L = 2;

int delays;

unsigned long initialTime = 1000;
unsigned long desiredTime = 5000;
unsigned long currentTime;

volatile unsigned long blinkCount = 0; 

void setup() {
  
  pinMode(trigPin_R, OUTPUT);
  pinMode(echoPin_R, INPUT);
  
  pinMode(trigPin_L, OUTPUT);
  pinMode(echoPin_L, INPUT);
  
  pinMode(motorPin_R, OUTPUT);
  pinMode(motorPin_L, OUTPUT);

//Vibrates for checking correct function

  for (int i = 0; i < 5; i++) {

  digitalWrite(motorPin_R, HIGH); //vibrate
  digitalWrite(motorPin_L, HIGH); //vibrate
  delay(100);  // delay 100ms
  digitalWrite(motorPin_R, LOW);  //stop vibrating
  digitalWrite(motorPin_L, LOW);  //stop vibrating
  delay(100);
  }
  //initialTime = millis();
 
  Serial.begin(9600);
}
 
 void loop() {
  digitalWrite(trigPin_L, LOW);
  delayMicroseconds(5);
  digitalWrite(trigPin_L, HIGH);
  delay(2);
  digitalWrite(trigPin_L, LOW);
 
  duration_L = pulseIn(echoPin_L, HIGH);
  distance_L = duration_L*0.034/2;

  delay(100);
  
  digitalWrite(trigPin_R, LOW);
  delayMicroseconds(5);
  
  digitalWrite(trigPin_R, HIGH);
  delay(2);
  digitalWrite(trigPin_R, LOW);
 
  duration_R= pulseIn(echoPin_R, HIGH);
  distance_R = duration_R*0.034/2;
  delay(100);

    
  Serial.print("Distance_R = ");
  Serial.print(distance_R);
  Serial.println(" cm");
  
  Serial.print("Distance_L = ");
  Serial.print(distance_L);
  Serial.println(" cm");
  
  if (distance_R < distance_L) {
  delays = (distance_R)*10;
 }
 else {
    delays = (distance_L)*10;
  }
  
  Serial.print("Delays = ");
  Serial.print(delays);
  Serial.println(" ms");

  delay(100);
  
  desiredTime = delays;
  currentTime = millis();
 
  
  if (currentTime - initialTime >= desiredTime) {
    if (distance_R <=  distance_L) {
       digitalWrite(motorPin_R, HIGH); //vibrate
       delay(500);  // delay one second
       digitalWrite(motorPin_R, LOW);  //stop vibrating
    }

  else if (distance_L <  distance_R) {
     digitalWrite(motorPin_L, HIGH); //vibrate
     delay(500);  // delay one second
     digitalWrite(motorPin_L, LOW);  //stop vibrating
  }

   initialTime = millis();
   // Restarts the timer
  }
     
}

Credits

JuanVi

JuanVi

3 projects • 5 followers

Comments