Evolution of a Blog

This blog has evolved as I have as a maker. It starts at the beginning of my journey where I began to re-tread my tires in the useful lore of micro electronics and the open-source software that can drive them. While building solutions around micro-electronics are still an occasional topic my more recent focus has been on the 3D Printing side of making.

Sunday, April 7, 2013

RPi as a Remote Control for a Canon DSLR - Part 3

I am at an impasse with trying the get the DSLR to capture the motion being detected by the RPi.   Namely because there is a two second delay between the time the motion is detected by my Python script and when it actually occurred!   I have installed 'motion' on the RPi and it also suffers from the same delay.   Hmmm.  What to do?

I guess I will see what the delay is when using PiggyPhoto to grab preview images.  If that looks to be working then I will go back to pondering stability of the DSLR interface across libgphoto2.

Friday, April 5, 2013

CritterCam Version 1 in Action

Having solved the power problem (got a new battery in the mail) I have been able to get the CritterCam into action.   Here are some images from a test run.   First the web preview page.   This is a tiny little PHP app that runs on the RPi along side the Python script that does the captures.   It is kind of funny to think about the RPi running a SQL server and PHP behind Apache.   I am not using mySQL but I could!   In any case...


The large image at the top is the last image saved due to motion being detected.  The four images at the bottom are the last four images captured with the difference calculated between each image shown at the bottom.   The threshold specifies the point at which this difference between images triggers a capture.

I do have the DSLR triggering working with one major issue...there is a two second delay between when the Python script sees the motion and when the motion actually occurred.  No clue as to why yet.   Even without the DSLR the little 720p webcam does a decent job at the image capture.






Yes, that bench is in dire need of painting.   If it were not so bloody cold it would get pressure washed and painted!

Thursday, April 4, 2013

RPi as a CritterCam - Ultimately Remoting a DSLR

I have made some progress on a CritterCam based on one of my RPi's.   Here are a couple pictures of the device:

  • The base is a four battery holder for 3.7v 1850 Lithium Ion flashlight batteries with an output of 14.8v.
  • At the top is an adjustable power regulator that drops the 14.8v to 5v and delivers it via a 5.2mm power plug.
  • The power regulator is sitting on a powered USB hub that provides power to the RPi and also supports a Wi-Fi dongle (and a keyboard during debugging).  The hub is a cheap one but compatible with the RPi and is smaller than the more expensive ones I find on Amazon.
  • As mentioned above the Hub supports a USB Wi-FI dongle.   The one shown in the picture is an Edimax (larger of the two that I have).  I also have the small one but have been having some issues with dropped packets that I will discuss elsewhere.
  • In front of the USB Hub is the a 720p WebCam that is compatible with the RPi...but in my case only if plugged directly into the RPi.
  • Inside the Adafruit case is, of course, the Raspberry Pi that drives the CritterCam and it's web interface.
My goal is to use some Python code to detect motion in front of the webcam and trigger a shot by the DSLR which will be connected to the CritterCam.   The CritterCam will also support a web server running a little PHP application that will provide a preview of what the CritterCam sees.   I will talk about all of this a little later.

Right now I have a couple of issues.  First is one of power, on a couple of fronts, one being that I am using four Lithium Ion batteries to power the CritterCam and one of them has turned itself off!  I guess this is a good feature but I only have four right now but am waiting for an order from China for some more.  The other power related issue is that while I had a good test run with the Lithium Ion batteries driving the RPi for almost three hours...since then I can't get the power regulator to reliable support the RPi when connected to wall power of a variety of voltages.   The power does not seem sufficient to drive both the Hub and the RPi.   I am baffled as it worked so well with the batteries but can not retest with batteries again as I am missing one!

The other issue relates to driving the DSLR.   I have the Python code working well with the webcam on its own.   It detects motion and saves the current image.   Alas, when I try to trigger a DSLR capture at that point using the code I discuss here, it fails.   More work to do here but first I want to get the power issue sorted.

Monday, March 25, 2013

RPi as a Remote Control for a Canon DSLR - Part 2

As with many others, I have had problems with gphoto2 running on the RPi due to USB issues.   It works for a single capture, if that, and then dies.   There is a lot of discussion out there about solutions with the idea of resetting the USB Bus high among them.   Others may have had success with this but I can not seem to get it to work.   I downloaded the code from this thread in the RPi forum, got it compiled, but on execution, could not get it to work as discussed!

I have, however, come up with another idea courtesy of angryelectron.  Their observation was that the problem occurs from opening and closing the camera as gphoto2 does for every transaction.   If you do a bunch of stuff between the open and the close you don't have a failure (until you do another open/close).  

The above suits me fine as I was not planning on using gphoto2 command line but was really looking to use libgphoto2 from Python via a wrapper developed by alexdu / piggyphoto.

My initial experiments are positive though I am still encountering failures though not until a significant number of previews and captures have been done.   I am going to continue to head down this direction.

Sunday, March 24, 2013

Handy, Cheap, Small Keyboard/Pointer

I bought this keyboard last week to save some space on my desk and have a mouse and keyboard with only one USB slot...all while not spending much money.   The reviews on Amazon were mixed but I bought it anyway and am quite pleased.   It is certainly not going to become a primary keyboard but it meets my requirements.   It worked with no fuss and no muss on both wheezy and arch.

Friday, March 22, 2013

Handy Directory of Arch Linux Utilities

The Arch Linux Wiki is the end all place for documentation on Arch...though Arch for the RPi is not necessarily what is documented there!   In any case this page of that wiki is particularly useful for finding a utility (like atool for archiving).

Thursday, March 21, 2013

Raspberry Pi Inventory

Somehow I have ended up with no less than four Raspberry Pi's.   I started with the one that I wanted to build the 'Bot around.   Then I decided that I needed one for development that I could mess with and not have to dismantle the 'Bot.   Since then I used one to save me having to drill a hole in the wall of our new house to run another TV antenna lead.

Then I fried the one that I had designated as my development platform (unfortunately it was one that does not appear to have a polyfuse on the USB circuit.  The CPU is ok as the device boots, displaying status to the monitor, but never makes a network connection nor can it talk to a keyboard :-(.

So I, obviously, had to buy a fourth RPi to serve as my development platform.  It arrived non functional so I ordered another one and in the meantime returned the non-functional unit for a refund.   Got a replacement instead and just decided to keep it.  Sad but true, I now have five of the little things working and one fried.  Cheap for the entertainment value provided!

Inventory

RPi Current Use
1. Model B 256mb Fried.
2. Model B 512mb 'Bot - was running Wheezy now being ported to Arch
3. Model B 512mb TvHeadend - Serving TV to media clients (office and tablet).   Also host for ntop - running Wheezy
4. Model B 512mb Development - Miscellaneous uses
5. Model B 512mb Development - Currently being built as a CritterCam - running Wheezy.