loading
These goggles, as if straight out of a sci-fi b-movie, have servo motors that noisily control dark lenses depending on the ambient light and proximity to other objects.

Step 1: Materials

2 servos
welding goggles
duct tape
wire
a microcontroller
a proximity sensor
a photoresistor
a resistor

Step 2: Create Light Sensor With Photoresistor and Resistor

Solder the photoresistor to the resistor to create a voltage divider (you should pick a resistor on the same order of magnitude as your photoresistor). Attach a wire to either end, and one to the middle. One end is going to connect to the 5 V power supply, so I colored that one red. One end is ground (I colored it black) and the middle is the signal output (I used yellow for that).

Step 3: Extend the Length of Your Wires If Need Be

I found that it was helpful to extend the length of the wires on my two servos and proximity sensor, so I just soldered on some extra long wires. I actually used some nice header pins so I could disconnect the components easily if need be, but feel free to use whatever wires you can find.

Step 4: Group Your Four 5V and Ground Wires

You'll end up having four ground wires and four 5V wires. Each sensor and servo takes a Vin and a ground. You'll want to group these all together to one wire. I just soldered 4 wires onto the end of one to group them easily.

Step 5:

Remove the dark lenses from your welding goggles.

Step 6: Tape Lenses on to Servos

Out comes the duct tape!

Step 7: Tape Prox Sensor to Front of Goggles

More tape!

Step 8: Tape Ambient Light Sensor to Goggles

You should also get a general idea of where you are going to route all your wires. I put my 5V wires to the right, my ground wires to the left, and the input and output wires to the side they were closest to.

Step 9: Tape Servos on the Side!

Tape on the servo so the lenses overlap the eyeholes when the servo is at one of its maximum values.

Step 10: Tape Down Wires Where You See Fit

I preferred to loop long coils of wire to enhance the "sci-fi b-movie" effect, but if you want to cut yours short and practical, you can do that too.

Step 11: Connect Wires to Arduino

I ended up with 6 wires. Inputs to the two servos, outputs from the two sensors, a 5V wire, and a ground wire. The 5V and ground go to their respective pins on the arduino. I plugged in the servo inputs on pin 9 and 11 (digital PWM pins) and I connected the sensor outputs to A0 and A1 (analog in).

Step 12: Program Arduino

I used the servo library to program my arduino (full code below).

#include <Servo.h>
Servo servo1;  // create servo object to control a servo
Servo servo2;
int pos = 0;    // variable to store the servo position


int light = 0;        // value read from the pot
int prox = 0;
int servo1Pos = 0;        // value output to the PWM (analog out)
int servo2Pos = 0;        // value output to the PWM (analog out)

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  servo1.attach(9);  // attaches the servo on pin 9 to the servo object
  servo2.attach(11);
}

void loop() {
  // read the analog in value:
  light = analogRead(A0);     
  prox = analogRead(A1);
 
// map it to the servo output:
  if (light > 400){servo1Pos = 0;}
  if (light <= 400){servo1Pos = 180;}
  if (prox > 400){servo2Pos = 180;}
  if (prox <= 400){servo2Pos = 0;}

  // change the servo output
  servo1.write(servo1Pos);
  servo2.write(servo2Pos);
  // tell servo to go to position

  // print the results to the serial monitor:
  Serial.print("light = " );                      
  Serial.print(light);     
  Serial.print(" servo1 = "); 
  Serial.println(servo1Pos);
  Serial.print("prox = " );                      
  Serial.print(prox);     
  Serial.print(" servo2 = "); 
  Serial.println(servo2Pos);

  // wait 10 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(10);

Step 13: More to Do?

You could wire the arduino to a battery to make the goggles mobile. You could try using a magnifying lens or gears and an aperture or something entirely different on one of the eyes of the goggles. Go wild! See what you can do.
I recently went to a steampunk convention. Galaxyfest 1. This would really be appropriate there.
Sweet! Nice Job!

About This Instructable

8,359views

23favorites

License:

More by cypy:Smart Word Blocks Sci-fi B-movie goggles 
Add instructable to: