You can find part 1 here: Pi Alarm System - Part 1: Project and components description



Wireless Sensors


This post is focusing on the wireless sensors spread around the house in order to detect possible intrusion. In a later post, I will collect the data from these sensors with the Raspberry Pi.


RF Modules


For the communication between the remote wireless sensors and the central control unit, I used RF433MHz transmitters and a receiver.

The sensors will be equipped with a transmitter each, and the control unit with a receiver.


photo (1).JPG

RF433MHz transmitter (left) and receiver (right)


The remote sensors need to be small, so I opted for the ATtiny85 which can easily be programmed with the Arduino IDE after installing the necessary files to recognise the hardware.


I downloaded the "arduino-tiny" ATtiny cores from https://code.google.com/p/arduino-tiny/, unzipped the contents in the Arduino/hardware folder and after restarting the Arduino IDE, the ATtiny "boards" could be selected for programming:


Screen Shot 2014-02-10 at 21.08.14.png

ATtiny cores available in Arduino IDE


Prototype test


I performed a quick test by hooking up an ATtiny85 to a transmitter and an Arduino Uno to a receiver. Wrote small sketches for basic one-way communication for both Tx and Rx units.


photo.JPG

ATtiny85 transmitter (top) and Arduino Uno receiver (bottom)


The transmitter code sends an integer representing the sensor's id. The receiver code waits for data and displays it on the serial interface when available.


The goal is to have every sensor send their unique id to the receiver once they are triggered. This would be done periodically, let's say every 5 seconds.


Transmitter (ATtiny85) code:



Receiver (Arduino Uno) code:



Triggers


As mentioned in part 1, there will be two types of triggers for the remote sensors: switch or motion sensor.


Switch


The switch type of sensor can be used for doors and windows. In idle state, the switch interrupts the circuit, powering everything off.

Once the door/window is opened, the switch powers the circuit resulting in the ATtiny85 sending its sensor ID to the control unit.


photo 2.JPG

Circuit is powered when the switch is triggered



Note: the switch's functionality should be reversed (the circuit should be powered when the switch is opened).


Motion


For the second type of sensor, the motion detector should always be on. But in order to avoid having to power all components all the time, I power the ATtiny85 and RF433 transmitter using the PIR sensor's output pin. The PIR sensor's output pin goes HIGH when motion is detected. The duration of the pin's state can be changed by using one of the PIR sensor's potentiometers.


Sketch of the circuit, I hope it makes sense ... (feel free to point out any corrections and/or improvements ):


photo 1.JPG

When the PIR detects motion, the ATtiny85 and RF433 transmitter are powered



 

Conclusion


By adding antennas to receivers and transmitters, I was able to get reliable coverage in the entire house, even through big concrete walls.


Both sensor types work on breadboard and can now be turned into more compact PCBs.