The Garden's Camera based on Raspberry Pi (with motion detection)
This project build a high definition camera from a dummy outdoor camera.
The camera objective are to:
Take hourly full definition picture of the garden
Detect garden's intrusion from a noisy environment (tree, leaf, wind, sun, ...)
Record garden local temperature and humidity to feed the sprinkler controller (TBD)
Picammera includes the following
Capture of one full size image every hour
Python3 with C functions for fast image processing
Image capture: 100ms
Image processing: 26ms
Advanced motion detection algorithms from 5 stages:
Moving Average of previous image (with low memory usage)
Difference between moving average and current image
Moving Average Mask to automatically remove noisy pixel
Surface detection to convert adjacent pixels to surface (with very efficient algorithm)
Surface processing to detect motion
Continus HD video recording in memory
Save about 10s of video before the trigger event
send mail upon motion detection
upload movies on a FTP server
automatically convert h264 movies to mp4
Bonjour to advertise services
ASP for easy file sharing with Mac
WiringPi for GPIO access without root privilege
Automatic start at boot, and restart after a crash (restartd)
Hardware Description
Camera Body
The SecurityMan SM-3802 include an aluminum body with plenty of space inside.
The presence of multiple grove provide a way to secure the internal circuit board.
The only complain is about the arm, very difficult to have a precise horizontal rotation of the camera, very difficult to hold tight.
The Raspberry Pi and all component are placed on the Styrene Sheets, this way it is easy to insert and remove the Pi from the body. 0.08 thick styrene fit perfectly in the lower grove.
Power Supply & Network connector
The Raspberry Pi is powered throughout the ethernet cable. When an ethernet cable is used for 10 and 100Mb only 4 cable over the 8 available are used for data. The passive PoE Injector used the remaining 4 unused cables to provide the 12DC powers. In the camera, a DC converter is used to convert the 12V to the Raspberry friendly 5V.
On the Raspberry board, I want to let the maximum of space next to the USB connector for future extention. All the network/power connector are push on one side of the board, within a very limited space.
A Keystone Jack is fixed on the board, the 4 data cable (green and orange) are connected to a Cat5e male crimp connector. The Cat5e male connector was cut in half to fit in the small available space .
From the Keystone Jack, the 4 power cable (blue and brown) are connected to the input of the DC converter. The cable goes under the board where the UBEC DC converter is fixed
The 5V power cable is them connected to a micro USB connector with some Heat Shrink tubing around.
And finally the power cable is connected to the Raspberry Pi. The custom power cable permit the connection in the small space between the front face and the Raspberry Pi.
A square hole is perform in the back of the camera cover for the Keystone Jack.
Camera Sensor
A custom front plate is cut from the Styrene Sheets to maintain the sensor in place, and hide the Camera inside from curious ;-)
Note: In this configuration, the sensor is rotated by 180°.
RGB LED
A GPIO pin is limited to 16mA, for a total for all pins to 50mA. The design is for 3mA per pin (17 pins * 3mA = 51mA). We do not need the usual 20mA per LED, 6mA is probably enough for what is mainly a debug indicator. From the measure of the forward voltage for each color, we get the value for each resistor
Color
FV
ohm
Red
1.7V
270
Green
2.4V
150
Blue
2.5V
150
The position of the LED was selected to reduce the impact on the GPIO port and keep the cable on the same side of the board to not interfere with the camera sensor cable.
Extract the image by double clicking on the download file
Connect the SD card reader with the SD card inside;
From the Apple () menu, choose About This Mac, then click on More info...; if you are using Mac OS X 10.8.x Mountain Lion then click on System report.
Click on USB (or Card Reader if using an in-built SD card reader) then search for your SD card in the upper right section of the window; click it, then search for BSD name in the lower right section: must be something like diskn where n is a number (for example, disk4). Note this number
Unmount the partition so that you will be allowed to overwrite the disk by opening Disk Utility and unmounting it (do not eject it, or you have to reconnect it). Note: On Mac OS X 10.8.x Mountain Lion, "Verify Disk" (before unmounting) will display the BSD name as "/dev/disk1s1" (or similar), allowing you to skip the previous two steps.
If you get an error during Picammory execution, like:
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1470, in _get_frame
return self._encoders.values()[0].frame
TypeError: 'dict_values' object does not support indexing
you need to change the line 1470 in /usr/lib/python3/dist-packages/picamera/camera.py from
return self._encoders.values()[0].frame
to
return (self._encoders.values())[0].frame
this is fixed in development version but not yet released.