New way of looking at things

Ok, so in my last post I told you that I was ditching my attempts at making ESP-8266 due to the fact that I have been unable to crack the nut of making it battery powered. I am sure there is a way to make it work, but I have not managed to find it.

A new approach

So what to do next?

Well, this time I thought I was going to do it a bit differently by using more standard components to make things work. I will also ditch the battery powered part and run it while hooked up to the electric grid.

New setup

One of the things I wanted to make out of this project was the ability to scare an intruder off BEFORE they manage to get inside the house.

This project will require a number of parts to work the way I want it to.

  • A PIR sensor that detects movement that allows actions to be taken
  • An outdoor alarm siren (or more than one)
  • Cameras placed in strategic positions
  • A web page that allows me to see what happens from the cameras.
  • Some kind of notification being sent to my mobile phone
  • Some kind of app or web page that allows me to take action against the possible intruders (sounding the siren(s)). Preferrably before the enter the house.

Home automation

There are a number of different home automation systems out there. Nexa and Z-wave to name a few. They all have pros and cons. One of the biggest issues seem to be security wise. Especially Nexa seem to be more or less oblivious to security. Z-wave have the abilty to communicate through a 128bit AES crypto… unfortunatly the crypto is not required and there are a number of Z-wave components that may or may not support encrypted communication.


Flow of information

How do I go about making this happen? Well, this is my initial thought (which I don’t know if it is going to work yet.

  1. A PIR operated flood light placed in a strategic position
  2. A Z-wave smart plug with power consumption feedback
  3. A Z-wave controller (RaZpberry2)
  4. A push notification to my mobile alerting me to the situation, sending pictures from the camera covering the PIR area
  5. I check the images for intruders
  6. If false alarm, do nothing. If intruder is detected, sound the alarm

PIR operated flood light

This is just a common PIR activated flood light that lights up when someone comes close. Nothing special at all.

Z-wave smart plug

There are a number of different smart plugs that allows you to activate or deactivate the plug. A couple of them comes with the ability to report back the power consumption. My thought here is that the PIR sensor will draw more power when the flood light is activated than when the sensor is in overwatch mode. If that is the case then it should be possible to use the flood light PIR sensor to detect the movement instead of getting a (much more expensive) separate Z-wave PIR detector.

Z-wave controller

There are any number of controllers out there. Everything from standalone units, to USB sticks to the RaZpberry2 controller that you connect to the GPIOs of a common Raspberry PI 3. My thought here is that the RaZpberry will allow more custom automation than a USB stick or standalone unit. So far my searches on the matter have been inconclusive.

Push notification app

Cool, I get to do an Android app that allows me to recive a push notification that the flood light have been triggered… as well as allow me to push a button to activate the siren… the only question left is… How do I even start? I have never developed any Android app, not even Hello world… Oh well, learning is part of the fun anyway 🙂


I have had a couple of IP cameras of different brands. They have a few things in commong… the saddest one is the fact that their motion detection algorithms suck a**. Either they trigger on a leaf blowing in the wind or they won’t trigger even if you are jumping up and down right in front of the camera.

One of the cameras didn’t even have a image adress, the only way to get images was to install their app… and I BLOODY HATE “Cloud cameras” due to the security issues connected to them. Suffice it to say that that camera is no longer in use.

The cameras I currently use is two Dlink DCS-932 (640×480) and one Dlink DCS-935 (1280×720). The DCS-932 cameras resolution s a wee bit to low to my taste, but they will work for their intended purpouse. The DCS-935 is pretty decent, but the recording function does not work satisfactory for sequences longer than 10 seconds.

Unfortunatly I don’t know which camera to use. Cameras are pretty expensive and one thought I have been playing around with is to use Raspberrys and their camera modules to facilitate full HD cameras at a lower price than worse commercial cameras.

Camera web page

I need a web page that gives me an overview of what the different cameras see.

One issue here is the fact that I will NOT be doing any port forwarding to the actual cameras because that would make my network wide open to intrusions and I would not want that now would I ?

I have been using the Aprellium Abyss web server X1 for quite some time. These days they have what is called a reverse poxy. This allows me to get the images from the camera by pointing to a specific URL and I  have made this work pretty neatly. Abyss also allows me to set access rights to a path so that the actual camera page is password protected.

The webpage in itself is actually done. It contains a simple table with images of my different cameras as well as a simple javascript that reloads the images when you press the image of the camera. So far it has worked out pretty good.

This is the javascript I use. The reason for the ignoreCache parameter is the fact that the DCS-932 cameras seem to be caching the images even if I use pretty much every disable cache meta header available. The new Date().getTime() solves that problem by adding the current time to each image url.

function refreshImage(id, url, ignoreCache) {
var image = document.getElementById(id);
if (image) {
if (ignoreCache) {
image.src = url + ‘?’ + new Date().getTime();
else {
image.src = url;
console.log(‘Could not find ID: ‘ + id); }

I then call the javascript this way.

<img id=”<imageId>” src=”<cameraUrl>” alt=”Could not load camera xxx” onclick=”refreshImage(‘<imageId>’, ‘<cameraUrl>’, true)” />

Simple and straight forward, I just replace <imageId> with whatever Id I wish the camera to have and <cameraUrl> to the cameras image url I am golden.

Alarm siren

There are a couple of Z-wave sirens available. One is actually solar powered but quite expensive… too expensive for this trial. My thought was actually to use a regular 12V siren with a smart plug that I turn on or off with the app.

Current status

I currently have a Raspberry PI 3 running RetroPie. I just got a different sd card that I will install raspbian on. Other than that I have nothing of the materials above except the cameras

Initially I will get the RaZpberry Z-wave controller and a single smart plug to testing purpouses after that I will have to see.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s