Introduction: Home Security - Local Sensor Alarm
On my blog (http://bbqandbanjos.blogspot.com) , I'm building a Home Security System...it's not finished yet, but this is one of the components. Note that any updates and all software are on my blogspot, not here. The software will follow to my blog in a few days.
The Home Security System consists of:
- Beaglebone Black (or Raspberry PI) for the main security controller with web server.
- NodeJS for serving the web pages for the security system.
- Sensors are WiFi networked to the main security controller using ESP8266 for each sensor (currently utilizing NodeMCU).
- Local alarm at each sensor.
I wanted each security sensor (typically a PIR, magnetic door/window sensor, moisture sensor, temperature sensor, or ultrasound sensor) to inform the main security controller of an alarm condition, and also to produce a local (to the sensor) audible alarm.
In this Instructable, I'm using an audible alarm from a Dollar Store Window/Door Magnetic Alarm, which has a built in piezo alarm. Since it's a piezo speaker, it needs a frequency and a high voltage. The Dollar Store Alarm kit provides the necessary components needed to generate the sound.
I'm using the NodeMcu to switch a transistor to enable the audible alarm. The NodeMCU was chosen because it can interface via WiFi to the main security controller.
Note that, while I'm using a NodeMCU (and the base transistor is sized for it's 3.3vdc), you can also drive this using an Arduino with it's 5vdc output if you change the value of the base transistor resistor; I haven't tested this, but a resistor value of 8.6K ohms should be about right. (The 2N3904 transistor has a beta of about 200, so 100ma output 200(beta) = .0005ma into the base. 4.3 vdc (-.7 for base emitter junction) / .0005 == 8.6K.
Step 1: This Is What I Bought for $1.00
This is the kit I bought for $1.00 at the Dollar Store.
Step 2: These Are the Parts in the Kit
These are the parts in the kit.
Step 3: Take This Screw Out
We're going to need to remove the case. I've removed the battery cover in the picture. You can do this by removing the screw my screwdriver is pointing at.
Step 4: After Back Has Been Opened
This is what it looks like with the back cover removed.
Step 5: This Circuit Board Is Newer and Has a Black Blob
The kit comes in two (2) versions; they both work the same. This is the newer version. I'm pointing at the 'black blob' that generates the square wave.
Step 6: This Circuit Board Is Older and Has Discrete Components
This is the older version; it does not contain the black blob, but has discrete components. I was not able to see which version I was buying in the store, but I can't tell that it makes any difference; they both work fine for this application.
Step 7: Unsolder Red Wire From Negative Terminal
I'm pointing at the negative terminal. We're going to insert a transistor (2N3904 NPN) between the negative terminal and the red wire that's attached to that terminal. So you need to de-solder the red wire at the terminal; only that end; leave the other end connected to the circuit board.
Step 8: Added the Green Wire
Solder a short green wire to the negative terminal we just removed the red wire from.
Step 9: Added the Yellow Wire
Now solder a yellow wire to the red wire that was removed from the terminal.
Step 10: How the Alarm Fits Into the Schematic
I've shown the alarm as it will exist with the other electronic components, in it's respective position.
Step 11: Wires Through Hole I Created
We need to take the two new wires (green and yellow) that you soldered into the circuit, to the outside of the case. Here, I've made a small hole in the plastic case using my soldering iron, and fed the two wires through it, then put the case back in place with the screw we removed previously.
Step 12: After Assembly With Battery and Switch On
This is what it looks like after we've added the batteries that came with the alarm.
Step 13: Open Wires - No Alarm
Basic Testing: Make sure the alarm switch is in the 'On' position, then leave the wires open; no alarm should sound.
Step 14: Shorting Wires Causes Alarm
Basic Test: now connect the two wires and you should hear the alarm. I'm using a jumper wire above (green), but you can just cross the yellow and green wires too.
Step 15: Schematic
This is a block diagram of the NodeMCU and Alarm, with the transistor and resistor needed for the circuit. The resistor will limit the current to about 76 - 100 ma from the 3.3 vdc high from the NodeMCU.
Step 16: Testing All Components: High Output - Alarm Condition
Using software to cause the D1 (ESP8266 pin 5) high, the alarm is sounding and the LED is illuminated.
Step 17: Testing All Components: Low Output - No Alarm Condition
The software has taken D1 (ESP8266 pin 5) low. The alarm is not sounding, and the LED is not illuminated.