Trippy - a DIY Modulated Laser Trip Wire That Prevents Trespassing

by avijitdasxp in Circuits > Arduino

553 Views, 4 Favorites, 0 Comments

Trippy - a DIY Modulated Laser Trip Wire That Prevents Trespassing

Trippy | A modulated Laser Trip Wire that prevents trespassing

Inspiration

A few days back one of our friends bike got stolen from the garage at middle of the night. The thief sneaked in by breaking the garage door and maneuvering its way towards the bike (we suspect). Being a friend of his, we thought of helping him with some of our creation and being electronics engineer it was our challenge time to come up with a simple, low-cost, easy to install, yet powerful and very useful solution. We went for a laser based alarm system (laser trip wire) inspired from the spy or agent movies like 007 from Bond series or Ethan Hunt from Mission impossible, where they have to trespass laser security systems for access gain.


About Trippy

It is a laser trip wire, which will be monitoring a walkway. Upon turning this on if anyone trips it or falls on the laser, an alarm will be raised and along with that a bright flashing light will start. Which might scare the trespasser. But there is a catch (loop hole) which we have upgraded in this simple trip system. These trippers can be exploited or freeze from outside by flashing a bright light or a dummy laser to the sensor (if the trespasser is too smart) thus fooling the sensor not to trip upon blocking the actual laser path. But with this laser trip wire, its impossible to do that, since we have modulated the laser ray which will be discussed in the next section.

Supplies

  1. Arduino (pick your favorite one)
  2. Phototranistor
  3. Laser
  4. A small Mirror
  5. Buzzer
  6. Batteries
  7. 1W White LED


How to Build It

It consists of a laser beam well a modulated laser beam that gets spit out from a the circuit from one end and bounces from a mirror from the other end and falls on a phototransistor. This Phototransistor detects the beam and matches its modulated frequency. If the beam falls correctly over the phototransistor, the alarm stays cool and doesn't bark. As soon as the laser gets tripped or by any means it gets blocked, it starts an annoying high pitch alarm, along with bright flashing lights. The laser, phototransistor, a piezo buzzer for the alarm, and a white LED for flashing, all are controlled via an Arduino. The laser is modulated with a random frequency which is set by the Arduino and looks for the same frequency of the laser to fall on the phototransistor. Usually this frequency is in the kHz range. So by this way, one cannot fool the phototransistor by targeting a dummy laser to it, making it to think its the original beam. The original beam will be modulated and changing randomly. And Arduinos are good at it by using a floating pin and the random() to generate the random nos. We placed the components in a breadboard and a mirror to bounce the laser.

Circuit Diagram and PCB Layout

Schematic_Trippy_2021-11-07.png
PCB_PCB-Laser-Trip-Wire_2021-11-07.png
3D_Trippy.png

The schematic diagram and the PCB layout are shown here. And the 3D model is the visual representation of the PCB which will look like after manufacturing.

Code

#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= ~_BV(bit))


void setup()
{
  pinMode(11,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  
  Serial.begin(2000000);
  
  digitalWrite(11, 1);
  
  
 
 cbi(ADCSRA, ADPS1);
 cbi(ADCSRA, ADPS0);
  
}
long ls=0, c=0, lx=0;
float x=0, y=0;
boolean flag = false;
void loop()
{
  for(;;)
  {
    
    x = analogRead(A2);
    y = 0.2*x + 0.8*y;
    
    if((lx-x)>10)
    alarm();


    lx=x;


    Serial.println(y-x);
  }
  
  
}


void alarm()
{
  for(int j=0;j<10;j++)
  {
   for(int i=3790;i<=4000;i++,delay(2))
   {
    tone(3, i, 500);
    if(i%70==0)
    digitalWrite(4, flag=!flag);
   }


   for(int i=4000;i>=3790;i--,delay(2))
   {
    tone(3, i, 500);
    if(i%70==0)
    digitalWrite(4, flag=!flag);
   }
  }
}

Challenges

The sampling rate of the ADC of Arduino by default was very slow around 8.7kHz which was way too slow for our project, we had to speed it up. Aligning the laser to the phototransistor was initially a bit of challenge, but after setup, we got it right. Creating a random frequency to modulate and detect it was bit challenging.

Accomplishments

Its a very crude setup, but does the job pretty well and that's what we like it, simple, low Cost, but effective.

What's Next for Trippy

Making an enclosure to secure everything inside it and easy to install, replace the Arduino with an Wi-Fi chip like ESP8266 so that it can send you a notification as an add on. This will be really helpful for those who are not on the zone.

Its Not Only Me !

Kudos to Deblina Chattopadhyay for creating this project with me :D