Pi NoIR and Catch Santa Challenge - Review

Table of contents

RoadTest: Pi NoIR and Catch Santa Challenge

Author: slopop27@gmail.com

Creation date:

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.

Detailed Review:

Project Code Name:   SwissArmyPiCam

 

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:

  1. Carbon Fiber Case – Rpi+PiFaceCAD Case
  2. Carbon Fiber Camera Container – Great Carbon Fiber camera enclosure to math
  3. Raspberry Pi NoIR camera board – Low light configured, fixed focus, camera board with 5MP images or original Pi Cam board
  4. RPi – ‘nough said here, this is not a new item, but I’ll mention this one, so many options!
  5. “NOOBS” 8 GB SD CARD locked and loaded, complete with branded Raspberry emblem on it.
  6. WIPI – Rpi USB adapter, with Ralink chipset
  7. PiFaceCAD – individual components discussion from PiFace at Link


Corresponding details:

  1. Initially I did have some trouble (before I learned how to search on Raspberrypi.org or element14, long ago, (over a year now), for very specific parts of configuration, assembly or general physically related info (connectivity etc).  The community is being built very well, knowledge base is well on its way to greatness!  The Carbon Fiber cases and components assemble very nicely, I have to re-comment on this as I did in an email, they are priecisely fit/cut.  Got to say tight and clean fit.  The assembly document is here:
  2. Camera case also, fits tight as a glove, pay special attention when routing the flat ribbon out the caseNoIR cam is a blast to play with using the pifacecad package.

http://piface.github.io/pifacecad/  and http://piface.github.io/pifacecad/installation.html

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.

  1. 6) WiPi – This is a Ralink Technology, Corp. RT5370 Wireless Adapter and chipset, good stuff and seems to be well supported across the platforms.
  2. 7) PiFace CAD – Control and Display indeed.  I have only scratched the surface with this.  I am way under where I wanted to be for the project, in terms of my goals and skills learned.  Python is new to me, I’ve looked around a little on it, but had intended for this to be where I stuck the flag and declared coding 101 started.  The Control & Display *easily works with python to display and interact with just about anything you could imagine with input and output.  What I mean is great possibilities and scalable.

 

Now, on to the project: the SwissArmyPiCam!  (warning, I do not intend to be long winded but, it happens!! )

            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:

  1. To be standalone if necessary (no display or mouse/kybrd or wall power required) (truly portable, I would have purchased this.  I did not purchase it but, found another project with a similar design, mostly plug-n-play design with connections.
  2. Connected over the local network using the wifi
  3. Display content directly on the Pi

OR

   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 pi@192.168.2.122:/home/pi/picam/"
rsync --progress --remove-source-files -avh --exclude "cgi-bin" /home/pi/picam/ ssh pi@192.168.2.122:/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:

  1. Use the RPi + PiFaceCad physically and set timelapse, single stills, video clip captures as well as many different effects for pictures.

 

  1. Grab any tablet, phone, computer, laptop and navigate to a browser and either control the XBMC picture directory or open the PiNoIR web server’s page and open the pictures or video 1 by 1. Depending on the urgency or need or curiosity level, any of those methods work fairly well.  It really depends how fast and what you wanted to look at.  I added a symlink from the PiFaceCam – Snap-Camera directory to the web servers document root.  Default storage location is /home/pi/snap-camera/  this made it possible to use the shootpi.html as one view and control and /img, /snap-camera (although I changed the directory name in mine to snap-cam) through a web page.  I did not secure my pages, since this was on my home network secured by WPA2, but easily could have added an .htaccess file to the directories if so chosen.

    

  1. Have the ability and freedom to take it completely standalone with the purchase of a decent LiPo battery mentioned above.  This would do some great low light timelapse. At some point this spring I’ll make that happen (with or without the battery).

 

Learned notes:

     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.

example of the garbled display:

 

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.

Sources:

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? 

http://www.pcpro.co.uk/features/386086/make-a-motion-sensing-camera-with-the-raspberry-pi
for quick article on motion detection how to

https://github.com/piface/snap-camera
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.
  http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/
rsync background and syntax, copy source to destination and remove local files

http://www.thegeekstuff.com/2011/07/cron-every-5-minutes/
cron reference to run the script every x timeperiod

http://www.raspberrypi.org/phpBB3/viewtopic.php?t=56209
tutorial used to setup the web page for buttons that are clickable

Future Projects I'm interested in working on:

  1. Chicken Cam: live feed as well as motion recording(web browser feed where possible
  2. Dog Cam: same as above
    a) Animal add on project: add motor control, timer and food dispensed with an auger gear.

        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.

Driveway Cam:

                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!!!!

Thanks Eric

Anonymous