First Arduino project (Laser alarm system)

Hi everyone. First of all: I am from Denmark so my english my not be that well. Anyway, i will try to explain my idea:

Burglars "Visited" my house about 4 times and just broke the alarm before anything could happen.
So now i want to build my own complex alarm system (With LASERS, YEAH :smiley: ).

To start out with, here is what i want in my project:
A laser beam, that activates an alarm, when the beam is broken.
I want a timer that starts at 60 seconds when you activate it (So you have time to leave the house) and i want to numbers displayed on a display.
I want a button to activate and deactivate the alarm with.
I want the sound to be transmitted with a Jackstik to my speakers (For a loud effect)

I already bought the following:

A simple alarm with a controller and a reciever that i can use for the project. The speaker (150DB) is really loud, so i want that in my project as well.

The Arduino starter kit. Here i can display the numbers, and i have tons of LED's to use for my project. Of course i want to be able to see when the alarm is on and off. It comes with a light sensor. It ships with a remote control too, which i can use to enable and disable the alarm.

3 5mw lasers. I want to use them for the beams.

When the beam is broken, i would like 30 seconds as well, to turn the alarm of before it startes.
Thats all for now.
Later on, i'm planning to add a WIFI component that allows me to enable and disable the alarm, even though im not home.

I thank you all for your help.

sincerely, Kristian from Denmark.

And of course i forgot to say, that i have already looked on tons of videos with laser alarm systems, but i want it to be more complex.

Sorry to hear, maybe use lasers that burn skin? I live in South Africa, so I want to make alarms too. But generally here, you're best off buying professional equipment.

So what will make your system better than one you buy from a professional company? The whole pressing buttons and locking/unlocking stuff is a pretty common application. Are you just wanting to save money? Cause most alarm systems you buy from a shop will have some really useful features that will be hard to implement yourself: For example, they typically have a tamper detection circuit that will run the alarm on backup power if someone cuts the main power... it might be worthwhile getting one of those infrared detector + circuit board combos, and try set up a pro system?

If you are gung ho on Arduino, it will be useful for all the things you mentioned... the laser detector needs to send an input to one of your pins. The program just loops, waiting for pins to go HIGH. When that happens, you delay(30) or whatever, and then set an output to HIGH to trigger the power for the alarm. If the alarm is 150dB, it will probably need its own power (Arduino can only supply a few hundred mA), and the trigger will just be for a MosFET or transistor to close the circuit to power the alarm. Heh a button to deactivate the alarm... sounds super complex :slight_smile:

Well, generally, i want to make my own project.

If that doesnt work, i will try a proffessionsl system.

The alarm already has its own power so thats ouy of the way.
I am totally new and i will probably need a lot of help.

I want the display to display the time that is left before the alarm starts.

The good thing about the external alarm is that the arduino activates it, and even though the power gets cut, the alarm has batteries.

Try this first :slight_smile: then look for a countdown timer tutorial. When working with complex projects, search separately then combine it afterwards. Hope you have fun making this one!

Found it here -->

Thanks for the advice. But i'd rather use my Arduino and program that.

I would like some buttons for activation and deactivation

Karma given on the right :slight_smile:

Watch the video, it has on/off switch and it can be used with an arduino

I want both the laser and light sensor to be placed on the Arduino.
I am going to use small mirrirs to get the beam around the house.

At the same time i want 2 buttons for the Arduino.
1 for activation and 1 for deactivation.

I now got the Arduino and the parts.
I followed this guide:

But for some reason it does not work.

I dont know what kind of resistor he is using and i think that is the problem.
I tried with a 1K resistor and a 10K resistor.
Neither of them works.

You really should not use laser. Chances are that you will regret having done so if you do whether you can imagine it or not. The saying "shit happens" is too often true to take a chance blinding someone, burglar or not, maybe yourself. Perhaps if you find yourself in court, that will be when you realize your responsibility. If you can ask a law person/student first then you might avoid a lot of trouble.

Besides, the laser light shows in even the lightest dust in the air. IR light however is invisible.

You might include one or more small DVR cameras. With strong IR illumination they image very well in the dark.

Search Youtube for "bump key" if they get in without breaking the lock, then get a better lock.
If they are kicking the door in, add a knock sensor as well as security Hall and magnet set to your new, extra strong door and frame.
Put security Hall and magnet sensors on all your windows.

Figure out what the chances are it is someone you know or delivery people if the burglary always happens sonn after you get new stuff.

For South Africa... why have anything nice when you know it is just bait? Hell, YOU may be bait!
Save your money to emigrate to Canada or get a spot in a secure compound instead of buying TV, PC, etc.
I live in the US in a neighborhood with a murder rate but I consider most SA cities to be insanely bad!

I thank for the advice, but i wont move for the next year :slight_smile: Just signed a contract.

Well, my friend gave me an offer on a proffesional alarm, but i would like to continue with my project.

I got it up and running with this guide:

Both the software and the hardware is good, and it works.

Now i want to add a countdown timer, but it seems like it uses the same outputs.

What do i do here? :slight_smile:

Would a Mega 2560 work with the Arduino?

At the same time i ordered a RFID Chip and "Keys" for the Arduino and a simcard board, to send me a message whenever the alarm is tricked.

That depends on how the code is written. And with that code, all I can say is OUCH.
You could just wedge a kludge in there, what's one more?

// function to flip the armed state of the trip wire
void setArmedState(){

  if (isArmed){
    digitalWrite(GreenLED, HIGH);
    digitalWrite(RedLED, LOW);
    isTriggered = false;
    isArmed = false;
  } else {
    tone(speakerPin, 220, 125); // pre-60 second delay peep, at the next peep it is armed
    tone(speakerPin, 196, 250);
    digitalWrite(GreenLED, LOW);
    delay( 60000 ); // and that is your 60 second delay
    digitalWrite(RedLED, HIGH);
    tone(speakerPin, 220, 125); // armed peep, hope you cleared the range before this one!
    tone(speakerPin, 196, 250);
    isArmed = true;

I'm going to be days just getting over the analog read and calibration parts of a beam interrupt detector! OMG!

Get an IR phototransistor or the like (LDR=slow, like analog read) and put it behind an aperture to restrict light coming in to a narrow angle. An IR led with 15-30 degree illumination can easily put light through that hole (the aperture) without needing to fiddle around with aim (because you restrict the SENSOR angle) and connect to a digital pin or an analog pin that you read digital (ALL I/O pins can work as digital).
The beam is broken or unbroken when you have a narrow aperture, an IR light source and IR sensor. There is no half-beam that you care about. There is no need to calibrate!
IR is invisible to humans, they see nothing to avoid. Just don't show it off and it can remain a surprise.

When you are ready to get practical, instrument your entry points (door & windows) for open/closed (cheap security Hall sensor and cheap magnet, should be less than 1 Eu each set) and vibration strong enough to be tampering (piezo acoustic pickup, also cheap from China) since they have to come in somewhere and you can cover all entry points.
Cameras may let you know WHO it was or at least give the police something to work with. Again, with IR camera (any cheap digital camera will "see" in strong enough IR, even a webcam) the intruders won't even know they have been imaged unless they carry IR vision devices of their own and then your illumination will blind those.

Here is one major key to understanding making things happen on time without using delays.
It's not a big learning curve, very worth the effort, and it should change how you see Arduino code.

That coupled with a finite state machine (simpler than it sounds) approach will simplify most tasks.

Unfortunately, i understood roughly 1/3 of what you wrote.

I now know that i need an IR sensor instead of a laser beam.

Can you link me to the parts i need?
I would like to have the parts on

Currently i use an LDR, triggered whenever the laser beam is moved away from it

This is only a project for now on :slight_smile:
To get the digits working right, i need 1 more breadboard, right?

If you can send me a Private message, i would be happy.

I dont really know anything and i am a beginner to Arduino :slight_smile:

For only 1 or 2 of anything, an electronics hobby store might be a good choice to shop.
If you can find someone from the forum in your area they might tell you where to shop or you can split orders. Or maybe that person has some IR leds and sensors and would sell you some.

I think you want something like this. 3 IR leds and 3 IR sensors for 1.80 pounds with free shipping.

You replace the laser with an IR led, or even a red led for test purpose (you can see it is on). It is a light source and light travels in straight lines even when it is spreading out. You restrict light coming in to the sensor so that only light coming from one direction falls on it. Take a cheap pen apart and put the sensor in at one end, instant aimed sensor. It only sees out of the other end of the tube, only light coming at a narrow angle even gets in. Look through the tube before you put in the sensor and see for yourself only light from a small view gets in. That is your "light beam". Everything else, the sensor does not see. Point the tube at the led, it will see the led. Stand in the way and it won't, the light from the led is blocked. Simple?
The IR led is a light source that the sensor sees and the intruder does not. Red laser can be seen if even a little smoke or dust passes through. But worse, if something very reflective get in the red laser path then it may reflect into someone's eye, maybe even yours. A friend of mine found that out waggling a pointer around and it hit a shiny ball, it was more than one hour before all that eye would see was red. You must be real careful with lasers!

With the laser and LDR you restrict the light source to a narrow beam but any light that falls on the LDR is sensed which, aha, explains why he needs the analog reads and calibration. That setup is totally vulnerable to stray light!
The other way, digital read is good and calibration is unnecessary. Digital read will take less code, don't have to compare number to calibration number, digital is HIGH or LOW only.

I gave you the changes for your 60 second wait. You might as well plug that in and see how you can fool it with just a flashlight (errr, in British that would be torch) pointing on the LDR.

I ordered the IR LED's you just posted.
That comment was easier to understand :wink:

Well, i noticed the 60 seconds thing and figured out, that it must be the delay, but i need it to be displayed on the "Seven segment display" :slight_smile:

Could you make a schematic of the whole setup?

I just ordered a bunch of resistors, capacitors and so on, so i am "Geared up" when everything arrives :slight_smile:

I am from Denmark so i prefer to order from UK because here in Denmark, 1 IR LED costs about 4$...
Denmark is so expensive.

And i cant order in USA because then i have to pay taxes one 30$...
Then the delivery time will be high as well.

Check out dealextreme, my link is
Go to department Electrical & Tools
And then submenu to Arduino & SCM or DIY & Components. DIY is Do It Yourself.
After that search is not great but possible or just browse.

Funny enough, this is where I got red laser modules 10 for US$4.60, about 3 Eu?

I'm not sure where Mouser Electronics is but they might have locations in Europe.

In the Bar Sport section of this forum down in the Community section there is a long running thread named Your latest purchase with pages and pages of people showing what they got, how was the deal and where they got it. That thread has people from your general area if not your very city posting. Yes, Msquare is in Copenhaven according to his profile and bld is in Vegen and that's just a short look.

Someone else has to help you with the 7-segment display but first, use the forum search and/or check the Arduino Playground:

You will have to change the big 60 second delay into a loop that displays the countdown number then delays 1000 millis each time around.

I now have a LOT of components, including a keypad to use a password to turn on the alarm, along with resistors, some capacitors, and the IR LEDs you said i should buy.

I also have a lot of wires, temperaturesensor and even more components.

I just need someone to set up a schematic for me, since i dont really know how this stuff works :slight_smile:

IR led to replace the laser and you got the detectors with the leds.
I assume you have at least one breadboard even if it is small.

Make each piece or set of pieces work in a test sketch for it before trying to integrate parts and code.
In some or all cases the help already exists on the Arduino site or web. What you can find on your own is to your learning and that may improve as you go.

IR led and detector, do the detectors have 2 legs or 3?

For test I push the led legs into the breadboard and bend them so the led faces where the detector will go. Then I bend the detector to face the led. Leave space to block the light between them. You can use more than 220 ohm resistor on the led especially so close.

A webcam or similar will show you if the IR led is lit, it will show a white dot when on. CCD cameras are very sensitive to near-IR which IR and red leds put out a lot of. For testing a red led should do as a substitute if you need to able to see (no webcam or phone cam, or other).

You could read the detector output on a digital pin as long as you also have the output go to ground through a resistor as well, 10k is a usual value for that but anywhere from 1k to 20k will do and others outside that range as well.
But I want to run a check with one of my 2 pin detectors to try a simpler way that should work. If I hook the detector up so that the pin supplies current to the detector on the + leg, hook the - leg straight to ground and in setup make the pin INPUT_PULLUP then I won't need any resistor and only 2 wires. When the led is on, the detector should let current flow from my pullup input to ground and when the led is off it should stop. The pin would read HIGH when the led is off and LOW when the led is on.

With a 3 leg detector you can bias the detection, control how strong the light has to be to trigger flow, it's wired more like a transistor. The 2 leg is also a transistor but light serves as the only control.