Over the xmas holidays I set up a security camera for my parents. I used a Foscam FI9805E IP camera with a Raspberry Pi (model 3) as the server. An old 1Tb USB hard drive provides ample storage on the Pi. Here is the layout:
The camera supports power over ethernet but it comes with an AC adaptor so you can use a normal ethernet setup as I have done.
These are the bits that I bought:
- Raspberry Pi model 3. Mine came with free heatsinks.
- Micro-SD card for the Pi's root file system.
- 2.4amp AC to USB adaptor; powers the Pi via a micro-USB cable.
- Foscam FI9805E IP camera.
- Standard ethernet cable.
I used some Sugru to keep the main cable straight against the roller-door track:
Due to the garage being hot I mounted an old peg basket using picture frame hooks. Free flow of air is good.
Unfortunately the camera's web interface requires a browser plugin to be installed (an EXE). Microsoft provides free Windows virtual machine images which is handy.
For security reasons I have the camera on its own 192.168.1.x subnet, with the Pi running a DHCP server to give the camera a static IP. There is no route from 192.168.1.x to the outside world so I also run an ntp and ftp server on the Pi. Meanwhile, the Pi connects via wifi the normal 10.1.1.x network.
To view the camera's web interface via the Pi, I have socat passing 8088 (on 10.1.1.x) to the 192.168.1.x network. I keep these going with supervisor:
$ cat /etc/supervisor/conf.d/socatcamera.conf [program:socatcameratcp] command=socat TCP-LISTEN:8088,fork TCP:192.168.1.33:88 directory=/tmp autostart=true autorestart=true startretries=3 stderr_logfile=/var/log/socatcamera/socatcamera_tcp.err.log stdout_logfile=/var/log/socatcamera/socatcamera_tcp.out.log user=root [program:socatcameraudp] command=socat UDP-LISTEN:8088,fork UDP:192.168.1.33:88 directory=/tmp autostart=true autorestart=true startretries=3 stderr_logfile=/var/log/socatcamera/socatcamera_udp.err.log stdout_logfile=/var/log/socatcamera/socatcamera_udp.out.log user=root
(TCP is probably enough, maybe the UDP isn't needed.)
Then I can view the live video stream using vlc (the Pi is 10.1.1.220):
The camera has motion detection software and can store snapshots
to an FTP server. For this I have vsftpd on the Pi. The snapshot
files have names like
MDAlarm_20161220-195958.jpg so it's easy
to parse the year, month, day, time. A small Python script archives snapshots to
an archive directory, and another script makes a html index (by day) which is served up via nginx.
For maintenance I have ssh access to the Pi from outside, with rate limited ssh.
The Pi logs its CPU temperature to my Postgresql structured logging server and a daily email report plots the temperatures for me:
For real-time monitoring (5 minute intervals) I use a free account on UptimeRobot.
With the most aggressive settings for motion detection (smallest detection window and largest save window) we are seeing between 50 and 200Mb of snapshot images per 24 hour period.
Having a Pi on NBN fibre in Australia is convenient for running WebDL for grabbing ABC and SBS shows.