I taught a Boy Scout Merit Badge course for Electronics not too long ago. I looked at the kits that were available. None grabbed me. I then remembered seeing an intruder alarm project in a book some time ago and set out to find it. I couldn't find the circuit in my books or in the library, and besides realized later that it would be done with older technology and somewhat limited. So, I decided instead to just design something on my own.

I knew to make it really cool, I'd need some processing power so I chose a pretty simple microcontroller, and used some IR photo-interruptor module sensors that I had plenty of.

The alarm uses the combined IR emitter and detector of the module as a sensor that looks at a white card mounted to the door. When the door is closed, the sensor gets a reflection of its signal from the card. When the door opens, the sensor stares out into space, sees no reflected light and its analog voltage output changes from about 0.2V (white) to around 4.1V (black). The analog voltage is measured constantly by the Atmel ATiny26 micro's A/D converter and when the voltage goes above the trigger value, the alarm goes into countdown mode. In countdown mode, the micro counts down to about 8 seconds during which time a code can be entered on 3 button keypad. If the code isn't entered in time, or if the code is incorrect the alarm goes off. The alarm is a fairly loud piezoelectric buzzer that will pulse on/off.

Click here to see full size .pdf of schematic.

In brief, the sensor is represented in the top left hand corner and plugs into the 4 pin headerJ1. The top right hand shows the 7805 +5V regulator that takes input from a 9V battery on J2. This regulated 5V powers the sensor, the microcontroller and the buzzer.

In the center is the Atmel ATiny26L micro, with inputs of the sensor's analog voltage on pin 1 and the 3 button switches on pins 2, 3, and 4. The button connected on pin 9 is the Program button and is used to put the circuit into PGM mode which allows the user to change the access code.

The buzzer is driven via a 2222 npn transistor which gives enough current to drive the buzzer. Regulated 5V is the power source for the buzzer. The transistor Q1 is turned on/off by the micro. The micro cannot put out enough current to drive the buzzer on its own, thus Q1 is needed.

Click here for a .pdf of the bottom copper suitable for iron on transfer. The .pdf has correct size for components and is a mirror image to allow for being ironed onto the bottom of the board. The top artwork can be ironed on the other side if desired. Clik here if to see the top artwork in .pdf file. This of course requires a double sided board. As you can see in the photo of the finished board below, I just added artwork with a black marker. Double sided boards are troublesome.

Here's the finished board. The boys made the boards themselves, part of the process. I showed them how to transfer the bottom layer trace artwork by printing the bottom layer .pdf file onto the transfer paper, then ironed it onto bare copper board. We then etched in a solution of Ferric Chloride available from Radio Shack. I supervised this closely to avoid stains in my house.

Then they drilled the boards on my drill press and then built up the board from parts in my lab. I did the programming of the micro.

List of Parts:

  • Atmel ATiny26L Microcontroller
  • 7805 Regulator
  • on/off switch, SPST, 3 pin w/0.1" pin spacing, PCB mount
  • ]pushbutton switches x 4
  • 4 pin 0.1" header
  • 2 pin 0.1" header
  • 1N5819 Schottky diode
  • .1 uF ceramic capacitor x 4
  • LEDs - 1 green, 1 red, 1 yellow
  • 1N2222 npn (or similar npn type) transistor
  • 1K 1/4 watt resistor x 5
  • 10K 1/4 watt resistor x 1
  • 100 ohm 1/4 watt resistor x 3
  • 220 ohm 1/4 watt resistor x 1
  • buzzer, 2 pin self oscillating type

Other files available:

Eagle format schematic file

Eagle format board file

BASCOM (BASIC language compiler) format software

HEX file for Atmel ATiny26L