loading
Picture of Personal Space Defender
A simple and elegant way to help keep your personal space bubble from being invaded by close talkers and overly huggie people.   This is a stolen or borrowed idea from Phillip Torrone of Adafruit, who mused about something like this on an episode of Adafruit's "Ask an Engineer."  I decided to incorporate this idea into a bow-tie for all those black tie events that I'm forced to attend(no not really, it just seemed the easiest and most discrete way to incorporate the sensor).  The jist of  how it worked is as follows;  If someone gets within 19" of me, red lights flash for a few seconds.  If they stay there, the lights keep flashing.  The distance and flashing rates can easily be changed to suite your needs if your personal bubble is larger or smaller than mine.  


DSCN1778 from Aleksei Sebastiani on Vimeo.

 
Remove these adsRemove these ads by Signing Up

Step 1: Parts

Picture of Parts
Adafruit Flora  http://www.adafruit.com/products/659 
Maxbotix distance sensor  http://www.adafruit.com/products/172 
Adafruit Neo Pixel   http://www.adafruit.com/products/1260
3D printed Bow-tie  https://tinkercad.com/things/lMtQ1vbMAHI-space-invader/ 
Bow-tie loops   https://tinkercad.com/things/77nV1o6NTgt-bowtieholder 
Acetone
Velco  or fabric collar  
Wire & heat shrink
5mm snaps  http://www.adafruit.com/products/1126
Magnetic backing  http://www.adafruit.com/products/1170



Step 2: Code

Picture of Code

#include <Adafruit_NeoPixel.h>

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(4, 6, NEO_GRB + NEO_KHZ400);
int sonarPin = 9; //pin connected to analog out on maxsonar sensor

int inchesAway; // inches away from the maxsonar sensor


void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
Serial.begin(9600);
}

void loop() { 
inchesAway = analogRead(sonarPin) /2; // reads the maxsonar sensor and divides the value by 2
// approximate distance in inches
Serial.print(inchesAway); // prints the sensor information from the maxsonar to the serial monitor 
Serial.println(" inches from sensor");
if (inchesAway < 19) { // if something is 24 inches away then make a 1khz sound
long startTime = millis(); // record the beginning of the proximity event.
    while (inchesAway < 19)
    {
         if ((millis() - startTime) >= 3000)  // If we have been in this loop for 5 seconds
         {
              break;  // exit the loop
         }
         inchesAway = analogRead(sonarPin) /2; // keep reading the sensor
     
     if ((millis() - startTime) >= 3000)  // we passed the 5 second test
     {
         
   for(int j = 0; j < 30; j++){  
      
      
         for(int i = 0; i < 4; i++)
{
  strip.setPixelColor(i, strip.Color(250, 0, 0)); 
}
strip.show();
delay(100);
for(int i = 0; i < 4; i++)
{
  strip.setPixelColor(i, strip.Color(0, 0, 0)); 
}
strip.show();
delay(100);// Flash the leds
     }
}

// turn LED on: 

else if (inchesAway > 18){
  
strip.setPixelColor(1, strip.Color(0, 0, 0));
}




    }//end while
    }//end if
  }//end void loop


Step 3: Getting Help

Picture of Getting Help
Aside from great delivery and awesome products, one of the biggest reasons that I love Adafruit so much and buy most of my Arduino related products from them is that the support for their products is unparalleled.  I reached a snag on this project when the coding when beyond my abilities.  I choose to go to the forums for help.  Arduino, Adafruit, and Instructables all have great forums and amazing super-users who are willing to help.  However, when going to forums don't think that anyone else will do all the work for you.  Or ask vague questions that are unanswerable.   If you want help from forums, make it as easy as possible for someone else to help you.  
Having said that, I'd like to send many thanks to Adafruit_Support_Bill for helping me get my code to where it needs to be.  I couldn't figure out how to add a time element to the sensor in order to avoid false positives(like when drinking wine or making some gesture with my hands).  He graciously provided the code that I needed.   Thanks again Bill!
http://forums.adafruit.com/viewtopic.php?f=8&t=42504 <-----here's the forum thread.  

Step 4: The Print

Picture of The Print
DSCN1716.JPG
DSCN1720.JPG
DSCN1725.JPG
DSCN1732.JPG
DSCN1734.JPG
Firstly, I printed a few grey rough drafts of my prototype.  I had thought that printing the loops that the velco strap would go through would be a good idea.  It wasn't.  It added a bunch of support to the holes that the pixel would lay in.  It took a few rough drafts and measuring before I had a design that was good enough.  

I printed the final item upside down so that the holes for the flora pixels would end up being a nice snap fit.  This means that the top side of the print would need a lot of finishing and cleaning.  It was printed with support that had to be removed.  After that, much sanding took place and then a final finishing with an acetone wiping.  See the pictures below for the progression of the 3D printed part.  

Step 5: Assembly of Bow Tie

Picture of Assembly of Bow Tie
DSCN1743.JPG
DSCN1746.JPG
Your flora pixels should snap in place quite nicely.  Next, solder everything together(out to in, +volts together, grounds together).  Lastly, take some super glue and affix the holders.  

Step 6: Flora Assembly

Picture of Flora Assembly
DSCN1711.JPG
DSCN1714.JPG
Pretty simple here.  Secure the magnetic backing to the flora and solder on the 5mm snaps.    For my code, you are going to solder snaps to pins 6 & 9, ground and 3.3v.  I wanted to limit the amount of wires going to the bow-tie, so I shared the ground and 3.3v wires between the distance sensor and the flora pixels.  

Step 7: Neck Strap

Picture of Neck Strap
DSCN1749.JPG
DSCN1750.JPG
DSCN1754.JPG
DSCN1755.JPG
DSCN1756.JPG
Measure your neck.  Mine is about 16".  A little extra is ok.  Cut the fuzzy side of the Velcro to that length.  Feed the Velcro though the loops.  Next, solder the remaining connections.  Lastly, cut some small pieces of the hook side Velcro to secure the wires that feed the bow-tie.  

Step 8: Defend Yourself.

Picture of Defend Yourself.
DSCN1769.JPG
DSCN1788.JPG
Wear it and Love it.  
Entzückende!!!
Grissini (author)  Carlos Marmo1 year ago
Danke, denkt meine Frau auch.
: )
wiredcav1 year ago
BRILLIANT!
Grissini (author)  wiredcav1 year ago
Thanks.
Bowties are cool.
Grissini (author)  legodude20201 year ago
Yeah they are!
You should get it to say “Intruder Alert !! Intruder Alert!!”
Grissini (author)  Josehf Murchison1 year ago
I thought about making is sound reactive as well. The little speakers I would use just don't cut it. Thanks for the comment though.
Also known as the Virginity Defender :D

I kid, I kid!

Great instructable, interesting concept. Love the Video and the 3D Editor.
Grissini (author)  dfranciscus1 year ago
Ha! My wife loves that name. Thanks for checking it out.
bekathwia1 year ago
This is fab! Thanks for sharing your process.
Grissini (author)  bekathwia1 year ago
Thanks Becky! I appreciate it. Give my thanks to PT for the idea. And I hope he liked it too. Great Show today! Phillip doesn't need a pin cushion jacket. Just a few blindingly bright LED's will ward people off. This same concept could easily be incorporated into a broach or necklace for ladies.
Nice job! And great video, too. Clean and quick demo, I love it.
Grissini (author)  fungus amungus1 year ago
Thanks Mr. Amungus. I tried to keep it tight. I lose interest in myself after about 30 seconds, I figure most other people would too.