RoadTest: Pi NoIR and Catch Santa Challenge
Evaluation Type: Independent Products
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: Other platforms are not as flexible as the RPi in addition to accessories available at reasonable prices. Integrated and low voltage solutions play a part and last major consideration is availability and flexibility with programming/OS/packages/package management.
What were the biggest problems encountered?: The only Major problem I encountered was that my mind was gushing with ideas, possible combinations and scenarios to configure these great and well designed components. ;) Excited to experiment and get the kids further interested and involved.
First off, I'd like to make everyone aware (for the new readers or other passerbys) that Element14 has a great community and support crew for products and knowledge. I and my oldest son have had RPi's for over a year now, and have only done some basic configuration and usage with them. The challenge was intriguing and sparked a bit of excitement to *mesh the parts together in this manner for the sole purpose of catching a round belly'd man in a red suit tromping about the property. Well, we are sad to say, we were unable to get parts and configure hardware in time to catch a glimpse of the suited man. In lieu of that task, we WILL be ready at the end of this year, with well refined and honed hardware and software (not to mention skills).
NOW, on with the show;
I need to give credit where previous projects and code are due, I'm not a person to re-print code and experience as my own (unless it really is original). I am fairly good at finding something similar and tweaking it to do what I need. At the end of this review, I plan to list all of the code or tutorial sources I used to come up with the SwissArmyCam project that I did in the end.
So let’s get started with the hardware review in the following order:
In any of the RPi + PifaceCAD enclosures,
3. Camera itself, this is a neat little package, all in one small footprint, and 5MP camera configured for low light capability. Does a fine job, plenty of control (in my opinion) config file size to tweak, colors, dimensions etc.
4. RPi, what can be said about this very nifty and flexible DEV board, that is finding new uses hourly, I would venture to say? Again, flexible creative inspiring blank canvas. Given the OS and customization choices available, skies the limit! Quite literally, did you read about the Raspberry weather balloon (Pi in the Sky)??
5. NOOBS SD card. This is the ‘meat’ of where it all starts. Literally the first impression, user experience make ‘em or break ‘em. NOOBS, starts up, into a simple text menu, and begs for a direction. The rest is up to you and what you want to do with it. Do you want a “Thin Client” system that is capable of 1080p output to surf the web, do email and learn to code? This is where you cut your teeth, so to speak. Gentle enough to get kids interested, excited and exposed to the fun, yet versatile and powerful enough to give the “big boys” room to play.
So, Originally I was going to go the route of the Ultrasonic range sensors, similar to this one. I found a few articles on the interwebs, mostly on Arduino platforms, but they seem to use a 4 wire system. I thought about using a plain motion sensor, however, that was not quite the Oooh factor I was looking for. Next level, I had intended to add or control some small dc motors with the Pi. I’ve seen some information suggesting I could toggle a relay on and off, or even control a server right from the Pi. This was similar to what I wanted to do, but not quite *it. Next, I like accessibility. What I mean by this is, depending on use and environment, I like to configure 1 device, to have the same goal, but maybe the approach and access are varied. So the end concept turned out to be a RPi configured:
4. Be able to offload the content to other devices (read viewing options)
My “SwissArmyPiCam” was born, Using the PiCam via web Browser, the PiFaceCAD to give me button and headless access, Add SSH, Rsync, motion and mplayer, shake, stir and pour to watch the collected video and pictures on the *other RPi that’s running XBMC.
Now each of the three independent projects(PiCam, PiFaceCAD and Motion) are straight forward by themselves, so no need to clutter up what they clearly and concisely have written.
Now the latter options:
The concern I had for this task was to NOT fill up the 8 GB SD card with many, many photos (which I did a couple times) during the fun testing. Remember, after OS install (which was/is Rasbian-Pi), other OS options are/were available but package management might dictate what is available or in any given set of repos. My flavor of choice is Arch, It is my desktop OS for my everyday goto work job, as well as my primary desktop at home for *Nix enjoyment. Raspbian selected here in the challenge, running a debian flavor with apt package management. Good stuff, stable, been around a while. rightfully so.
Adding the openssh, rsync and mplayer package allowed me to setup up SSH, password-less, but RSA key access to another system on my home network using an rsync ssh tunnel. This proved handy, because I worked the camera out well, taking 2500-2600 pics, then need a way to *watch or view them easily and quickly. I actually run a Mythtv system as well, so XBMC or Mythtv were logical and easy locations to drop the photos. For this specific task, I would likely only sync them to 1 of the devices not both, instead take advantage of the UPnP server that they both are configured with to simply pull the source from the other, where they are then *viewed over the network similar to a network mounted directory (not sure if it actually mounts it or just reads from the path like a stream, I’ll get back to you on that.) But for my puposes, it worked great and was relatively easy to setup.
Ssh-copy-id username@some_ip_address, after authorizing the session with a correct password, will copy the rsa identity to the remote system (run from the Pi of course), then running ssh username@some_ip_address drops you right onto the remote system without prompt for password (testing the previous function worked) details are many places, clear instructions here from Ubuntu community:
Now for the rsync: this is nothing more than a sophisticated and flexible copy/move/do stuff command. It supports push, pull, copy, retain permissions, time stamps and more type of command. In the pi user directory of the PiNoir (this device reference), I created a simple script.sh that had:
pi@EsPiNoir1 ~ $ cat rsync-trans.sh #!/bin/bash #echo "rsync --remove-source-files -avh --exclude "cgi-bin" /home/pi/picam/ ssh email@example.com:/home/pi/picam/" rsync --progress --remove-source-files -avh --exclude "cgi-bin" /home/pi/picam/ ssh firstname.lastname@example.org:/home/pi/picam/
For testing, on the command line, I had it echo which command I was testing to make sure that I remembered which one to use. Then I commented out the echo line, and turned to cron to schedule it for a given interval. I was consuming about 600MB every 5-8 hours at the configured “motion” schedule (default config file settings). After OS installation, it left me about 3.6GB free, not too shabby huh? So, I could have run the script approximately every other day, but decided that every 12 hours was good to keep the transfer times down. This rsync command allowed me to *clear out the pics on a successful transfer. Also to note here, I discovered that the rsync command actually removes the source file after each successfully transferred file (not at the end of the whole directory, (that was a new learned item one day for me). Looking at my referenced rsync command it is rsync –some_options source ssh destination. Here is additional explanation and different scenarios, here.
Overall I am happy with the end result. I am able to:
With any configuration utilizing shared or joint resources, be sure there are no access or overlapping I/O to or from the hardware. Early on, I had PiCAM running (simply running python scripts at startup), when I had added the PiFacCAD packages and python scripts. It was like something out of the Matrix, where the display sometimes refreshed, appearing to be like glitches, but then sometimes the display would correct itself depending on what you were *refreshing the screen with (number of characters). Lesson learned, some scripts want or only know what they told them. If you have a 2nd script telling the display something you get all garbled because after all, the display is an END point device not a starting or input. The buttons can influence the display, but it does not *act on it's own.
Last but not least, demonstrating the great quality of the camera, I did not catch a red suited man, but my digital dragonfly. Maybe next year!!
Here is the vid from the NoIR cam. It's good stuff!
I enjoyed this run on hardware and packages and have plans to keep going.
as promised, more links to the sources for inspiration and other good content.
http://piface.github.io/pifacecad/ and http://piface.github.io/pifacecad/installation.html
for PiFace documentation and setup (Don’t forget to stop services you do not need, otherwise they will conflict/corrupt the display characters. Ask me how I know?
for quick article on motion detection how to
Snap-camera howto/setup documentation, this is what activates and gives the LCD display command over the display in conjunction with the buttons and camera way cool and relatively simple.
rsync background and syntax, copy source to destination and remove local files
cron reference to run the script every x timeperiod
tutorial used to setup the web page for buttons that are clickable
Future Projects I'm interested in working on:
b) Motion sensor, temp sensor controlled heat lamps & temp controlled fans for the summer.
c) perhaps even a humidity sensor to control something else useful
3. sms and email alerts on all of that.
Motion sensing, email and video logging, perhaps integrate into the doorbell for alerts. (relay)? maybe integrate in the garage door opener, bluetooth enabled range sensor for open, just thinking out loud.
More to come, stay tuned!!!!