EliteHunting
Posts: 21
Joined: Thu Apr 17, 2014 11:52 am

Alarm System question

Thu Apr 17, 2014 12:30 pm

This may have been covered in another topic but I couldn't find anything concerning my question. Forgive any silly questions because I'm a noob and just got my Pi, but how many components can you connect to a Pi? (cameras, switches for doors/windows, etc). Two cameras would be mandatory, but how many switches for doors and windows could you use and what types of switches would they be? Reed switches? I have two doors and nine windows, is there a way to add additional GPOI pins or is this even necessary? Thanks for any direction :)

fruitoftheloom
Posts: 22067
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Alarm System question

Thu Apr 17, 2014 2:34 pm

Retired disgracefully.....
......to an uncomplicated life !

Rather than negativity think outside the box !

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Alarm System question

Thu Apr 17, 2014 3:02 pm

Hi,
EliteHunting wrote:how many components can you connect to a Pi?
A lot. ;-)
There are some limitations with cameras, but if resolution and refresh rate is not a key requirement, then you can have something like 10 surveillance cameras attached to one RasPi.
About other "components",... you don't have such a huge house. ;-)
People are worried just about number of connections, where other more important features are not within their scope. You have to be aware that with your system the main focus (and effort) should not be paid to number of inputs, but length of wiring and related issues (proper signaling selection). Otherwise, you'll have reliability issues and many false alarms.

EliteHunting wrote:Two cameras would be mandatory
Ok, RasPi native camera (camera needs to be next to RaPi) and web cam (max. 5 meters away + additional 5 meters for each USB hub added).
EliteHunting wrote:but how many switches for doors and windows could you use and what types of switches would they be?
Several thousand... at least. ;-)
EliteHunting wrote:Reed switches?
Yes, could be. But this is not key question... let me repeat again: wiring.

EliteHunting wrote:I have two doors and nine windows,
Not that important. Important is distance between them and location of RasPi. This distance will dictate proper approach.

EliteHunting wrote:is there a way to add additional GPOI pins or is this even necessary?
There are some techniques to connect several switches. One could be multiplexing (you put them in a matrix), or you could add chips to increase number of inputs. Each have pro and cons...


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
aTao
Posts: 1091
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Alarm System question

Thu Apr 17, 2014 4:07 pm

A simple alarm system will have 1 wire connecting all the switches (normally closed) in series. If a switch opens the alarm triggers.
The problem is that while the alarm is not set a would be burglar could cut the wire and you would not be able to set the alarm system. The first step to prevent this is 2 wires, one as before though all the switches and another as a continuous loop that is always monitored, even when the alarm is not set. This will sound the alarm as soon as anyone cuts the wire.
Next up is zones.
First you specify an entry zone. All other zones are set as soon as you arm the system and trigger the alarm as soon as a break is detected. The entry zone gives you some time to exit the building after the system is armed before permitting a break to trigger, also there is some delay after a break is detected before the alarm sounds, this gives you time to enter and disarm the system. Entry zones permit the arm/disarm system to be in a private location so no one can see any key code you might type.

So.. GPIO requirements....
1 input per zone
1 input anti tamper sense
4 out + 4 in for a simple keypad, or just 1 in for a keyswitch
1 out for a warning buzzer (entry zone system)
1 out for the alarm

not particularly heavy on the connections

you can also add an auto dialer to call the police, and an email/SMS system to notify the owner
>)))'><'(((<

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Alarm System question

Thu Apr 17, 2014 7:49 pm

A simple alarm system will have 1 wire connecting all the switches (normally closed) in series. If a switch opens the alarm triggers.
Simple, yes. There are better options. First off, using a pull-up at one end of the wire and the other end connected to ground will permit you to know whether the wire has been cut... It will look the same as if a sensor had been triggered.

One wire pair to each sensor (or attach them in a matrix; fewer inputs, more complex wiring and code) will permit you to determine which sensor was triggered. More expensive, more difficult to install, but much more flexible with respect to determining where the alarm was triggered.

A combination of the two can also be used, such as all windows in one room being wired in series so that if one is opened, you know the room (zone) and that it was a window sensor.
how many switches for doors and windows could you use and what types of switches would they be? Reed switches? I have two doors and nine windows, is there a way to add additional GPOI pins or is this even necessary?
The Pi has 17 GPIO pins. Model B Rev 2 has 4 more if you solder on another header. You can also use a GPIO expander allowing a very high number of theoretical GPIOs. Reed switches are one option. They're cheap and commonly used in this sort of application, but any switch that detects what you want will work. Optical switches that permit a light to reach a sensor when the door or window is opened are another option. Hall effect sensors are another form of magnetic sensor. A simple button or switch that's triggered as long as the door or window is closed and opens if it's opened works just as well, but is typically more expensive than a reed switch. These are just a few possibilities. What you use depends on your application, what you have available, and your own preferences.

EliteHunting
Posts: 21
Joined: Thu Apr 17, 2014 11:52 am

Re: Alarm System question

Wed Apr 23, 2014 10:41 am

Thank you for the information everyone. As far as length of wiring between the Pi and switches, what is a good rule of thumb?

User avatar
Ferdinand
Posts: 236
Joined: Sun Dec 01, 2013 2:24 pm
Location: Leiderdorp, NL

Re: Alarm System question

Wed Apr 23, 2014 12:14 pm

One wire will do your job.
Make a ring of doorswitches. Solder over each doorswitch a resistor. Switch1 a resistor of 1K, switch2 a 2K resistor a.s.o.
Solder the last resistor (the highest resistor) across the end points of the ring.
Make a constant current source of 1 mA, (0.5 mA is also OK). When all doors are closed (contacts are also closed) then the voltage drop over the ring is nearly 0 volts. When a door has been opened then a voltage will appear over the end points. The voltage (on the end points of the ring) depends of the resistor of that switch. Switch1 causes a voltgae of 1 V. Switch2 causes a voltage of 2 V. If switch1 and 2 are open a voltage of 3 V will appear over the end points of the ring a.s.o. Read the voltages into the rpi with a analog to digital voltage converter. If you have n switches then you have n+1 zones. Each zone can have its own setting.
You can determine a safe zone by programming the rpi. If you want to use 20 switches you have 21 zones. The number of switches is nearly unlimited. Now you can program each zone, a door open or closed is a programming issue.

advantage
When a burglar cuts a wire then the last resistor will cause a voltage over the end points of the ring and sets a alarm. That means a wire outside the house is not critical.
Ferdinand
Success with your project!
Ferdinand

EliteHunting
Posts: 21
Joined: Thu Apr 17, 2014 11:52 am

Re: Alarm System question

Wed Apr 23, 2014 1:10 pm

What is a good resource for learning more about wiring, using resistors, and determining voltage? Basically, I just got my Pi and have zero experience with most of the steps in installing a system like this, but I am very eager to learn

User avatar
Ferdinand
Posts: 236
Joined: Sun Dec 01, 2013 2:24 pm
Location: Leiderdorp, NL

Re: Alarm System question

Sat May 10, 2014 11:59 am

Hi,

--> This drawing is just an idea.

The alarm circuit (https://dl.dropboxusercontent.com/u/53885757/alarm.pdf) is based on a
voltage divider, see table below.
Each switch is a zone and each zone has his own actions such as:
alarm, delay to disarm alarm, only logging, sending email/sms, zone alarm switched off a.s.o.
You have to write a (Python) program to handle all actions and exceptions.

Don't use the power (3.3V and 5V) of de RPi. The RPi is noisy and could trigger the alarm.

The alarm breadboard or PCB must have his own set op power supplies!!
If necessary, place a filter in front of the ADC to reduce hum/noise.

3.3V
Connect A and B (see circuit diagram) directly to the ADC breakout board to keep it simple and connect SCL and SDA to the
I2C bus of the RPi.

5V
Connect A en B directly to the ADC breakout board and use a level shifter otherwise you will fry your pi.
Use this option when you want to expand the number of switches. Remember, you have to recalculate the resistors R1 ... R9



Voltage across A and B see circuit diagram, based on a power supply of 3.3V :

wires are broken or cut ~3.3 V action alarm/logging/email/or sms
wires are short-circuited ~0V action alarm/logging/email/or sms
all switches are closed ~0.55V standby no action (voltage drop across R10)

all switches are closed except SW1 ~1.1 V action delay of 30 sec to disarm alarm / led or buzzer indicator
all switches are closed except SW2 ~1.2 V action delay of 30 sec to disarm alarm / led or buzzer indicator
all switches are closed except SW3 ~1.3 V action alarm/sms/logging
all switches are closed except SW4 ~1.4 V action alarm/sms/logging
all switches are closed except SW5 ~1.5 V action alarm/sms/logging
all switches are closed except SW6 ~1.6 V action alarm/sms/logging
all switches are closed except SW7 ~1.7 V action alarm/sms/logging
all switches are closed except SW8 ~1.8 V action alarm/sms/logging
all switches are closed except SW9 ~1.9 V action alarm/sms/logging


To prevent frying yor pi --> Check, check and double check
Success with your project!
Ferdinand

EliteHunting
Posts: 21
Joined: Thu Apr 17, 2014 11:52 am

Re: Alarm System question

Sat May 10, 2014 3:16 pm

Fantastic, thank you so much for your help!! :)

Return to “Beginners”