Alarm/Surveillance

The Steelsquid Kiss OS Alarm/Surveillance functionality. 
Connect different sensors to monitor your house or other thinks.
  • Raspberry PI camera
  • Steelsquid Kiss OS
  • IR Lamp [GPIO22, GPIO27]
  • Siren [GPIO17]
  • PIR motion sensor [GPIO25]
  • Light level sensor, PCF8591 (YL-40)
  • Temperature sensor (HDC1008)
  • Humidity sensor (HDC1008)
Capabilities of the system.
  • Stream video to webpage
  • Send mail and/or activate siren when motion detected.
  • Turn on the IR-lamp on low light
  • See Temperature, Humidity and Light level on webpage
  • Activate siren on multiple devices when motion detected on one device.
  • Read status and view video of all devices on one device
  • Arm/disarm multiple devices from one device
  • Android app that send command to the device to arm and disarm depending on distance from home.
You must enable the alarm/Surveillance functionality in Steelsquid Kiss OS, you can do it from the web interface Utils/Alarm/Surveillance and then press the Enable button.
It will take a couple of seconds and you will get connection error...


Web interface 
 
 

Web-interface for the server functionality
One device is the server and the rest clients.
On the server you then can see the clients, you only need to watch one device instead of all...

Android App and Widget (Alarm Arm)
The automatic arm and disarm do not work now...will check that later...but the rest should work...
This app will send commands to the alarm device to enable or disable the alarm automatically.
You can also use the widget arm or disarm it manually.
  • Enter the address, user and password to the alarm device.
  • Enter the distance in meter from home where you want the alarm to disarm.
  • When you are close to the alarm device press the "Get current location" button to get the location.
  • You should also enter the wifi you use at home. 
    Then the app do not need to poll your GPS coordinates when you are home.
    This will save a lot of battery...
  • The further away you are, the longer between the GPS reads. If you are close to home for a long time without being connected to the wifi it might be a good idea to disable the "Alarm arm" manually (You can do that in the widget)
 



Howto build a working Alarm/Surveillance device
Below I try to describe how to build a working monitoring unit. 

All you need

  1. Soldering iron and solder
  2. You need Steelsquid Kiss OS, see this.
  3. Prototype PCB card
  4. ULN2803A
  5. Jumper Wires
  6. Stright PINs
  7. 90° PINs
  8. 2 glass fuse holders
  9. Glas fuse (800mA)
  10. Buck converters
  11. 2, 4 and 8 Female PINs
  12. Prototype PCB card
  13. 16 IR-leds
  14. 3 18Ω resistors
  15. Rubber plate
  16. Rubber paint
  17. Casing  
  18. Super glue
  19. Hot glue gun
  20. Screws and nuts
  21. Window sealer/Dust List
  22. DC power connector
  23. Siren
  24. Jumper cable
  25. Duct tape
  26. PIR sensor
  27. Raspberry pi night vision camera
  28. Light level sensor, PCF8591 (YL-40)
  29. Aluminium rod
  30. Small Wifi usb adapter

Power and connection PCB

Make a small PCB to easy power and connect everything to the Raspberry Pi.
I use a small Buck converter to convert to 5V, then i can have higher voltage in the supply lines.
A 5V cable must be pretty short not to get voltage drop, but if you use e.g. 24V then you can use a long power cable to your device. 
  • I use this prototype PCB card. Must cut away a little so that it will fit.
    Flip the card and file away like in the second picture. The hole that the arrow points to should not be connected to the hole below. Also solder a jumper like the picture.
     

  • Flip back the card and solder jumpers and a ULN2803A.
    Observe that there are only 8 pins left on the ULN2803A, the rest is cut away.


  • Then solder pins  and 2 glass fuse holder.
    I use a 800mA fuse (depending of the voltage you may have to change this). 
     

  • Cut of the pins on the PCB and solder pins to the Buck converter.
    This buck converter is for the raspberry pi, so it must be 5V.

  • Now you must set the voltage on the Buck converter to 5V.
    Use a small screwdriver on the trimpot and a multimeter.
    It can be hard to dial in...

  • When you have set the Buck converter to 5V you can solder it to the PCB.

  • Now take a identical buck converter and solder 90° pins to it like this.
    This buck converter is for the IR-lamp.
    Depending on the type of IR lamp the voltage varies, i my case 9.9V.
    Then solder it ontop of the other buck converter.
     

  • Last step is to flip it and set the raspberry pi connectors on the bottom.
    An then solder on the upper side...
     

  • The finished card

IR LED array

Depending on the IR leds and voltage you must use different resistors.
Use this calculator.
I power the LED with 9.9V
My LED is 1.35V 100mA. And 6 LEDs in serie.
That give a resistor of 18Ω.
And i have 3 of those in parallel, so you need 3 resistors.
But the easiest is to skip this and buyIR 48 LED InfraRed Illumination Light
  • The Prototype PCB card

  • Water proof the PCB
    Take the PCB and glue a rubber plate on the side without the copper.
    The legs of the LED will pass through the rubber to protect from water.
    You can skip this and put it in a box with transparent lid if you want to, it is much more easy, but  din not have any box that fit...
     

  • Then drill through the rubber where the IR legs is to be.
    Use the smallest drill you got.
    And then put the IR LEDs through like the picture below.
    I have 2 different types of IR LEDs because it was included in the kit I bought.
    But they have the same voltage and current.
    The long leg is to the left in the first picture and to the right in the second (i flip the bord).
     

  • When you solder the LEDs, try to push down on them, then they will be better seal between the LED and rubber.
    The LEDs will be exposed to the environment, but I think it will work :-)
    Also solder the resistors and 2 pins...
    Then cut away the part of the PCB you dont need.
     
    If you want to test it apply 9.9V (the side with the resistors is GND).

  • The i glue a simple holder for the PCB


  • At last i paint the backside and edges with rubber paint to protect from water.
    Several coats.

The upper casing half

  • Remove all the plastic pillar.
     

  • Take one of the half and drill two holes for the fittings and two holes for the raspberry pi.
    Countersunk holes for the Raspberry Pi on the outside of the box.
    Tape a bit on the outside so that the screws remain
     

  • Cut out a 16cm x 16cm rubberplate and super glue too the outside off the box.
    Drill out the larger holes (rubber) in the side.

  • Hot glue the large screws, use lot of glue to keep out water.
    And add a list like int the picture (i use a Window sealer/Dust List)

  • Just fasten the Raspberry with Steelsquid Kiss OS and then the Power and connection PCB.
    The upper right connector on the PCB is connected to Pin2 5V on the raspberry Pi.
    Now the upper half off the camera is finished.

The lower casing half

  • Drill hole for the dc power connector, the cable from the siren and the temperatur/himidity sensor.
    Also drill holes for the IR-lamp holder and the cable for the IT-lamp.
    If you do not want a temperatur/himidity leave out the oblong hole.

  • Solder a cable with connectors to the DC contactand shrink tube it.
    The pin in the middle of the DC contact is often +. I also added a rubber sealing to the CD-contact.
    Also pull the siren cable through the hole and crimp connectors to the cables (Se this)

  • Hot glue the siren to the underside and seal the hole with glue.
    The temperatur/himidity sensor is to be on the outside of the case and the pins sticking in...but i will show that later...have no more sensors...
    Seal the went hole in the case with black 
    Duct tape.

  • Take the PIR and set it to minimum delay and the sensitivity to the middle.
    Unsolder the light-sensitive resistors and solder it on the opposite side of the YL-40.
    Also bend the SCL, SDA, GND, and VCC pins stright up on YL-40.
    Drill holes for the PIR in the front plate.
    Also drill hole for camera and light-sensor.

  • Cover the camera and light-sensor hole with some sort of transparent plastic, i use phone screen protector.
    and seal it with duct tape.

  • Hot glue the PIR, camera and light-sensor to the front panel.
      

  • Hot glue the back plate and the front plate to the bottom lower casing half.
    Use a lot of glue so no water can enter...
    Also hot glue the screws for the IR-lamp and a cable for power to the IR-lamp.
     
    Put duct-tape over the hole for the temperatur/himidity sensor until further notice.

The bracket

The bracket for the device is made of aluminium and bent and drilled like this.
It is 30cm long and bent every 10cm.


Wiring it up

You need 4 more cables for the light sensor and 3 more for the PIR.
  • Connect to DC cables to POWER
  • Connect IR light + to IR-lamp power and - to Power GPIO 27
  • Connect siren + to 5V and - to Power GPIO 17 (- is the red and black cable)
  • Connect the PIR sensor to GND, 5V and GPIO25.
    PIR PIN
    Raspberry
    PIN (GPIO)
     GND 6 (Ground)
     VCC 2 (5V)
     OUT 7 (GPIO25)

  • Then connect the  YL-40.
    VCC: 3.3V
    GND: GND
    SDA: SDA
    SDL:SDL
  • At last the Raspberry PI camera, see this.


Connect all parts

  • Connect a small Wifi usb adapter.
    I think it is smart to connect to wifi while the box is open.
    Connect the LAN cable and then http://<ip_to_device> (more info)
    Howto conenct to wifi with Steelsquid Kiss OS
    When the wifi is connected you can remove the LAN cable.

  • Merge the two case halves together and then screw the IR-led and bracket.
    Dont forget to connect the IR power (Minus is the side with resistors).