Electronic circuits · no code

Laser Tripwire Alarm

A laser pointer aims at an LDR and nothing happens. If someone cuts the beam, a buzzer sounds. It is an “invisible wire” alarm for a door or a corridor, using a very low-power laser.

  • LevelBeginner
  • Time25 min
  • Power9 V DC
  • CategoryAudio & alarms

Bill of materials

Everything you need to build it, with the reference you will see on the schematic.

Bill of materials
Qty Part Ref.
1 10 kΩ resistor (brown-black-orange) R1
1 GL5528 photoresistor (LDR) LDR1
1 BC547 NPN transistor Q1
1 Active buzzer (3 to 24 V) BZ1
1 9 V battery with snap clip BT1
1 Red laser pointer, class 1 or 2 (under 1 mW), with its own batteries
1 Dark 5 cm tube (black card or a straw painted black) to shade the LDR (tool)
1 Breadboard (400 tie-points or more)
5 Jumper wires

Missing parts? The kits recommended by Impeca Tech include almost all of them. See the kits

Schematic & wiring

On the left, the circuit diagram; on the right, the same circuit built on a breadboard. Both connect exactly the same things.

Circuit diagram of “Laser Tripwire Alarm”
Circuit diagram
Breadboard layout of “Laser Tripwire Alarm”
Breadboard layout

Wire it step by step

  1. Place the components
    • 10 kΩ resistor R1 (bands: brown, black, orange, gold): one leg in 3f and the other in 6f (either way round).
    • Photoresistor (LDR) LDR1: one leg in 9f and the other in 7f (either way round).
    • BC547 transistor Q1 with the flat face (the one with the text) towards you, left to right: collector (C) in 5h, base (B) in 6h, emitter (E) in 7h.
    • Active buzzer BZ1: the long leg (marked +) in 13f and the other leg in 10f. Reversed, it will not sound.
  2. Add the jumper wires
    • Red wire: from 3j to the + (red) rail.
    • Red wire: from 13j to the + (red) rail.
    • Orange wire: from 6j to 9j.
    • Black wire: from 7j to the − (blue) rail.
    • Turquoise wire: from 5j to 10j.
  3. Connect the battery
    • Connect the 9 V battery to its clip: the clip’s red lead to the + (red) rail and the black one to the − (blue) rail. Do this last, once everything else is in place.
  4. Test the circuit
    • Mount the LDR inside the dark tube and aim the pointer at the open end of the tube, one or two metres away, taping the pointer so it cannot move. With the laser on the LDR the buzzer should be quiet. Pass your hand in front of the beam: it sounds while the beam is cut and stops when you take your hand away. If it sounds all the time, adjust the aim until the red dot lands right on the surface of the LDR. Hold the pointer with tape rather than by hand while you aim it, and never look into the beam.

How to read the holes: the letter is the row and the number is the column of the breadboard (for example 7f). The red (+) and blue (−) rails are the two long lines along the edge.

How does it work?

  1. 1The laser lights the LDR with plenty of light
  2. 2The LDR conducts well and keeps the transistor off
  3. 3Someone cuts the beam and the LDR falls into shade
  4. 4The transistor conducts and the buzzer sounds

The LDR (photoresistor) and R1 (10 kΩ) form a voltage divider that feeds the base of Q1. With the laser beam on it, the LDR has very little resistance (a few hundred ohms): the base voltage stays below 0.5 V and Q1 is off, so the buzzer stays quiet (under 0.1 mA). When someone cuts the beam, the LDR only gets the room light: its resistance rises to several kΩ, the base voltage goes above 0.6 V and Q1 saturates. About 28 mA then flows through the active buzzer, which has its own oscillator inside and sounds from the battery’s 9 V. In the simulation (worn and fresh batteries, parts at the extremes of their tolerance) the alarm sounds with the beam cut in a dark room (3 lux), in normal room light (60 lux) or in a very bright room (300 lux), and stays quiet with the laser on (3000 lux, far below what a real pointer gives). The trigger point lies, depending on part tolerance, between about 400 and 1500 lux: with the beam there is much more light, without it much less. The dark tube over the LDR stops room light reaching it from the sides and improves the contrast. Safety: use only a class 1 or 2 pointer (under 1 mW), never point the beam at anyone’s eyes, at animals, or at reflective surfaces (mirrors, glass), and do not use it near children without supervision. It will not work in direct sunlight: in full sun the LDR gets plenty of light even when you cut the beam.

Testing & troubleshooting

What you should see

Laser beam on the LDR (≈ 3000 lux)
Buzzer currentunder 1 µA
Beam cut, dark room (3 lux)
Buzzer current≈ 28 mA
Voltage across the buzzer≈ 8.88 V
Beam cut, lit room with the tube (60 lux)
Buzzer current≈ 28 mA
Voltage across the buzzer≈ 8.87 V
Beam cut, very bright room without the tube (300 lux)
Buzzer current≈ 28 mA
Voltage across the buzzer≈ 8.86 V

Approximate values, calculated with typical parts. With real parts they can vary by 10 % or more.

If something does not work

The buzzer sounds all the time, even with the laser on

The laser dot is not landing on the LDR: adjust the aim until the red dot is in the centre of the LDR’s face. Also check the pointer has fresh batteries (a weak laser gives little light) and that nothing is blocking the tube.

It does not sound when I cut the beam

The LDR is still getting too much light: put it inside the dark tube and keep it away from windows and lamps. In full sun this circuit will not work. Also check the buzzer (the + goes towards the battery; it must be an active one) and the two ends of the LDR: one to the base of Q1 and the other to GND.

Want to automate this circuit with code?

Learn how to program sensors and custom schedules in our e-book “Arduino from Scratch”.