Introduction: SPLat Controlled Bluetooth IR Room Alarm System
I particularly like this project because it requires minimal electrical experience as most of it is pre-made sensors and PLCs. But lets start off with, this is NOT a professional alarm system and is NOT intended to be used as such, therefor I assume NO responsibility for any stolen property due to the reliance of this project. It is meant for novelty purposes only!!
1 IR (infrared) motion sensor available at radioshack for about $10
1 buzzer of choice (I use a fire alarm buzzer that draws 0.5A but low current piezo buzzers can also be used just leave out the relay)
1 5v or 12 relay (I used a DPDT relay soldered to a PCB that brings the terminals to terminal strips)
1 2n2222 NPN transistor
1 JY-MCU Bluetooth Wireless Serial Port Module for Arduino $6
1 LM317T regulator OR a fixed 5 volt regulator
1 5k trim potentiometer
1 240 ohm resistor
1 1k ohm resistor
1 diode (Ii use 1n4001)
1 12v 1A power supply of some sort (I used an AC wall adapter and used a round charger plug to plug it into the system)
female pin headers
solder and soldering iron
hot glue gun (or your preference of glue)
A computer running SPLat/PC, the free SPLat programming environment (IDE)
Now lets get started!
Step 1: The Schematic
Here is a schematic of the whole project.
Note that all connections on the EC1 are as if you are looking at it from the top.
Step 2: Power
lets begin with our power supply:
We will need both 5v and 12v and since I am using a 12v adapter all I need is to make a regulator to get my 5v witch powers our EC1 and our IR sensor.
If you are using a fixed regulator you can simply connect your 12v to the input and the 0v to the GND input and solder a female header to the output and the GND
If using the LM317T:
We start by placing the 240 ohm resistor across the adjust and output pins (far left and center)
Then we will connect one leg of out 5k pot to the adjust (far left) i used the wiper leg
One of our left over legs on the pot will become our negative so we can solder one header wire to it, our neg from the wall adapter and one extra wire for our buzzer.
The positive input to the regulator (far right) will be connected to our wall adapter and one extra wire for the buzzer
Finally the center pin can be connected to another pin header, this will be our 5v supply AFTER we tune it to 5v using a multi-meter and screwdriver to turn the pot.
Step 3: Connect Everything!
Believe it or not that is is the only complex connection there is! we can now connect our sensor, BT module, relay, and buzzer.
lets start with the BT module and IR sensor:
The BT module comes with a connector that you can connect to the module and the EC1 making sure that the VCC and GND connections are in the correct places (see "Connecting EC1 to a JY-MCU Bluetooth module" for detailed instructions)
Now using some female header jumpers connect the IR sensors VCC input to the 5V terminal on the EC1 and the GND terminal to the 0V on the EC1 and finally the output to pin 20 on the EC1 which is input 1.
Now for programming purposes we need a jumper from pin 28 to pin 21 (this is for the program to know what mode it is in.
Step 4: Prepare the Relay
Now in order to trigger our relay we will need a transistor between the EC1 and the relay coil
If you are using a low current buzzer or piezo buzzer you can connect the emitter of the transistor to the negative of the buzzer and connect the positive to the correct voltage (5V or 12V) Then connect the base to pin 6 and the collector to the 0V pin on the EC1.
This I did by soldering a female header to the collector and emitter, then a 1000 ohm resistor to its base and another header to the resistor. I connect the collector to the negative on the EC1 and the emitter to one pole of the relay coil.
Now I connect the base of the transistor to pin 6 (input 2) on the EC1
NOTE!!!!! my relay was on a PCB and had the diode already there! to protect your transistor you must place a catch diode on the coil of the relay! from the - to the +!!!
Step 5: Connect Everything! (cont)
Now we can connect our regulator to the EC1 so that we can connect our relay.
If using a piezo, skip this step.
Connect one pole of the coil to the 5v terminal on the EC1 (or the main 12V depending on your relay)
Now connect that extra 12V wire to the input of the relay and the + side of the buzzer to the output of the relay (normally open)
Connect that extra negative wire to the negative of your buzzer.
Now we can program our EC1 so go ahead and plug it into your PC via USB and open SPLat/PC
Step 6: The Program
The atatched program consists of the beginning of "An Easy Bluetooth and SimpleHMI example program" in order to connect to the Bluetooth module.
I have created the password program myself. It can be changed by simply changing what event holds the "T" after it.
# HMI ButtonEvent(,9,5,3,7,"1",evbuttonf)
# HMI ButtonEvent(,9,12,3,7,"2",evbuttont) <---- this is the Correct number IE- evbuttonT
# HMI ButtonEvent(,3,5,3,7,"3",evbuttonf)
# HMI ButtonEvent(,3,12,3,7,"4",evbuttonf)
# HMI ButtonEvent(,3,19,3,7,"5",evbuttonf)
This will allow a jump to the next portion or digit in the sequence. for now I will make it "2 9 3 1 8 6" this is just a random sequence of numbers I came up with.
Every time you connect to the module it will ask for this password before you can arm/disarm the program.
The password is set up were if you get a number wrong it will jump to an alternate line were it allows you to enter the remaining numbers but will not unlock therefore you will never know what number you got wrong
EX: if you enter 123456 and the correct number was 023456 it will let you enter the "23456" but will not open because you got the first digit wrong.
You can download the program from this page and load it to your EC1 Now and it will work with the password "293186"
Step 7: Pug It in and GO!
Now you are all ready! Take that glue I talked about and secure your components to a platform or enclosure and turn it on! Scare your friends, family or pets haha no one willl enter your room again! How about adding a back up battery so they cant just unplug it!
I hope you enjoy this instructible and feel free to check out my other PLC based instructables!