Arduino Panic Alarm

Here is the circuit of an Arduino-based Panic Alarm! The wiring is very simple so that even a novice can construct this interesting circuit without any difficulty.

Arduino is a family of microcontrollers (tiny computers) and a software creation environment (Arduino IDE) that makes it easy for you to create programs (called sketches) that can interact with the physical world. The Arduino environment has been designed to be easy to use for beginners who have no software or electronics experience. However, try to learn more/refresh your knowledge about arduino platfrom, before constructing this circuit. If you are new to Arduino, this link will help you get started In addition, there is an active and supportive Arduino community that is accessible worldwide through the Arduino forums.The forums offer project development examples and solutions to problems that can provide inspiration and assistance as you pursue your own projects. Here is a simple Arduino guide for beginners

Panic Alarm circuit consists of two equally important parts. The first part is the ready-made Arduino Microcontroller board, and the second part is an interface circuit which can be wired on a piece of prototyping board. You can use any standard 9V battery to power the whole circuit, and the Push-ON (push ‘n’ hold) switch (S1) to activate the alarm function. An additional Electro-Magnetic Relay (EMR) is also attached to the interface circuit. With the help of this relay, it is easy to energize other (external) high-power blinkers or beepers, if necessary.

Panic Alarm Lab Notes

  • Prototype was constructed & tested using “Arduino UNO-R3” board
  • Sketch created,compiled & uploaded (to Arduino board) using Arduino IDE0022
  • Piezo-Speaker in the circuit is a “passive piezo-speaker”. Do not use an “active piezo-buzzer”
  • Use standard flexible wires for interconnection between two boards. Keep the wire length as short as possible
  • A 9VDC/1A SMPS power supply can be used as an alternative to the 9V battery. Remember to keep an eye on supply polarity
  • A “9VDC/225 Ohm” Electro-Magnetic Relay was used in the prototype. Contact Capacity of the relay (resistive Load) is 10A 250VAC/10A 30VDC

Panic Alarm Interface Circuit Schematic


Panic Alarm Arduino Connection Reference Diagram


Arduino Sketch

// by T.K.Hareendran //
int rlyPin = 12; // Relay Output Pin
int sensPin = 2; // Switch Input Pin
int ledPin = 13;  // LED output Pin
int pzSpeaker = 10; //Piezo-speaker Output Pin
int val = 0; // variable for reading the Input Pin status
void setup() {
  pinMode(rlyPin, OUTPUT); // Set Relay as output
  pinMode(sensPin, INPUT); // Set Switch as input
  pinMode(pzSpeaker, OUTPUT); // Set Piezo-Speaker as output
  pinMode(ledPin, OUTPUT); // Set LED as output
void loop(){
  val = digitalRead(sensPin); // read input value
  if (val == HIGH) { // check if the input is HIGH
    digitalWrite(rlyPin, HIGH); // turn Relay ON
    digitalWrite(ledPin, HIGH); // turn LED ON
    playTone(500, 600);
    playTone(500, 800);
  else {
    digitalWrite(rlyPin, LOW); // turn Relay OFF
    digitalWrite(ledPin, LOW); // turn LED OFF
      playTone(0, 0);
// duration in mSecs, frequency in hertz
void playTone(long duration, int freq) {
  duration *= 1000;
  int period = (1.0 / freq) * 1000000;
  long elapsed_time = 0;
  while (elapsed_time < duration) {
    delayMicroseconds(period / 2);
    digitalWrite(pzSpeaker, LOW);
    delayMicroseconds(period / 2);
    elapsed_time += (period);

One Comments

Join the conversation!

Error! Please fill all fields.
  • engineerfaizanhamayungmail-com

    Hello i need over and under voltage circuit for AC circuits with buzzer alarm.
    For voltage lower then 190vac it should switch the buzzer ON and from 190-255vac it should be OFF after 255vac it should ON again.This will sets lower and upper limits.

Looking for the latest from TI?