Raspberry Pi security alarm – the basics
blog.cavelab.dev
blog.cavelab.dev
Got me thinking about some business things, and apologies if this goes off topic....
50 years ago there were a wealth of books for electronic hobbyists to build things like this - home automation, home security, plant irrigation systems and suchlike.
Later an industry sprang up to make products for this market which was initially niche and geeky. Small companies became big companies. Big companies became shitty, extractive, exploitative monopoly companies as the author describes.
Today we lament an apparent choice between "convenience" and "too much work to do yourself". The cynics and naysayers are always keen to point out just how few people can accomplish anything like this - and that is indeed true.
But between the lonely hobbyist with soldering iron in hand, and the big technology company was an era that seems almost dead today (for many reasons like customer support and reliable sourcing). It was the kit movement. Many of the early microcomputers were in fact kits. Clive Sinclair first offered the ZX80 as a "solder it yourself" job. Heathkit hifi and music synthesisers were a big thing for a while.
Many people who couldn't build a home system like this might be interested in a DIY solution if they had a big helping hand up. I wonder what happened to the kit economy and why it doesn't work as a business model any more.
"back in the day", it was hard to get anything, computers were expensive, electronics (except very basic) were hard to source, and prebuilt software (for whatever custom use) was non-existant.
Now, a microcontroller with wifi and bluetooth is <$5, a computer/server for running code is ~$50 (if you manage to find a raspberrypi, or a bit more for a micro pc), wireless interfaces (zigbee, bluetooth) are cheap, prebuilt code for sensors (tasmota, esphome,...) is very mature and stable, central management systems (home assistant,...) are stable and support pretty much everything...
The only problem I see is, that a lot of people have lost their tinkering capabilities and don't want to get their hands dirty compared to "back then" when a lot of stuff needed getting your hands dirty and more people went along the DIY path.
The Heathkits and even things like the Radio Shack spring-wire 250-in-one type kits had you build circuits from all individual components: resistors, capacitors, diodes, transistors, inductors, etc. If lucky, maybe a few basic ICs like triple-nickels, op-amps, comparators. After hours of soldering/wiring you had something that did some very basic function - not a microcontroller/SBC with full programming language support and more power than a supercomputer a few decades ago.
Jameco Electronics https://www.jameco.com/
The Electronic Goldmine https://theelectronicgoldmine.com/
All Electronics https://www.allelectronics.com/
Back in the 60's through the 90's we also had Haltech and Halted Specialties, electronics supplies and surplus in Sunnyvale/Santa Clara, each about a mile from each other.
Many folks confused the names.
As I recall, both of them had resident cats as well.
My High School electronics teacher turned me onto them in 1969.
It appears Haltech is defunct, and not surprising since the owner was OLD when I was shopping/browsing there in the 70's - 80's.
Oh, looks like Halted changed their name to HSC and may still be in business.
https://www.scrapmonster.com/company/hsc-electronic-supply/3...
Aside from many parts, I also bought my first of several surplus HeNe LASERS there in 1974.
In 1980 I got one of these kits for my auto repair shop, and yes, it was quite a challenge to build, but it saved me hours of automotive diagnostic time.
A comparable automotive ignition analyzer scope at the time was thousands of dollars.
Heathkit CO-1015 Oscilloscope Engine Ignition Analyzer Tool
https://www.ebay.com/itm/144853683301?epid=1323946549&hash=i...
Nowadays it's mostly reversed, so many gadgets can be just bought for cheap, hell even if you want DIY what you will DIY changed massively.
Back in ye olde stuff like signal generator or power supply was probably the stuff you DIYed or made from kit, nowadays they are so cheap and so much better than whatever you'd make first. On flip side dev boards or breakout boards with various "fun" devices are aplenty so your first projects might be something actual EE might've spend week to build in the 90s
The "everything is a breakout board" might make people not start with the basics at first but in the end I think that lower barrier to entry is a good thing here
Back in the day, business computers were the most powerful systems. Nowadays, it's consumer electronics that is getting more powerful. Which is great for consumers. But not so great for startups who want to build their company on top of these systems.
So, I think the spirit of kits lives on, just in a different way :)
[0]: https://www.matrix.one/products/creator [1]: https://konnected.io/
Like Adadfruit, SparkFun, Jameco, Seeed Studio, Tindie, etc?
Oddly, flat-pack furniture has become the norm and self-assembly is expected for most products. Obviously this has to do with size, weight, shipping etc.
- - - -
To me the sequence of events in the RepRap (self-printable 3D printers concept) space is very telling: the middle ground between hobbyists and professionals seems to have hollowed out. You can design a part and have it printed and shipped to you within days, of pretty much arbitrarily high quality, involving plastic, metal, rubber, etc... Or you can get a kit for a 3D printer, but it will take time before you can actually print well enough to do anything useful, in the sense of being economically competitive with the 3D print shops or e.g. the Daiso chain.
Daiso is incredible. You can outfit an enter household with quality items for just a dollar or two each. Average item price is about $1.75 I'd guess. That covers the entire thing: raw materials, design, manufacturing, distribution, profit, etc... You're just not going to beat that with a toy 3D printer on your kitchen table, eh?
I think for people willing to put in the time — things have certainly become much easier. I started with AVR microcontrollers about 20 years ago, and couldn't even dream of accomplishing things I am easily able to to today. Raspberry Pi, Arduino; have changed the scene for sure.
But at the same time; maybe there is less inventive for someone to really dig into something, as you say: with soldering iron in hand. As so much is available as a product or service already.
My first "serious" soldering was a few PCB kits :)
During the first round of lockdowns I also spent a few lazy afternoons tinkering around this idea, mostly to get the feeling of how hard it would be (https://github.com/carlosefr/pialarm).
There are a few nasty requirements commercial alarm systems have to meet that I don't see mentioned in the article, namely how it protects against tampering and voltage spikes (which can be used as a form of tampering).
One way to protect the controller from ESD and shorts is to use optoisolators on every input and output, which should also be dry contacts (grounded=on, floating=off) whenever possible.
To detect environmental faults and tamper-inducing faults the controller can use analog inputs (which the Raspberry Pi doesn't have, but can be easily added with an MCP3008 ADC, for example) instead of digital GPIOs. This is why commercial systems need input resistors inputs added at install time depending on the particular sensor configuration.
As a software person, thinking about these things gives me a much greater appreciation for people doing industrial electronics design.
PS: For the average geek, an easier path is to interface a Raspberry Pi to a "dumb" commercial alarm. You can have the Raspberry Pi behave like a standard sensor input or monitor the sounder outputs.
There is no protection against voltage spikes on the inputs, there is just the pull-up resistor on the Raspberry Pi input. So this is a weak point. I did consider both EOL resistors and optoisolators when I first got started. But decided against it.
There are dedicated tamper inputs, which runs through the tamper switches in multiple devices before returning to the control cabinet. But EOL resistors would be a better and more secure option. I have thought about using something like an AVR microcontroller to read the voltage level and convert to something the Raspberry Pi could use. Maybe in the future.
I can always make changes in the future — thanks for your input :)
I think many systems fall through if the threat model includes someone watching you and doing a replay attack. But I'd still prefer a hardwired panel TBD. It's just not very easy to retrofit, with hidden cables.
I went the lazy way and used an Ademco Vista 20p. It is old school, but solid. I wanted to make it a little more friendly so I went with an AD2USB virtual terminal and raspberry pi. There is a python library for it and from there you can do whatever you want and the clucky old alarm system doesn't know the difference between you arming the alarm at the keypad or a cron job arming the alarm. Of course you also get all the events happening on the system.
Reading this post I was coming up with so many questions.
1. Shouldn’t there be a way for police to turn it off?
2. What are the legal consequences of the alarm accidentally firing and disturbing the neighbors at night?
3. Do sound alarms deter only small burglars?
Having my house visited once while I was away and twice at night when I was there, I'm now prepared. The two times I was there, I make the bad guys run away but I still don't know if they knew I was there or not and what their plan was.
So now I take no risk and I've got an amazing alarm system.
To me the most important is that the alarm makes it physically impossible for the thieves to steal much. My alarm system gives the thieves 45 seconds to give a password (and they don't know it). If I'm under duress, there's a "I'm under duress" password and the security company will answer: "Fine, have a good night" while they actually call the police. So the thieves cannot know.
If no password is given, after 45 seconds a smoke fills the entire house. It already triggered, worked wonders. It leaves no trace once it dissipates.
With the smoke the thieves cannot steal anything. They certainly don't have the time to find the safe / open it.
The game becomes: "Without seeing anything (due to the smoke), find the door to flee the house before the police arrives".
That's what I love with this alarm system: it turns the thieves into preys.
It's communicating over several channels (as an anti-jamming system). It's got its own battery.
It also detect break-ins attempts, before the thieves are even in: the sensors detect the vibrations and it works (one day I let my hammer drop and that was sufficient to trigger one of the sensor).
They can still break a lot of things while they try to find the exit ...
The best deterrent is quick reaction, even unarmed civilians with torches and calling each other on mobile phones.
The system should rarely/never generate false alarms (crying wolf). Outdoor sensors should only be used if they are completely immune to pets and weather.
Security cameras is mostly used for post mortem. For reliability, it's better not integrate them with the alarm system.
But then again, one could have a short lasting warning siren, and then a full blast one when someone does break in.
Should we set off the alarm by accident, we then have 20 seconds to fix it, before all the neighbors are alerted.
Right now I’m thinking about simply processing the outdoor cameras rtsp stream for people detection and then triggering is if it has a certain confidence.
Can be done quickly on the Pi with something like a google coral accelerator USB stick.
You can also have it send the photo it detects to your phone and you can manually turn on the alarm with that alert after viewing it.
> The Detroit Police Department no longer responds routinely to house alarms, because 98% of house alarms are false. Detroit Police officers will respond ONLY to house alarms that can be VERIFIED as not being false alarms ... DPD recognizes four different ways that an alarm can be automatically verified ... An alarm system sends one signal from a door, window, or other perimeter/exterior sensor AND sends one signal from some sensor inside a house. An alarm system sends three signals from one or more interior sensors. An alarm system sends an audio signal that lets a company monitor hear an intruder. An alarm system sends a visual signal that lets a company monitor see an intruder.
> Do sound alarms deter only small burglars?
What deters non-small (organized?) burglars?
I think organized criminals would call off an operation if circumstances they haven’t predicted occur. Especially those that significantly increase the time or reduce the chances the operation will be successful.
One thing is having the inside doors lock. Another is encountering an armed individual. Finding non-portable hard to open safes, etc.
But then again, it’s mostly better to diversify where you keep your belongings so you don’t end up a victim of organized crime in the first place.
40mm noob tube auto turrets and lava pits.
1. Hm, maybe. If they were to arrive, they would have to call me — I could remotely disarm the system or give them the code.
2. Not sure, my closest neighbors are aware of the alarm system. No false alarms in 13 months I've been using the system.
3. I used to work as an alarm technician; you can't really prevent the pros breaking in, getting what they came for and getting out. But you can prevent someone spending a long time inside the house looking for things to steal.
That’s great. How often do you test it?
> I used to work as an alarm technician
Ok, that explains a lot.
> you can't really prevent the pros breaking in, getting what they came for and getting out. But you can prevent someone spending a long time inside the house looking for things to steal.
That’s the main use-case for such an alarm then.
Most sensors gets used on a daily basis — as they are part of other home automation, like motion activated lighting. I can put the system in "walk test" mode, which gives a verification sound every time a sensor is activated. And there is a siren test function. I try to do those about once a month.
> That’s the main use-case for such an alarm then.
I'd say so. As I said; we have good neighbors that would react to the alarm, and I get notified on my phone. But the pros are normally gone before anyone has time to react anyways :)
We chose a ‘dumb’ old school wired alarm because they run reliably for years with just battery changes and dust blow-outs, and linked it to a network dome camera to handle the ‘smarts’.
I don't know about Norway, but just south of Norway, in Denmark, having something automatically call the police would be an issue. Not sure it's illegal, but there are rather few police officers in many parts of the country. In the northern part of the country you have a large zone with zero police officers on duty for the entire winter and similar situation elsewere in the country.
The author may very well have good reasons to dislike the security companies operating in Norway, but the service they provide isn't actually the alarm system, it's the operation center staff and their security patrols.
Without the security service, I'm not sure I see much value in an alarm system.
* supports Home-assistant.io
* phone app
* cellular data hookups (got my own cellular remote monitoring thing going)
* both wired and wireless zones
Again, like other commentators, I leave my video stream system separate from the alarm system (vid capture is on 24/7 private cloud)
Also, spent many months reverse engineering the Ademco/Honeywell/ADT Command 7” LCD control panel simply because one can buy this for $5 to $50 (they are regularly tossed out by new homeowners who wish not to bother with ADT $399/year plans). RE effort was a pretty intense but complete add-on to Vista 20P alarm panel, but I just stopped because there are no others way to connect except by doing WiFi, was looking for a direct connect.
Now you can have your own private monitoring station.
Zero $/month for remote monitoring station.
https://www.elkproducts.com/m1-security-automation-controls/
* The protocol has a lot of oddities. E.g. it sends out spurious "fully armed" messages when it's actually in the process of arming [1] so a good integration has to debounce these. (The one built into Home Assistant doesn't, last I checked. It just reports weird states. iirc it will even say "arming" long after the panel is fully armed.) The command to (dis)?arm remotely only works if the user whose code is supplied is configured in a particular way. (Can't find the reference for this right now. It might be that the keypad's "Bypass key requires User Code" can't be checked or something non-obvious like that. Whatever the setting is it makes just entering the code not start arming the panel immediately but wait for another button press. I think the serial protocol just emulates that entering the code in the keypad, which is an unfortunate choice.)
* The remote programming tool is a flaky VB.NET app. The protocol for this part isn't documented, although I've reverse-engineered part of it.
fwiw, I have a work-in-progress Rust crate for talking with the Elk. [2] It can be used with Home Assistant via the MQTT alarm panel integration. [3]
I can definitely see the appeal of rolling your own. One problem though is that I think when talking to an alarm company, the panel is supposed to be certified in some way, which would be a significant barrier for a hobbyist design.
[1] https://www.elkproducts.com/forums/topic/spurious-armed-full...
[2] https://github.com/scottlamb/elkm1
[3] https://www.home-assistant.io/integrations/alarm_control_pan...
I always thought it would be a pretty viable start up business to sell a security system in a box for people with existing security equipment. Connect the security system in a box and then open and close your door/window/etc to begin monitoring those wireless events.
Shameless plug: I wrote the rtl_433 GE/Interlogix sensor protocol decoder.
It never ceases to amaze me, everytime I think of doing something, someone beats me to it, haha.
Excelent projetc by the way
- no ESD (high voltage impulse) protection - reliable power source - compatibility with external centralized security systems protocols
I guess in every country any kind of monopoly leads to inflated prices and stagnation. We also have so many outdated and cost ineffective security systems here.
From the grid? See below. On the inputs? No, you're right.
> reliable power source
Not included in this post, because I'm not done with it yet, is the backup battery. The entire system runs on a 7.2Ah leaf-acid battery, which is connected to an electronic charger. So the alarm system power is isolated from the mains. I'm going to document this later in the series, when I'm all done :)
> compatibility with external centralized security systems protocols
I didn't really consider this, but it's easy to add if needed. Any examples?
I slapped together similar (but much less impressive) take on this theme very recently. I use VNC for remote access rather than SSH'ing into my home network directly. Do you opt to just forward a port on your router and send it to your pi's SSH port? I wasn't sure how risky that would be or what options exist for that.
Also I noticed you mentioned a water sensor at the end, I did a similar project for that as well after I had some basement water issues. I just got a couple of super cheap humidity sensors and had them take a picture of the scene and email it to me if the sensors thought they were submerged. Great minds think alike! :)
I don't allow SSH into my home network — I only SSH into the Raspberry Pi to work on, or modify, the alarm system when I'm at home.
For remote access to the alarm system itself I use Home Assistant, which communicates the the Raspberry Pi on MQTT.
I'm, looking at cutting the power to the dish washer, and closing the main water valve in case of a water alarm. And there is a short siren burst every 10 seconds. But this is still very much a work in progress :)
Nice project :)
It's great that random hobbyists can send out to have a one-off fabrication of a slick PCB. But it's also nice when we can DIY more things.
Hmmm, what's your use case for the Armed home mode?
I'd likely forget it, and open a window or door triggering the alarm.
Water sensor support is a great idea, as I've had a couple of old water heaters fail in the past, nice addition.
I have a Raspberry Pi 3+ sitting around doing nothing, so maybe this is a project for next winter.
edit: Just saw your Kids traffic light, what a fun project to teach children about traffic signals.
We use the Armed home option at night, we do remember to turn if off, because the digital calendar and lights in the kitchen won't turn on when it's activated.
Kids are always a good excuse to create silly and fun projects :D
There has been some reports here in Norway of alarm station employees sharing photos of nude people — caught on their own motion sensor cameras triggering the alarm…
I think we all have it in us to write good texts, but it takes some motivation, dedication, and practice :)
for basically the same reasons, it's not just in norway, those incumbent security system providers have been making out like bandits for decades
Seeing how many people have expensive monitored alarm systems here; I'm pretty happy with my educational and cheap setup :)