Search

How to make a DIY Ultra Glasses using an Arduino

In this project, we will be making a DIY Ultra Gasses. This project will be mainly used for people who are visually impaired. It will have a sensor detecting things in front and a speaker making sounds to alarm the person.

Materials

  1. Arduino Nano

  2. Ultrasonic Sensor

  3. Buzzer

  4. Wire Nut - At least 1

  5. Jumper Wires

  6. Battery - 9V

  7. Wire Tape

  8. Any type of glasses

  9. Any support material (optional)

If you don't have any of those materials, you can buy the kit in our shop :


Software

Circuit

In this circuit, our goal is to hook up our sensor to sense values and output our results through the buzzer(speaker). The first thing we did is use an Arduino Nano instead of an Arduino Uno. The Nano is a mini version of the Arduino Uno. It is used for small projects like in our case we wouldn't want to use an Arduino Uno with glasses. We want something smaller and that can fit with glasses. Secondly, we hooked up the buzzer in both ways. The positive pin (it has a + sign at the top of it) is being connected to D3, which is input 3. And the negative pin is connected to a wire nut with two different wires. One of the wires is connected to the GND pin of the Ultrasonic Sensor and the other one is connected to the GND pin of the Arduino. We're using a wire nut to connect the GND pins from the buzzer and ultrasonic sensor to the GND pin of the Arduino. On the Ultrasonic Sensor, we have connected the VCC pin to the 5V pin on the Arduino, we have the TRIG pin and ECHO pin to D9 and D10 respectively. Those are the pins we're going to use to communicate with our Arduino. And lastly, the 9V battery's positive pin is connected to the Vin pin which takes in the battery, and its negative pin is connected to GND. Refer to the image below for a clearer image :






Programming


In this code, our goal is to read the value from the Ultrasonic Sensor make a sound through the buzzer to alert the person. First, we declared two variables for the Ultrasonic Sensor using "const int" because we want to keep these variables constant. We named them trigPin and echoPin set them to 9 and 10 just like how we connected them in the circuit. Even for the buzzer pin, we have a constant variable which we set to 3 just like the circuit. We have more variables that are going to help us change the value from the Ultrasonic Sensor to relative(inches, centimeters). Next, we began the setup for the pins and the serial monitor. The first two pins are the trig and echo pin, which we set as output and input respectively. The trig pin is how we send the transmitter waiting to be sent back to be read by the echo pin. And the echo pin reads the value and tells us our distance. The buzzer is output because its outputs sound. Finally, we set up the serial monitor to help us see the distance read by the Ultrasonic Sensor.


In our loop, we have a whole function that sets our ultrasonic sensor and converts it into cm.

Our program starts at the if statement. The first if statement means when the distance is less than 40cm it gives us a a sound with tone of 400. The second if statement means when the distance is less than 20cm the buzzer makes a sound with the tone of 600. We added another distance because we want a higher tone when the person gets too close. The last if statement is making sure there is no sound at all while the distance is greater than 50cm and less than 0. And the loop goes on and on and keeps and checking the distance. Refer to the code below :


const int trigPin = 9;
const int echoPin = 10;
const int Buzzer = 3;

long duration;
int distance;

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(Buzzer, OUTPUT);
Serial.begin(9600);
}

void loop() 
{
  digitalWrite(trigPin, LOW);
  delay(25);
  digitalWrite(trigPin, HIGH);
  delay(25);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance= duration*0.034/2;
  Serial.print("Distance: ");
  Serial.println(distance);

    if (distance < 40){
      tone(Buzzer,400);
      
    }
    if (distance <= 20){
      tone(Buzzer,600);
    }
    
    if (distance >= 50 || distance <= 0){
      noTone(Buzzer);
    }
  
}

After finishing writing the code, download it using the USB cable to the Arduino. Before that, you have to make sure the board type is the right one and it's set up to the right port. To do that go to the tools section choose the board type and port. In this case, we are using an Arduino Nano. Finally, connect the cable and see what happens. See the image below :






Building


Now let's implement our circuit into our glasses. We want to find glasses of any kind. We are being resourceful so it's going to be hard to implement our circuit to our glasses. Some glasses might have designs that are going to