Newbie - needs advice

Hi

I’m hoping to replace my legacy hardwired alarm with an imp. Basically just keep the sensors - rip out the legacy PCB and keypad (replace with smartphone to arm, disarm and view status). I’d like a circuit that would sense when an existing PIR or latch sensor is tripped. I was hoping to take the multiple inputs into a device (not sure what) that would translate a closed or open circuit into 1 or 0. Then take the value to determine which rooms are occupied at any time. I currently have 8 sensors but would like to add more. Does anyone have a recommended ic or device that I could look at?

e.g. sensors active =1 inactive = 0. 3 rooms occupied= 10010100 = 148 on an analogue input. I plan to have code to determine which rooms are occupied.

As you can tell… I’m no hardware person! So any layout and BoM details would be very helpful indeed.

Thanks all for reading…

The sx1509 I2c gpio expander is really functional. You can program interrupts for all inputs(16). It is used on the Hannah development board which means there is code, schematics, and board layouts for ease of development.

I did this with an imp002… you get all 12 pins. I used one for a relay to sound a 12 volt alarm, and that leaves you with 11 for sensors. I don’t know if Smartmaker has 002’s available. I’ll have a couple of Amber boards soon, and or you could get some printed yourself… all the information is available on the wiki.

Also, if you have an iPhone, my Pitchfork app has a Security System app to do what you want. I’ll be writing up a tutorial for the project on the Adafruit Learning system soon…

http://forums.electricimp.com/discussion/1509/security-system-project#Item_1

The Imp is perfect for a security system… Callbacks, HTTPS, and a thief cant disable the agent.

You can’t legally jam a WiFi signal, but a techie thief wouldn’t care about that. So essentially they can disable the imp by jamming the WiFi within range. But as you say, the agent is still running, so there is hopefully some sort of watchdog timer that requires the imp to respond periodically. If the agent doesn’t get a reply, that means the imp is off, disabled, or broken. I’m not sure what you do in that case. You wouldn’t know if the imp just quit, or if someone jammed the WiFi. Maybe a trusted neighbor who is usually home could be notified to take a look out the window?

I have a neighbor who uses a typical security service that is common in our area. They have had police visits on several false alarms. After so many, they have to pay for the response. That’s an expensive security system.

Exactly. I can have the agent check on the imp as often as I like, and if it can’t contact it, it can notify me, and then I can decide to call the police, or If I am home, go figure out what the problem is. Local security monitoring was $40/mo in my area.

I am very happy with my setup…except when I walk out of the house in the morning and forget to disarm it…the siren is REALLY loud. Twilio seems to occasionally have some lag though, and I have a paid account.

Wow = what a very quick and helpful response. Great to see an active discussion board with deep knowledge.

Is there a schematic you would propose for the system you describe? I have an SD Imp, so was hoping to use one analogue input for all motion sensors, and keep the other pins for other sensor data collection uses (temp, light level, etc.).

The image on your blog shows the existing alarm PCB - is this purely to reuse the power supply? Do you have a logical layout of the devices in your system - that would be really helpful.

Thanks again - great to find helpful advice like this when you’re just starting out

This IS a great forum… one of the reasons I am such a big Electric Imp fan.

My system is pretty simple, I just reused the magnetic door/windows sensors. There were wall mounted sound sensors, but they seemed fairly useless, so I didn’t hook them up. I also have heat sensors in the house that I need to add to the circuit, and those should be just like the door sensors.

So for mine, there really isn’t much of a schematic. The siren is triggered by a transistor relay circuit. 5V relay, 2N2222 transistor, 1k resistor and a diode across the relay coil. Configure a pin for DIGITAL_OUT and send it HIGH to flip the relay. The door sensor pins are just configured for DIGITAL_IN_PULLUP, which means they are normally pulled up to 3.3V. Since the sensors are normally closed, just connect one end to ground and the other to pin. When the door is opened, it will pull the pin to GND.

Here is the cool part about the E.Imp. You can also configure a “callback” on the pins, so when it is triggered, (pulled high or low) you can assign it a function to execute, so you don’t need to constantly check your pins with a loop function.

For really long runs to sensors, you may get some false triggers due to capacitance on the lines, but its pretty easy to check for false positive in your code.

I left the old board in place to provide 12V power for the siren, and charge the battery, though I don’t think it is, and I need to work on that… it doesn’t need to be in there. As soon as I have one of the Amber boards complete, I’m going to redo the system, though the Adafruit screw shield does work nicely.

As far as I know, there aren’t analog callbacks yet, but I think they are coming soon, so you could potentially set up a more sophisticated sensor system, like the one described in “Practical Arduino”.

If you sensors only use a single pin or you gang them together, you should have plenty of pins on the April. I have a few door and window sensors tied together into zones, and a few by themselves.

I’ll try to get some more info put together on my system, though like I said it is pretty simple. If you didn’t see this… here is the E.Imp code I use with my Pitchfork app.

Alarm systems are commonly installed with an end-of-line resistor in series with the last device (door contact, motion sensor, etc.) in each zone. This is so the panel can differentiate between a zone being open, closed or shorted. Alarm panels are commonly configured to trigger an alarm state if the latter case occurs while armed, indicating an accidental or intentional bypassing of a zone.

Using this idea with the Imp, it would probably mean reading the zones as analog instead of digital values in order to verify the zone is loaded correctly.

Just an idea for an enhancement.

Cheers,
Ken

EDIT: I see this is touched on in the “Practical Arduino” article you mention…

Yep, that is what I was referring to…I’m pretty happy with mine as is…maybe I’ll revisit when analog callbacks are available.

…for a future “Practical Electric Imp”. :slight_smile:

Update…

Firstly thanks everyone for helping me understand the imp and its capability more. Meeting various imp’ers through this site I’ve decided to go the following route:

Imp - Pins 8&9 (I2C) -> 1-wire (Breezmo.com breakout board) -> upto 8 x Room sensors (maybe more with additional 1-wire hubs)
Imp - Pin 5 & 7 (PIO) -> latch/door sensors
Imp - Pins 1& 2 -> Not accessible on Breezbo.com board (I don’t think?)

I’ve decided to go with 1-wire because the general availability of code from Breezbo,com, provides a wide range of functionality at the room sensor (tripped PIR, on PIR tamper trip, room temp, room humidity, room light level) and additional tamper/fault can be detected if the know node does not respond. So my current alarm cable (6 core) will enable 12v for existing PIR, 1-wire and 5V to power 1-wire devices, So no need to re-run cables.

Further system development could include 1-wire based relays for controlling devices in the premise.

The next challenge is to create an expansion board for my PIR, to take the feed from the Breezbo.com board and populate with required sensors, and jump to the existing PIR with 12V, alarm and tamper circuits screw connectors.

In terms of sensors I plan to use the 1-wire dual switch device DS2413 to detect tamper and alarm switches on the PIR, DS18B20 temperature sensor, DS2438 for humidity or light (maybe 2 if both required?). They are all very small and I hope could fit inside the existing roomy PIR case for a nice clean product.

I see this as becoming quite a solid foundation for building many sensors for a property, and easy to expand. I saw through scanning sites that 1-wire hubs can be bought/built (e.g. 4CH2-R1-A at www.hobby-boards.com), so a very large network of sensors could be built - all using just 2 pins of the Imp.

Does anyone see any issues with this approach? WOuld anyone be prepared to collaborate with me in sourcing/creating the PIR/1-wire expansion board? I’m no electronics expert, and although 1-wire is popular because its so simple… I’d want to get it right!

As ever - very much looking forward to feedback, guidance, and perhaps a helpful hand ?

Thanks for reading