Arduino Panic Alarm, KY-019 relay example

Arduino Panic Alarm.
Hello world! Today i made an example on the KY-019 Relay module.
In my video i use a Alarm with strobe attached to it, but the strobe is not working because i use a 9volt battery,
and the alarm is 12v. Anyways… it works, and it’s very simple to build.

Schematic:
Ky-019 relay module alarm, Arduino Panic Alarm, KY-019 relay examplev

Parts list:
Arduino uno, I used a clone, the RobotDyn uno as i always do. Very good one with 8 analog pins.
KY-019 1 Channel relay
KY-004 Button Module. (You can use another button to of course!)
Alarm strobe (aliexpress) + a power source 12v Adapter for example.
Jumper wires. MM/FF/MF

Code:

/*
Arduino Panic Alarm, KY-019 relay example
Author: Danny van den Brande, Arduinosensors.nl. BlueCore Tech.
In this example i show you how to use the KY-019 Relay with the KY-004 button module.
I attached a 12v alarm siren with strobe. to the relay in the video but 
you can add anything you like of course. the Idea now is that
it is functioning as a alarm/panic alarm that can only be turned off when reset.
If you want it to work otherwise you need to Uncomment the commented part 
in the void loop section of the code.
*/
int Relay = 3;
int Button = 10;
boolean val;

void setup() {
  pinMode(Relay, OUTPUT);
  pinMode(Button, INPUT);
  
}

void loop() {
  val = digitalRead (Button);
    if (val == 0)
    {
    digitalWrite (Relay, HIGH);
//    }      //Uncomment if you want the relay only
//    else   //to be on when holding the button.
//    {      //now the alarm need to be reset to turn it off.
//    digitalWrite (Relay, LOW);  
  }
}//this code is very simple.
Danny van den Brande

http://www.arduinosensors.nl

Programmer, Game Designer, 3D Designer, Web Designer, Graphic Designer. Jup this website looks crappy.. :) But enjoy the projects! Everything you need is here.

Leave a Reply

Your email address will not be published. Required fields are marked *