what component should I use to create a light barrier?Actually, the method doesn't have to base on light, it is just the name - the task is to check if something is between the sender and the receiver?Additionally, I'd prefer to only have to use one component each, that means to use the mere fact that most waves are reflected on objects.

Idea: Using cheap ultrasonic modules like this one, I only need one each because they use that ultrasonic is reflected on objects. Then I would set a normal distance, if it changed then something is between.

What is the purpose of this barrier? How likely is it that people will try to get around it without triggering it?

If you use a narrow angle ultrasonic sensor (yes, they are available in different angle ranges), and the distance it measures is less than the distance to the far wall, then something is between the sensor and the far wall.

Note that ultrasonic sensors work best with hard objects, like walls and furniture, and not so good with soft objects like people and pets.

3.3V TTL output (so some level conversion would be needed); place it in the corner of the room diagonally opposite that of the door, about 10-15 cm below the level of the ceiling and angled down toward the door. It'll cover the majority of the room, and can be made fairly sensitive. Bonus: You can use it when not in alarm mode to automatically turn on and keep lights on while you are in the room (well, until you stop moving - you need to have a delay to check for motion in the room to reset the time-to-live on the lights going out).

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Hello,thanks for the answers.@CharlesDomingue: a laser is a nice idea, however I couldnt find one on ebay, maybe because I don't know what to exactly search for.@cr0sh: Sounds very good, I want to use what is used in real alarm systems. I have some questions concerning this:There is no manual nor datasheet attached in the ebay auction and it seems that cables need to be soldered because I couldn't see some pins, so I don't know how to attach it to Arduino.What does TTL output mean? And did I understand it correctly?: Output is as the following: 3.3V = alarm, 0V = normal state.And how does this "motion detector" work? I think it recognizes the body heat(?)And.. Is this a safe system?

I already have a photoresistor and tried out some circuits.And my result is, that it is too sensitive to normal sun light difference over the day.I was told that there were special photoresistors for different types of lights (distinguished by the wave length, e.g. red laser)Your link is about a PURPLE laser, is there a PURPLE-sensitive photoresistor?

This is a red laser, it's only the casing that is purple. Also, you can just buy them from a dollar store or whatever... I think that the photoresistor you got is perfect, there is still a difference between a laser beam shining on it and the ambient room light. If you didn't know, a photoresistor just changes the resistance of the current that passes through it depending on the lightning. So if you plug it in +5 volts, and measure the current that is exiting on the other side, by hooking it up to an Analog Input, you can get the quantity of light that is shining of it with digitalRead() function, which outputs a number from 0 (0v of 5v, lot of resistance = lot of light), to 1023 (5v of 5v, no resistance = no light at all) so you can set a threshold, so it takes a lot of light to trigger. To pull this value off, you can either:

-Hook up a pot that sets that threshold, so you turn it until it only detects the light from the laser beam, ideal if you plan to take it to different places, with more or less lightning for easy adjustment

or,

-Hardcode that value in your code, so it's kind of "permanent" (until you change it in the program). To do so, you send the photoresistor values thru serial and you listen to them while playing around to write down your values.

because the PIR motion detector is independent of the laser barrier, I already ordered the PIR motion detector. This one is with pins is designed for the use with Arduino.

Can I supply 5V to the 4.5V laser pointer without problems? I tested it with one I have at home, and it worked, will it work again, for longer times?I read that a reference value for the photoresistor's value should be taken (reference: with normal light (either day or night); and the one the laser lights on). These values can be compared, but how should I compare them? What about: if v1~v2 then alarm, that means if they have circa the same value. I could say "abs(v1-v2 )< 50 then alarm", what about this ? Calibration wouldn't work because the room I am speaking about changes its brightness during the day very much.

Can I supply 5V to the 4.5V laser pointer without problems? I tested it with one I have at home, and it worked, will it work again, for longer times?

It depends upon the laser unit in question. Some of them can tolerate the additional voltage without noticable damage or shortened working lifetime, others will have problems in the long run. The only way to be sure is find-out the ratings for the specific laser you are using.

I read that a reference value for the photoresistor's value should be taken (reference: with normal light (either day or night); and the one the laser lights on). These values can be compared, but how should I compare them? What about: if v1~v2 then alarm, that means if they have circa the same value. I could say "abs(v1-v2 )< 50 then alarm", what about this ? Calibration wouldn't work because the room I am speaking about changes its brightness during the day very much.

A laser shining directly onto the photoresistor should be significantly brighter than even full daylight and/or normal room illumination. Therefore the threshold will be a much greater voltage than the possible with ambient light no matter what time of day or the amount of ambient lighting.

Ok, then I will go ahead to buy a laser to use it as a light barrier, because the one I have at home shouldn't be damaged.I could also create a voltage divider - calculated with this, I'd have: Vin=5,R1=220,R2=1K,Vout=4. That should be ok.I already also heard, that the batteries are a bit more than 1.5V, maybe 1.6V or 1.7V. A new "1.5V"-battery I measured had a bit more than1.6Volts. That means that 1.6V*3=4.8V should be definitely still in the acceptable range for the laserpointer. Most of them are from China and hence don't have a manual with technical parameters.

I already also heard, that the batteries are a bit more than 1.5V, maybe 1.6V or 1.7V. A new "1.5V"-battery I measured had a bit more than1.6Volts. That means that 1.6V*3=4.8V should be definitely still in the acceptable range for the laserpointer. Most of them are from China and hence don't have a manual with technical parameters.

Yes that's very true, and always something to keep in mind when working with batteries. The datasheets always go by a nominal voltage though the "name brands" usually will have plotted voltage curves available as well. Therefore on any battery powered device design you need to ensure the total voltage of the pack can provide a high enough voltage until the cells are mostly discharged, while making sure fresh batteries won't cause the excessive initial voltage to the device being powered.