DIY Home Automation Intruder Alarm System Explain
If you watch my video about essential tools that you will need for creating electronics projects, then you know that the lab in my apartment houses some rather expensive equipment, which I don’t want to get stolen. I was thinking about. creating an intruder alarm system, which basically sends me an alarm notification to my smartphone whenever my apartment door gets opened while I’m not home.
Now the hardware side of things is pretty straightforward, are using an ESP 8266 microcontroller that comes with Wi Fi. In order to send over the status of a magnetic we’d switch positioned on the frame of the door. While magnets get secured to the moving part of the wall. The reed switch basically closes its contact when the magnet gets too close, and dance We got to define statuses that either indicate whether the doors open or closed. The only question left to answer was how to do the software. And I was actually thinking about integrating this small project into my previously introduced home automation system would syndrich. But then one of my Patreon supporters suggested that I should check out the ESP home project, which I promptly did. And let me tell you that after having a closer look at it, as well as the home assistant software for which it is actually just an add on, I was convinced that I need this in my home. And in this video, I will not only show you how to create this intruder alarm system to the help of a Raspberry Pi and ESP 8266 and some additional components. But I will also show you how to use the home assistant software to for example, turn on your lights, or some sensor data or automate a couple of things. Let’s get started.
This video is sponsored by jlc PCB, be free to visit their website to not only find out what awesome PCB and assembly services they offer, but also to easily upload your Gerber files and thus order affordable and high quality PCBs quickly. First off, we need the Raspberry Pi. And luckily for me, I got this old Raspberry Pi three laying around. The reason why we need such a single board computer is that we need some kind of server for the home assistant software, which the PI will be. That means it will connect to our router and our network and act as a bridge between all the ESP devices and our interaction devices like a PC or smartphone. This way, we can not only program the ESP boards through a web user interface that the home assistant software comes with. But we can also for example directly turn on lights with IDs or it can visually represent about temperature data or the status of my door sensor. So let’s get started by grabbing a suitable micro SD cards, inserting it into computer and downloading the fitting image file for your Raspberry Pi. After extracting it we can use the Ballina extra software to write the image to the SD card.
After that was done, I created two new folders on the cards called configure network into which I created a new file where I entered the information of my home network. You can of course find more information about this process on the home automation sites, but which and many more useful sites, you can find the links in the video description. But anyway, as soon as that was done, I inserted the SD card into the PI and supply the five volt power to it. At this point, we basically have to wait for bits and after a couple of minutes, you can check your router to find the IP address of your Raspberry Pi which should now be called home assistance. After then opening this address to the ports 8123 we can see that the home assistant was still getting and Stoltz mom’s recipe we can add idylic petition
name and passwords and thus was able to finally have a look at the user interface. So let’s continue by navigating to supervisor and add on store where we have to search for an install ESP home.
As soon as that was done, we can basically start the add on and open it and to no surprise we do not have any Pino gets to change that we click on Plus, there are named my pros not lights. The device type is a node MCU, which is the style of ESP 8266 I will be using. And finally I entered my Wi Fi information. And as we’re basically done, now in theory, you we could hook up the ESP board to the computer and see the serial port in the software. But for me, this never worked out. So I had to compile the firmware, download it, and then I had to use the provided ESP home flasher, which always looked like a treat. After once again powering the ESP boards, we can see in ESP home that it is now online. And that is the point where we can edit its codes. What I added was a simple switch set up on the pin define, which I will call lights. And after clicking up loads, the code compiles and automatically sends it over to the ESP or to Wi Fi. And if we now switch over to configuration and integration, we can see that the software discovers an ESP home device, which we can add to the dashboards. Here we can easily turn the switch on and off, which as you would expect pulls the five pin of the ESP boards to the supply voltage or grounds. In my case, I’m using an LED as my light example. But if you get yourself an ESP board with relay, then you can also easily switch light bulbs on and off.
Of course, you cannot only turn on the lights manually, but also to automations which you can find under configuration. Then we can set a trigger like for example the sunset, at which point an action should be performed which is in our case turning on our lights This way you can easily automate your entire home material likings, which is pretty awesome and easy to do. Moving on though, to control the system through a smartphone, we first need to download the home assistant app. Then we need to add a URL for our home assistant server, which is necessary to access our home assistant to sell your data. And not only when we’re connected to the home network. For that there exists a free methods with the help of duck DNS. Which you can find videos on YouTube. But I prefer the home cysteine cloud methods, which may cost the monthly fee after trial periods. But on the other hand, it is true reliable and also offers Alexa and Google Assistant integration. So after creating an accounts, you basically get a remote control URL, which you can now enter into your smartphone. And as you’re granted access To a home assistant anywhere in the world to turn on your lights. As the next example, I got this BMS The 280 temperature and humidity sensor that they want to add to this system Luckily ESP home supports the sensor along with tons of our sensors. So I only had to copy some of the example codes Uploaded were up the sensor net The entities to the dashboard and customize the dashboard a bit in order to integrate the sensor. Super simple.
But now let’s get back to the door sensor for which out only connected it Read switch to another ESP boards, but also a toggle switch according to this wiring diagram I will flip the toggle switch when I’m out of the apartment for a longer time because I do not want to receive an alarm every time I opened the door so I’m After creating a new naughts and uploading the standard firmware edited the code of the knots to be true to binary input It’s one of the magnetic reads which as the Do all NPR is the toggle switch as my On vacation inputs After uploading these codes Adding the entities to the dashboard You can see that every thing works just fine. So I continued by creating an automation which sends out an alarm message to my smartphone when the door is being opened and the on vacation switch is activated. After saving it, you can see that Unless both of those events occur, I do in fact get a notification. Beautiful. So it was time tomorrow to Raspberry Pi into its own enclosure which coincidentally can be mounted Inside my distribution box, into which I also edit it by With power supply they quickly wire it up in order to power the Pi for the ESP system, however, 3d printed myself in nice enclosure which I designed in fusion.