DEV Community

Cover image for Home Security System with low cost

Home Security System with low cost

bkbilly profile image Basilis Koulis ・2 min read

There are many security systems in the market, but a DIY system can cut down the cost to about 30€. In this post I will talk about the implementation of my own alarm system that I've uploaded to GitHub.

As for now, my app supports GPIO sensors, MQTT sensors, Hikvision LineCrossing. Multiple notifications can be triggered like activating serine, sending mail, calling through VoIP.

Hardware Requirements

  • The most important thing is the brains of the alarm which in my case I am using a Raspberry PI Zero which is more than enough to run the whole system.
  • The easiest sensors that can be connected are the Magnetic Sensors which need no power. They are connected to a BCM pin and the other end to an empty Ground in the GPIO pins of Raspberry.
  • Active sensors need power that is usually 12V DC. These include the PIR, Glass break, etc... They need a 4 wire cable, one for power+, one for power- and the other two are just like the Magnetic Sensors.
  • A relay for the Serine can also be connected with an extra component called Relay which turns on the power for the serine.
  • The best way I found to connect wires to Raspberry GPIO is by using Female Dupont Pins which look like this: Alt Text

This is a diagram of the connections I explained above:
Connection Diagram


The installation is a simple process that downloads the required files from the latest commit on GitHub. It can also be used to update to the latest release.
After it is done, you can navigate to the Web Interface to add sensors and change settings accordingly.

bash <(curl -s "")
Enter fullscreen mode Exit fullscreen mode


Although the Dupont installation on the wire is a bit intimidating, it can be really easy once you get the hang of it. In case the wiring doesn't exist, I would recommend to call someone else to do this step for you or buy some Zigbee sensors and use the zigbee2mqtt to integrate them through MQTT sensors on AlarmPI.

Check out my GitHub repository here and support my work:

GitHub logo bkbilly / AlarmPI

🚨 Home Security Intrusion Detection for Raspberry PI or any other linux OS

AlarmPI Build Status GitHub release (latest by date)

AlarmPI is a home security system based on Raspberry PI. It supports wired sensors (PIR, Magnetic etc.) and wireless through MQTT or Hikvision. It is controlled with a Web UI, a Android Application, or through HTTP & MQTT messages. When the alarm detects movement, it supports the following events:

  • Enables the Serene
  • Send Mail
  • VoIP Calls
  • Send MQTT message

It is written in python and supports both python 2.7 & python 3.6. There is also the option of having more than one user by editing the server.json file accordingly.


With this command on your terminal you can install and update the application with my latest commit.

bash <(curl -s "")
Enter fullscreen mode Exit fullscreen mode


Web UI

The Web Interface of the alarm has all the features that are needed to configure and use the home security. It supports real time events of the sensors, the logs and…

Discussion (2)

Editor guide