Introduction: Light Sensor Glove

Picture of Light Sensor Glove

In this project we will be attaching an arduino, bread board (with respected parts and wires), and a servo motor to a glove which will be powered by a 9v battery pack. When the glove is pointed at an object a certain light will go on and the servo motor will point to that light, depending on how far away the object is.

Step 1: Materials

Picture of Materials

  1. 1 Arduino
  2. 1 Breadboard
  3. At least 20 Male wires
  4. 3 LED lights (Different Colors)
  5. 1 Servo Motor
  6. 1 Ultrasonic distance sensor
  7. 1 9v battery pack (with battery)

Step 2: Building

Picture of Building
  • Connect the Ultrasonic Distance Sensor
    1. Establish ground on the bread board by hooking up a mail wire to ground on the arduino
    2. Connect a wire to the first leg of the uds to ground
    3. The second to pinmode 11 on the arduino
    4. The third to pinmode 12 on the arduino

    5. The fourth to 5v on the arduino

  • Connect the Three LED Lights
    1. First, make sure each similar leg of the LED is placed in different rows
    2. Connect each of the long legs of the LEDs, with a male wire, to their respected pinmodes (EX: Green; 8 Yellow; 9 Red; 10)
    3. Connect each short leg of the LEDs, with a male wire, to ground
  • Connect the Servo Motor
    1. Connect the middle wire to "VIN" on the arduino
    2. Connect the wire to the right of that (usually brown) to ground
    3. Connect the wire to the left of that (usually yellow) to pinmode 3 on arduno

  • When this is done, you can connect it to a glove!

Step 3: Step 3: the Code

Picture of Step 3: the Code

#include

Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards

int pos = 0;

int led=8;

int val=0;

int yled=9;

int rled=10;

void setup (){

Serial.begin(9600);

pinMode(12,OUTPUT);

pinMode(11,INPUT);

pinMode(led,OUTPUT);

pinMode(yled,OUTPUT);

pinMode(rled,OUTPUT); }

void loop () {

long duration, inches;

digitalWrite (12, LOW);

delayMicroseconds(2);

digitalWrite (12, HIGH);

delayMicroseconds(5);

digitalWrite (12, LOW);

duration = pulseIn (11, HIGH);

inches = duration / 74 / 2;

if (val>0 && val<10);{

myservo.write(40);

analogWrite(led,255);

analogWrite(rled,0);

analogWrite(yled,0);

}

if(val>10 && val<40){

myservo.write(90);

analogWrite(yled,255);

analogWrite(rled,0);

analogWrite(led,0);

}

if(val>40&&val<70){

myservo.write(130);

analogWrite(rled,255);

analogWrite(led,0);

analogWrite(yled,0);

}

Serial.println(inches); delay(200); }

Comments

harrise3419 (author)2017-12-18

lovee thissss.

Swansong (author)2017-12-13

Neat idea, thanks for sharing :)

About This Instructable

318views

4favorites

License:

More by gakurlander:Light Sensor Glove
Add instructable to: