Person-Sensing Head Gear Using Infrared Sensors

This project was done for my intro-level Interactive Electronic Art course. The headset uses proximity sensors to detect when a person is near the back of the head gear, and then changes the LED strip lights from green to red if something is sensed. This allows whoever is using the head gear to use lights as a mechanism to tell when someone is behind them, as well as the general direction the person is coming from, for each sensor correlates to three of the 12 lights on the strip.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials

  • Arduino Board (I'm using the UNO Arduino)
  • Adjustable face shield
  • Wires, preferably multi-stranded
  • Male to female wires
  • Shrink Wrap
  • Proximity or Infrared Sensors, I'm using these infrared sensors, but found they do not have a long range: Sensors
  • 8 gauge wire
  • 12 gauge wire
  • Hot glue gun and glue
  • Electrical tape
  • Wire cutters
  • Wire strippers
  • Small screw driver
  • Scissors
  • Soldering material (soldering tool, solder)
  • Neopixel LED strip
  • 1,000 μF capacitor
  • 500 ohm resistor
  • 9 volt battery
  • Piece to plug the battery into the Arduino: Battery piece

Step 2: Testing Sensors

To test the sensors, I first used a sample code to test four sensors individually, which you can find below. The code uses the input of the sensor to determine if the area is clear, and if so, the LED stays off. If an obstacle is sensed, the output window on the computer puts a statement and turns the LED on. To test, use the male to female wires to connect the sensor to the Arduino. The sensors have ground, power, and output pins. For the sample code, the output should connect to port 2 on the Arduino. To make the LED more noticeable, an LED can be plugged into port 13 and the ground port next to it, with the positive end going into port 13. When testing, use the small screwdriver to turn the piece on the sensor to increase or decrease the range.

Code for testing one sensor:

-----------------------------------------------------------------------------------------------

int LED = 13; // Use the onboard Uno LED

int isObstaclePin = 2;

// This is our input pin int isObstacle = HIGH;

// HIGH MEANS NO OBSTACLE

void setup() {

pinMode(LED, OUTPUT);

pinMode(isObstaclePin, INPUT);

Serial.begin(9600);

}

void loop() {

isObstacle = digitalRead(isObstaclePin);

if (isObstacle == LOW) {

Serial.println("OBSTACLE!!, OBSTACLE!!");

digitalWrite(LED, HIGH);

}

else {

Serial.println("clear");

digitalWrite(LED, LOW); }

delay(200);

}

-----------------------------------------------------------------------------------------------

After checking all four sensors, I created a small program and setup that allowed me to have all four sensors working at the same time, with four LEDs reacting to each individual sensor, as shown in the video above. The sensors were wired from ports 2-5, named in the order yellow, green, purple, and brown, based off of the color of the wire connected to the output port on the sensor.The LEDs were wired from ports 9-12, with 12 being yellow, down to 9 being brown.All LEDs were wired from their specific ports, and all the ends of the LEDs led to the same ground port, which tied into the Arduino.All of the sensors shared the same VCC/power port, and the same ground. However, their output was plugged into specific ports on the Arduino. The program is shown below.

Code for testing four sensors:

-----------------------------------------------------------------------------------------------

int yLED = 12; // Use the onboard Uno LED

int gLED = 11; //LED

int pLED = 10; //led

int bLED = 9; //led

int yellowObst = 2; // Sensor 1

int isYellow = HIGH; // HIGH MEANS NO OBSTACLE FOR SENSOR 1

int greenObst = 3; //sensor 2

int isGreen = HIGH; //HIGH MEANS NO OBSTACLE FOR SENSOR 2

int purpleObst = 4; //sensor 3 int isPurple = HIGH; //HIGH MEANS NO OBSTACLE FOR SENSOR 3

int brownObst = 5; //sensor 4

int isBrown = HIGH; // HIGH MEANS NO OBSTACLE FOR SENSOR 4

void setup() {

//led outputs

pinMode(yLED, OUTPUT);

pinMode(gLED, OUTPUT);

pinMode(pLED, OUTPUT);

pinMode(bLED, OUTPUT);

//end led outputs

//sensor inputs

pinMode(isYellow, INPUT);

pinMode(isGreen, INPUT);

pinMode(isPurple, INPUT);

pinMode(isBrown, INPUT);

//end sensor outputs

Serial.begin(9600);

}

void loop() {

//DECLARE IF SENSOR 1 (YELLOW) IS ACTIVE

isYellow = digitalRead(yellowObst);

if (isYellow == LOW) {

Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");

digitalWrite(yLED, HIGH);

}

else {

digitalWrite(yLED, LOW);

}

//END SENSOR 1 READING

//DECLARE IF SENSOR 2 (GREEN) IS ACTIVE

isGreen = digitalRead(greenObst);

if (isGreen == LOW) {

Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 2 (green)");

digitalWrite(gLED, HIGH);

}

else {

digitalWrite(gLED, LOW);

}

//END SENSOR 2

//DECLARE IF SENSOR 3 (PURPLE) IS ACTIVE

isPurple = digitalRead(purpleObst);

if (isPurple == LOW) {

Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 3 (purple)");

digitalWrite(pLED, HIGH);

}

else {

digitalWrite(pLED, LOW);

}

//END SENSOR 3 READING //DECLARE IF SENSOR 4 (BROWN) IS ACTIVE

isBrown = digitalRead(brownObst);

if (isBrown == LOW) {

Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 4 (brown)");

digitalWrite(bLED, HIGH);

}

else {

digitalWrite(bLED, LOW);

}

//END SENSOR 4 READING delay(200);

}

-----------------------------------------------------------------------------------------------

Step 3: Program for Project

After testing all four sensors, I created a new setup with the LED strip.

  • My sensors remained wired to pins 2-5, while the led strip was wired to pin 6.
  • On the strip, LEDs 0-2 were linked to sensor 1, LEDs 3-5 were linked to sensor 2, LEDs 6-8 were linked to sensor 3, and LEDs 9-11 were linked to sensor 4.
  • The numbering used, 0-11, corresponds to the physical LED positions on the strip, 1-12.

So, while all remain green when clear, when the corresponding sensor is activated, the 3 LEDs linked to a specific sensor turn red.

The 1,000 μF capacitor is placed on the power and ground pins of the power strip, and the 500 ohm resistor is placed on the data pin (middle) of the LED strip.

The program for this can be found below. It's originally from Adafruit, but I have changed the code. The library needed can be found here, as well as other useful information: Neopixel Information and Library

-----------------------------------------------------------------------------------------------

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson

// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

//DECLARE SENSORS

int yellowObst = 2; // Sensor 1

int isYellow = HIGH; // HIGH MEANS NO OBSTACLE FOR SENSOR 1

int greenObst = 3; //sensor 2

int isGreen = HIGH; //HIGH MEANS NO OBSTACLE FOR SENSOR 2

int purpleObst = 4; //sensor 3

int isPurple = HIGH; //HIGH MEANS NO OBSTACLE FOR SENSOR 3

int brownObst = 5; //sensor 4

int isBrown = HIGH; // HIGH MEANS NO OBSTACLE FOR SENSOR 4 //END DECLARE SENSORS

#include

#ifdef __AVR__

#include

#endif

// Which pin on the Arduino is connected to the NeoPixels?

// On a Trinket or Gemma we suggest changing this to 1

#define PIN 6

// How many NeoPixels are attached to the Arduino?

#define NUMPIXELS 12

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.

// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest

// example for more information on possible values.

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); int delayval = 5; // delay for half a second

void setup() {

// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket

#if defined (__AVR_ATtiny85__)

if (F_CPU == 16000000) clock_prescale_set(clock_div_1);

#endif // End of trinket special code

pixels.begin(); // This initializes the NeoPixel library.

//LED STRIP

//pinMode(PIN, OUTPUT);

//END LED STRIP

//sensor inputs

pinMode(isYellow, INPUT);

pinMode(isGreen, INPUT);

pinMode(isPurple, INPUT);

pinMode(isBrown, INPUT);

//end sensor outputs

Serial.begin(9600);

}

void loop() {

// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one. //DECLARE IF SENSOR 1 (YELLOW) IS ACTIVE

isYellow = digitalRead(yellowObst);

if (isYellow == LOW) {

//Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");

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

// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255

pixels.setPixelColor(i, pixels.Color(25,0,0)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

delay(delayval); // Delay for a period of time (in milliseconds).

}

}

else {

//Serial.println("clear");

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

// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255

pixels.setPixelColor(i, pixels.Color(0,25,0)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

delay(delayval); // Delay for a period of time (in milliseconds).

}

}

//END SENSOR 1 READING

//DECLARE IF SENSOR 2 (GREEN) IS ACTIVE

isGreen = digitalRead(greenObst);

if (isGreen == LOW) {

//Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");

for(int i=3;i<6;i++){

// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255

pixels.setPixelColor(i, pixels.Color(25,0,0)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

delay(delayval); // Delay for a period of time (in milliseconds).

}

}

else {

//Serial.println("clear");

for(int i=3;i<6;i++){

// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255

pixels.setPixelColor(i, pixels.Color(0,25,0)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

delay(delayval); // Delay for a period of time (in milliseconds).

}

}

//END SENSOR 2 READING

//DECLARE IF SENSOR 3 (PURPLE) IS ACTIVE

isPurple = digitalRead(purpleObst);

if (isPurple == LOW) {

//Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");

for(int i=6;i<9;i++){

// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255

pixels.setPixelColor(i, pixels.Color(25,0,0)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

delay(delayval); // Delay for a period of time (in milliseconds).

}

}

else {

//Serial.println("clear");

for(int i=6;i<9;i++){

// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255

pixels.setPixelColor(i, pixels.Color(0,25,0)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

delay(delayval); // Delay for a period of time (in milliseconds).

}

}

//END SENSOR 3 READING

//DECLARE IF SENSOR 4 (BROWN) IS ACTIVE

isBrown = digitalRead(brownObst);

if (isBrown == LOW) {

//Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");

for(int i=9;i<=12;i++){

// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255

pixels.setPixelColor(i, pixels.Color(25,0,0)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

delay(delayval); // Delay for a period of time (in milliseconds).

}

}

else {

//Serial.println("clear");

for(int i=9;i<=12;i++){

// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255

pixels.setPixelColor(i, pixels.Color(0,25,0)); // Moderately bright green color.

pixels.show(); // This sends the updated pixel color to the hardware.

delay(delayval); // Delay for a period of time (in milliseconds).

}

}

//END SENSOR 4 READING

}

-----------------------------------------------------------------------------------------------

Step 4: The Head Gear: Sensors

After finishing up the programming on the sensors, I started making the head piece.

The first thing I did, as shown above, is shorten the wires. To figure out the length, I held the sensor in the location I was going to glue it on the head piece, and then wrapped the wires underneath, where they would be glued. After determining a comfortable length, I shortened them and put a thin layer of solder on the inner wires.

After shortening the wires on the sensors, I placed electrical tape on the bottom of the sensors, cutting off the excess areas.

Finally, I placed the sensors where I wanted them on the headset, securing them with hot glue.

Keep in mind:

  • When placing the sensors, the LED is programmed from left to right, with the sensor order being read from left to right.
  • I used yellow, green, purple, and brown wires to signal the output port on the sensors, which plug into the Arduino ports later on. I also wrote the program according to this.
  • For instance, in the picture above, those two sensors are on the right side of the head piece, and are the purple and brown wires. The sensor order should be yellow, green, purple, and then brown to correlate to the code.

Step 5: The Head Gear: Necklace

Technically, this step was done last, but having this piece made makes measure the wire length easier. So.

First, I used the 8 gauge metal wire to make an area on the back of the Arduino that could connect to the necklace.

As shown above, I started by taping the back of the Arduino with electrical tape. I then measured against the Arduino how long I wanted the pieces to be. Because there were multiple strands of metal wire, I glued the ends so that they wouldn’t fall apart.

I placed the two long pieces first, only gluing the ends and middle to the board. I then glued the three smaller pieces on top, securing the ends with hot glue.

I then looped a longer piece of metal underneath all three short pieces, gluing where it met those pieces.

Afterwards, I took a smaller, thinner piece of metal and made a small ring, gluing the ends together. After forming the shape of the looped piece, I placed the smaller metal inside of the loop before gluing the ends of the loop together.

With that overall piece made, I measured how long I would want the necklace to be, making it longer than necessary because of preference. After placing glue on the tips of the end pieces to make sure the metal wouldn’t fall apart, I made a simple hook system, as shown above. I glued the circle where it met the rest of the metal for security.

Finally, I slid the small circle piece connected to the Arduino onto the necklace, creating a piece that can easily be put on or taken off that will hold the Arduino. Afterwards, I taped a battery to the back of the Arduino.

Step 6: The Head Gear: Head Gear and Sensor Wires

With the sensors glued and the necklace made, the length of the wires could be measured.

I first heated shrink wrap around where the female ends of the wire met the sensors. After, I taped whatever wires I wasn’t dealing with to the head piece so that I could solder properly.

While wearing the head piece and necklace, I measured how long I would want the wires for power and ground to be, measuring from underneath the head piece to their port location on the Arduino. After measuring, I cut the wire, stripped it, and prepared the wire inside.

I soldered all of the power wires from each of the sensors to one long wire that would plug into the 5v port on the Arduino. I did the same for the wires that would run to the ground port.

After soldering, I glued where all the wires met the longer piece of wire underneath the head piece.

I then measured how long I wanted the wires for the sensors outputs to be, measuring them the same way as power and ground, then making them a little longer because I knew I would be braiding them for security. I then soldered each of the wires to their longer piece, marking which wire was which. I then soldered the connection point.

I braided the power and ground wires together, placing shrink wrap in a few places on the wires to keep them stable. Similarly, I braided the longer output wires together, placing shrink wrap in different locations. After finishing, I soldered the longer wire to the male end that was cut when shortening the wires to the sensor in the beginning, matching them with the wire that corresponded to the color on the output (brown, purple, green, and yellow) because my code corresponded to those colors.

Afterwards, I took the 12 gauge metal and measured how much I wanted while wearing the head piece, keeping in mind where I wanted the LEDs to be in my vision. I then kind of forcefully bent the metal wire around the head piece into the form I wanted, wrapping the metal twice in between where the black piece for tightening meets the head piece. I then twisted the black piece to secure the metal.

Step 7: The Head Gear: LED Strip

Finally, the LED strip needs to be attached.

I first measured out how long I thought the wires should be by wearing the head piece and Arduino necklace.

I then shortened the legs of the capacitor and soldered it onto the ground and power locations of the LED strip. I then soldered on the power and ground wires, finishing by heating shrink wrap around the connection points. I then did the same with the resistor, soldering it to the middle leg on the LED strip and then soldering the output wire onto the connection before placing shrink wrap around it.

Finally, the wires were braided, with shrink wrap being placed in certain areas for connection. The ends of the wires were then soldered onto two male wire ends, much like with the wires for the sensors. This allows the wires to be plugged into the Arduino. Shrink wrap was also placed where the two wires were soldered together.

For the LED strip, I first placed electrical tape on the back of the LED strip, cutting off the excess. I then used hot glue to secure the LED to the 12 gauge metal.

Step 8: Ta-Dah!

With that, everything is complete.

For the connections:

  • The ground and power wires from the sensor plug into the GND and 5V ports on the Arduino.
  • The ground and power wires from the LED strip plug into the other two GND and 5V ports on the Arduino.
  • The output wire (middle wire) from the LED strip goes in port 6.
  • The wires for the sensors, from left to right when wearing, are placed in ports 2-5.
    • For the code, the yellow wire goes in 2, the green wire goes in 3, the purple wire goes in 4, and the brown wire goes in 5.
  • Then, the battery just plugs into the Arduino and everything'll turn on.

My sensors didn't have much range, but in essence when the sensor is activated, the three LEDs that correlate to that sensor will change from green to red. That can be changed simply by changing the RGB values in the program.

First Time Author

Participated in the
First Time Author

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions

    None
    audreyobscura

    10 months ago

    This is a cool project! I can see this being useful in a couple different industries. Thanks for the share, you should enter this in the Make It Glow Contest!