|Product Performed to Expectations:||10|
|Specifications were sufficient to design with:||10|
|Demo Software was of good quality:||10|
|Product was easy to use:||10|
|Support materials were available:||10|
|The price to performance ratio was good:||10|
|TotalScore:||60 / 60|
Received the Pi Camera and Pi 3 from element14 and started taking a look!
Raspberry Pi is a lovely little unit with several capabilities. With a CPU, RAM, and many peripheral connections, this little beauty can be a full fledged computer. Many people are building their own small computers and terminals with these units.
I’ve done a couple basic projects with it to set up home media centers and demonstrate internet connectivity, and also tested the senseHAT’s light display and sensing functionalities in an interactive motion demo that allows children (or adults!) to rotate a 3D model of a spaceship, using readings from the senseHAT’s accelerometer and gyroscope.
This great little camera connects to any of the Pi series via ribbon cable. The Pi Camera comes on a little breakout board with holes on the 4 corners, to allow for easy mounting of the breakout into a case assembly. A nice design choice is that the ribbon cable is removable from the breakout board (not just the Pi side), allowing you to swap the ribbon cable out if you need a newer replacement or a different length. The camera module itself is also removable from the breakout board, adding further modularity and replacement options.
Everything looks great out of the box and connects fairly easily. The ribbon cable connects fairly easily, and then you lock down the connector. The stock ribbon cable is fairly long. I suggest finding a shorter cable or 3D printing a camera housing asap to protect the unit and its lens. Or try to get handy with some materials to protect the little unit
I had a Raspbian install already deployed to a micro SD card so I commenced with this existing system. Boot into the system, and run a few things to get started. Update your system (sudo apt-get update, and then sudo apt-get upgrade), and ensure that camera support is enabled (Open terminal and type sudo raspi-config to check)
sudo apt-get update sudo apt-get upgrade sudo raspi-config
There are several great guides to getting rolling quickly with the camera. You can take photos in the native Pi Terminal:
Following command will take a picture and save it as a .jpg file
Raspistill -o image.jpg
Also easy: Record a video. Note that you add flags here to specify the recording length, in ms.
raspivid -o video.h264 -t 10000
Alternatively, you can use Python and the PiCamera library for more full-featured control, and the ability to easily create python scripts to save images. Open a terminal and type “python” to begin. The beauty of this camera is the great library support available to customize your pictures. Check here for a great guide on basic picture taking: https://projects.raspberrypi.org/en/projects/getting-started-with-picamera . Gives some great steps on adding photo effects, flipping the image, changing resolution, etc. Some great example code exists, such as showing you how to take fast burst photos or time lapse photography.
Security Camera Project
I tried following Adrian Rosebrock’s guides on installing OpenCV for Raspberry Pi but I frequently run into issues. This latest attempt had errors likely because I initially followed his guides for Raspbian aspian Jessie, but I had installed Raspbian Stretch. In any case, I got frustrated enough to consider the standard install command using pre-complied binaries, and this has worked to run all subsequent scripts in my demo. This is also much faster than Adrian's guide, which can take one hour to compile.
pip install opencv-python
Open a terminal and do the following to confirm an install
Python Import cv2 Cv2.__version__
You should get a confirmation!
Using OpenCV and Adrian’s guides, you can fairly quickly build a great home security system using the Pi and its camera. I followed Adrian’s guide and changed steps along the way: https://www.pyimagesearch.com/2015/06/01/home-surveillance-and-motion-detection-with-the-raspberry-pi-python-and-opencv/
In this guide you setup a script that continuously acquires raw frames from the Pi. The latest frame is compared to prior frames to establish instances of movement in an otherwise still scene. If movement is detected, the specific areas of movement can be localized, and a bounding box is drawn around the area of the intruder. Notice in my workspace image below: The local areas of movement are isolated and highlighted.
Adrian’s script used a Dropbox API to easily upload the images to personal Dropbox servers, but I opted to upload images to Google Drive servers instead. I found a couple resources to get me rolling with the Drive API and make it more Pi friendly. The standard Google resources (https://developers.google.com/drive/v3/web/quickstart/python) help you set up your API access and public/private tokens, and this StackOverflow page gives a great overview (https://stackoverflow.com/questions/24419188/automating-pydrive-verification-process) on how to load credentials from a file, so that the system runs autonomously after the first browser auth. Some future authentications may be needed if the token expires! Note that I also used the Python library PyDrive to make Drive access more user friendly (https://pypi.python.org/pypi/PyDrive). This allows you to read, write, and upload files in a very user-friendly manner.
The system is quite fast: I see the notification on the Pi and the file appears in Drive just seconds later. Definitely responsive enough for integration into some serious security system.
Here are a couple shots from the system in action
Executing on startup in Raspbian
One issue I have been running into with Pi is trying to get this python script to automatically execute on startup, so that I can more easily run this application in a headless or auto-booting scenario.
I added a line to ~/.config/lxsession/LXDE-pi/autostart to execute a python script in the past, but had issues doing similar with my Python script this time around
lxterminal --command /home/pi/apollo-soyuz/soyuz.py
This Pi Camera is a great little unit with decent image quality and lighting performance. It’s definitely a great way to add more possibilities home hobby projects for kids, or to build a DIY security system on a budget.
Code from my project can be found below. Note that you need to configure your own Dropbox or Drive API if you want file uploading to work. Also you need to build your own version of the conf.json file to configure the python script execution.
For more context on the Pi Camera rating, I give the hardware and software high ratings because of the good price, size and easy connection of the hardware, and the great online resources for native control of the camera as well as a great Python library for image capture and image processing. Only improvement I can think of: Offer some camera housing with the product. At the minimum offer some sort of two piece enclosure or stand which the user can then fix to stationary objects.
As a python and photography geek, I have many other projects I want to try out. But with crunch time at school approaching, I figured I should submit this quick review before things get hectic!