After purchasing a home, I realized that I needed something a little better. I then purchased a 4 channel recorder from a maker. That device filled the need (almost). The device kept freezing every few months, without so much of a notification (point 3). It did show when someone broke into the car, but didn't provide enough clarity (point 4 in the requirements). The device primarily was for a video stream, and the search mechanism was pretty poor when looking for video files (leading to requirement 5). Though the device handled input for "GPIO's" (general input pins), there were no instructions on how to use them.
I picked up an Arduino (my first Arduino project), and thought about using it as a "sensor" for doors being opened. I realized that there were some added requirements. Those requirements culminated into the following list :
The things learned so far (e.g. the requirements of the system) :
- An external alert mechanism
- Handle more than two video streams
- Stability
- Clarity on video streams, both night and day
- Good interface
- Able to handle external notifications (e.g. a door, gate, motion, heat, or seismic sensor)
- Logs for events, from cameras to sensors
- Able to send notifications to an off-site location
- Nothing "wireless" - wireless is easily spoofed and jammed, and is easily eavesdropped on
- Expandable (e.g. connecting in to phone systems via Asterisk)
- System monitoring
The above list of requirements gave me solid ground to start working from. First, since I wanted a system that was stable, I needed a piece of hardware that would not have to worry about doing the device capturing - so I knew I needed IP cameras (or "network cameras"). Because I didn't want to run power lines for each camera, that meant these IP cameras needed to have PoE (power-over-ethernet), and I wanted an effective 40 feet range at night (to cover automobiles, fences, etc). I finally did find the cameras I wanted : TRENDnet TV-IP322P cameras. I already have lines run for the smaller cameras, so I will use those to "fish" the CAT cables through the walls.
I was able to design a cheap piece of hardware to cover point 6 in the above. That was the Interrupt-Driven Arduino Alarm. I've since expanded that project into the above requirements list, and will document the design and implementation of the system through a few different blog posts. Additionally, due to time constraints and a bug found in that interrupt-driven code for the Arduino, it is no longer interrupt-driven, but a polling mechanism. Reasons will be identified in the design post. However, the parts list so far :
- TRENDnet TV-IP322P cameras, IP-based, PoE, night vision to 20m, good resolution (1280x1024), cost : $420 each
- TRENDnet TPE-S44 8-port, 100Mbps, PoE switch [enough ports for all cameras, arduino, LAN link, and local device to handle video capture] ($50.00)
- Arduino Mega 2560 ($48.00)
- Arduino Ethernet Shield W5100 ($40.00)
Arduino Ethernet Shield PoE module Ag9120-S ($21.00 from Amazon)(I moved the Arduino, and found I didn't need to use the switch for the Arduino, so save yourself $20 and buy yourself a new movie and put the Arduino in place with a power supply).- SD card to hold the Arduino configuration ($4.00) (I ended up adding code to the Arduino that, if the SD card fails, will fall back to a coded configuration - and you can actually accomplish all of this without the SD card).
- Case for Arduino ($15-30, depending on what you want)
- Linux Server (this can range - I had one that had been decomissioned a while back)
- Ethernet cable, connectors, and jacks
We'll document the project in the following order :
- Arduino - Design and Code - should act as the interrupt-driven sensor interface with PoE so that it will report in when events happen in real-time
- Arduino Assembly and Testing - putting the active sensor together
- !!Bugs!! - found some gotchas, might help you to see these.
- Installing the Arduino and doing preliminary testing of at least two doors. This is pretty self explanatory - find a spot and a box, install the arduino to this, and run cables with the door sensors - examples of the installation can be found here).
- Configure the TrendNet TV-IP322P camera in a motion detection package. After failing with first ZoneMinder and then Linux Motion due to unacceptable frame rate recordings, I found I could use a flood light connected to the alarm server documented in Arduino Assemly and Testing, but didn't want flood lights by every camera. After testing and retesting, I found that the highest quality of uploaded video, the fastest to get set up, the easiest to tweak and reduce false positives was the camera's own motion detection and upload functionality. Incidentally, it turns out that when the arduino was down, this still provided a layer of security as I could configure the CGI events to still alert me.
- Changing from a prototyping perf board to an actual PCB for a cleaner installation. The board looked great, connections and components fit (the relays were a little snug, but not too bad). I did run into some issues with the early board (I deleted the old board and uploaded a new one to fix those problems), but things are looking up. If you need a board professionally done and an initial small count for testing, BatchPCB is the way to go. Testing the board was successful.
- Setting up a portal that includes current camera views, event logs (from sensors and camera recordings), and the ability to view live camera feeds.
- Full testing and results
Questions and comments are welcome.
Another possible project - combining a PIR sensor and an arduino with a relay to control lights - providing a new motion light with three states - off, motion, or on.
ReplyDeleteSome links :
http://www.parallax.com/tabid/768/ProductID/83/Default.aspx
http://www.glacialwanderer.com/hobbyrobotics/?p=9
Hook up another W5100 shield and you have an event sensor.
More interesting arduino links :
ReplyDeletehttp://www.instructables.com/id/The-Arduino-Weather-Station-Thermostat/
http://www.instructables.com/id/Arduino-RC-Lawnmower/
http://www.instructables.com/id/Control-a-Schlage-electronic-deadbolt-with-an-ardu/