Maker Pro
PIC

Make a Talking Security Alarm With a PIC16 and ISD1820

September 09, 2017 by Robin Mitchell
Share
banner

This security system will fool intruders into thinking that someone is around.

Tools

4 10K resistor
6 100nF capacitor
3 1N5817 diode
2 2N3904
1 Buzzer

Hardware

Alarm circuits are common in the field of hobby electronics, typically utilizing a switch (such as a reed switch) and a speaker to produce an alarm. However, the alarm system in this project has several unusual features that will be able to fool most intruders.

In this Maker Pro project, we will make a security system that will fool intruders into thinking that someone is around!

Warning! Atchung! Attention!

This project uses mains voltage for lamp control via the relay. ONLY ATTEMPT THIS IS YOU ARE CONFIDENT AND COMPETENT TO DO MAINS ELECTRICAL WORK!

Talking Security Alarm Schematic

How Does the Talking Security Alarm Work?

The project circuitry is rather simple, with the complexity of this project being found inside the microcontroller (PIC16F1516) and the ISD1820 module. The idea behind the circuit is to make an intruder think that someone is at home or nearby, and this is done in three steps:

  • Once a detection has been made, the relay is activated and turns on a light.
  • After a few seconds, the ISD1820 is triggered to play some audio (“Hey, what are you doing here?!”).
  • An alarm is then raised and plays for 20 seconds.
The relay and buzzer (RL1 and BZ1 respectively) are not directly connected to I/O ports on the PIC, as the PIC lacks the current sourcing requirements. To solve this, a transistor is used instead, whereby the PIC only needs to source a few mA to turn on either the relay or buzzer (remember that transistors can behave as electronic switches). The relay also has a diode in reverse polarity across its terminals, as it is an inductive load, and negative voltages generated when the current is switched off could damage the transistor and/or other parts.

Connecting the mains plug to the lamp via the relay

The ISD1820 module is a single IC solution that can record and play back up to 10 seconds of recorded audio (picked up by the microphone). What makes this module very useful is that the record and playback features can be controlled via an external circuit including microcontrollers. Two I/O pins control how the sound is played back. PLAYE plays the entire recorded audio upon a clock pulse (active high), while PLAYL plays for as long as the input is on. For our project, we need the PLAYE pin and not the PLAYL pin. The PLAYE pin is connected RC2.

The ISD1820 Module used in this project

Everyone reading this project will be happy to hear that I have switched from MPLAB 8.92 and Microchip C18 to MPLAB X and XC8, which means most of my projects and code will work for all PICs in the PIC16 and PIC18 series of microcontrollers. One nice feature about this is that all code for PIC16 chips can now be in C, and many PIC16 chips are very cheap. The microcontroller in this article, the PIC16F1516, has to be the best bang for its buck. It comes with the following features:

  • 16MHz internal oscillator
  • 8K ROM, 512 byte RAM
  • 28 DIP package (plenty of IO)
  • 3 timers (timer 0, timer 1, and timer 2)
  • ADC, UART, SPI, and I2C
The code for the talking alarm is very basic, with the main loop checking for a logical 1 on the RA0 pin. Once a detection is made, then the system kicks into action and starts with a delay, so, if the intruder heard the security switch trigger, then they may think the system did not detect them. Once the delay has been done, we need to fool the intruder into thinking that someone has been woken up. This is done by activating the relay, which is used to enable and disable power to a mains lamp (remember to switch the LIVE wire and NEVER THE NEUTRAL!). Another delay kicks in to give the impression that someone is half awake, and then after that, the ISD1820 module is activated, which plays our message “Hey! You! GET OUT OF MY HOUSE”. If the intruders still have the courage to stick around, the system enables the buzzer and starts alarming the area. After a while, this alarm is turned off, and the system resets, but at this point, the intruders should be far away!

Construction

This project uses all through-hole parts, which allows it to be built using most circuit construction techniques. These include breadboard, stripboard, veroboard, matrix board, and even PCBs. However, in this project, I have opted to use a PCB, as it makes construction neater and easier to do (i.e., no flying wires).

You may notice the white layer on the PCB; this is an experimental silkscreen (also known as a component legend). When making PCBs at home, they can be difficult to construct without both the schematic AND PCB layout side by side. On a laptop, this is very impractical, as the screen is not very big. So, instead, I am experimenting with component legends by printing out the silkscreen onto paper, gluing it to the topside of the PCB, aligning it correctly, and then cutting the overhanging paper off using a sharp knife.

The results have been acceptable, but it turns out that my CNC needs some scaling adjustments to make it fit perfectly with the printouts. The paper can also get dirty and smudged, so it's important to use a laser printer and not an inkjet. I plan to purchase some colored cardstock to produce a thicker layer that is more sturdy and that looks nicer (white shows dirt too well). Paper is also rather thin and can come up on the edgesn but in terms of functionality, it worked really well.

Author

Avatar
Robin Mitchell

Graduated from the University Of Warwick in Electronics with a BEng 2:1 and currently runs MitchElectronics.

Related Content

Comments


You May Also Like