You are on page 1of 7

Digital Ink Splatter

I have no idea what I'm doing

Simple Santa-Cam Hack with
BeagleBone Black
Posted on December 24, 2013
           

1 Votes

Merry Christmas and Happy Holidays to all! I hope this post finds you in a cheerful and festive
way.

Chippy, the
Christmas Elf
on the Shelf

This past month, my son and I have been thinking about a way to get a picture of the elusive
Santa Claus!  We got the Idea from a Make! Weekend Project post. We’ve had to be extra
careful because Santa has his embedded helper (spy), Chippy,  watching our every move.
 Since Chippy has gone back to the North Pole to help Santa with his last minute preparations,
Xander and I found our opportunity get this next project done.  It is a simple frame capture
using some inexpensive items we already had, so this didn’t cost us anything.  However, if you
were starting from scratch, I estimate this project would cost between $90.00 – $120.00.

here’s a list of the items we used to pull this off: BeagleBone Black Logitech HD C525 Webcam 4-port USB Hub (as small as you can get it – I had to take the cover off mine) 8GB thumb drive (for storing images) Radio Shack Project Box 5V Power Supply Drill and various drill bits First. — Temp Mounting Solution Since we have very little time and this is a temporary installation. I put everything together and proto-typed the build.  I turns out that my double-sided tape was used by Chippy (do you think he knows something?) so I had to improvise and use a combination of medical and painters tape to secure everything to my box. I reached for the Project box.Operation Polar Bear First.  Once I verified everything was working as I had intended. — Polarcam – Camera lid I drilled one hole in the center of the lid for the camera and two holes on left-hand side of the box for power and networking (left or right makes no difference but you will want to position the BBB length-wise to make room for the USB hookup). I was not very tidy with the .

 You will thank me later.  I based my fswebcam build off a blog post HERE: apt-get install fswebcam To make this process work (time-lapse style).side hole.  NOTE:  Be tidy with the side holes and give yourself plenty of space. Next I installed fswebcam.10 on my BeagleBone Black. the USB hub.  After one last check. I sealed it up and did a test. and the thumb drive into the box.  Here’s what I did to get the system running: I am running Ubuntu 12.  I have mounted a 16GB thumb drive to it using my USB passive hub to “/media“. I then mounted the BBB. I created a configuration file and saved it in my home folder.conf“. (See my post on mounting a USB drive HERE) — USB Hub with Camera and Thumb Drive attached Once everything was working. called “polarcam. it was time to fine tune the system.  I created the folder structure under media to hold my images “/media/capture/polar-bear”.ttf title "Santa-CAM" . which I will explain: device /dev/video0 input 0 loop 2 skip 10 #background resolution 640x480 set brightness=60% set contrast=13% top-banner font /usr/share/fonts/truetype/msttcorefonts/arial.

 I haven’t played around with this but I believe you can put this at the bottom too. Timestamp:  Puts the date and time on each image as it was taken.conf .  Since I figured Santa was a busy guy and would be trying to get in and out rather quickly. and storage.  I set mine for 10 seconds but you can adjust for your particular device. you will be able to modify and adjust accordingly. Skip: this is the number of frames to skip at startup. I set this for 2 seconds. Title:  Whatever you want to call this camera.timestamp "%m-%d-%Y %H:%M:%S (%Z)" jpeg 95 save /media/capture/polar-bear/polarcam-%Y%m%d-%H:%M:%S.  Based on your needs.  A smaller image size saves space and bigger has better image quality.  It will be superimposed in the banner on every frame.  This can be modified. then the output should look something like this: dfrey@ubuntu-armhf:~/fswebcam$ sudo fswebcam -c polarcam. To test this.  In most instances.jpg palette MJPEG Device: this is your webcam. Save:  This is the path to where I want to save my images. I simply entered the following: sudo fswebcam -c <path-to-config-file>/fswebcam. Background: runs the app in quiet mode if you are using it interactively.conf If the background parameter is commented. I really didn’t mess with the other parameters but you can get the details on all the available parameters and add them to your config by using the “fswebcam –help” command. Top-banner:  This puts a banner at the top where you can put the name of the camera and a time stamp. Loop: this is the delay between frames.  Most camera have a short warm-up period where colors and brightness are not exact.  I leave this commented out until I am ready to put it into “production” Resolution:  This is the video resolution. it will be /dev/video0 unless you have other video sources plugged in. in seconds.

quality 95 Writing JPEG image to '/media/capture/polar-bear/polarcam-20131224-09:59:52. Setting timestamp "%m-%d-%Y %H:%M:%S (%Z)". (32 fps) --.. >>> Next image due: 2013-12-24 09:59:56 (EST) … and so on until you stop it (CTRL-C). --. >>> Next image due: 2013-12-24 09:59:54 (EST) --.>>> Next image due: 2013-12-24 09:59:52 (EST) --. Setting title "Santa-CAM".Processing captured image... /dev/video0 opened. Skipping 10 frames.. they looked ok. Putting banner at the top..ttf... Trying source module v4l2... Trying source module v4l2. you will see nothing and the app will run until the cows come home (translation: until you run out of storage space or turn off the BBB).Opening /dev/video0. Capturing 1 frames. Setting output format to JPEG. If the “background” parameter is uncommented..jpg'..  I noticed that there were a couple error messages regarding corrupt images but when I looked back at them. Corrupt JPEG data: 1 extraneous bytes before marker 0xd1 Captured 11 frames in 0. Setting output format to JPEG. Skipping 10 frames.  However... so I disregarded them.34 seconds..Opening /dev/video0.. Setting timestamp "%m-%d-%Y %H:%M:%S (%Z)"..ttf. /dev/video0 opened..jpg'.. you can shut it off using this command: sudo pkill fswebcam . Capturing 1 frames. (32 fps) --.34 seconds.. --. Corrupt JPEG data: 1 extraneous bytes before marker 0xd3 Captured 11 frames in 0.Capturing frame.. Setting title "Santa-CAM". Setting font to /usr/share/fonts/truetype/msttcorefonts/arial. quality 95 Writing JPEG image to '/media/capture/polar-bear/polarcam-20131224-09:59:54. Putting banner at the top.Capturing frame.. Setting font to /usr/share/fonts/truetype/msttcorefonts/arial...Processing captured image..

so it cannot use IR LEDs to illuminate dark rooms.  This will run continuously until 1:00AM.  At 11:30PM. today is the big day. we decided that we needed to limit the amount of time the camera ran so we could get as many images as possible. I have to make a decision as to how I want to start and stop the application.  Something else to note is that this camera has an IR filter on it.”  I will be upgrading this project to include and IR-ready camera and a PIR motion sensor. NASA and NORAD data). Last night. my final test was successful and I was able to capture 30 minutes of images @ 1 per 2 second intervals.conf 00 01 * * * pkill fswebcam The last two lines are where the magic happen. the fswebcam process will start.  I tried putting the start command in my . using my polarcam config file. where the process is killed.org 30 23 * * * fswebcam -c /home/dfrey/fswebcam/polarcam.ntp. Well.Automation Now that I have the app and hardware to get the job done.  We decided that between 11:30pm and 1:00AM would be fine b/c Santa has historically made his rounds in our town by 1:00AM (based on NOAA.  After talking with Xander.  After 46 years of trying to catch that Jolly Ol’ Elf in the act.  I did have some trouble with it not actually running but I think that this was because I didn’t give the BBB enough time to boot up after moving it to the target location.bashrc file and it worked but it just runs forever and that’s just not enough control for me. Here’s my script for root: sudo crontab -e -l root @reboot /opt/startup. I think I finally have a solution.  However.  Check back in a couple days to see Santa in Action! Thanks for stopping by.sh 00 */12 * * * ntpdate -b -s -u pool.  Merry Christmas and a Happy New Year to all! .  I elected to start and stop the process with a cron job (pronounced: CRAN JAB). I tested this a couple times.  I will have to insure that the room has adequate lighting for our “Polar Bear.

critter cam. . webcam by David Frey. Linux. Tell me more | Dismiss this message S HAR E TH IS :    Reblog 1       Like Be the first to like this. Maker and tagged bbb. linux.wordpress.About these ads Occasionally. beaglebone. logitech. thumb drive. santa cam. Santa Claus. Bookmark the permalink [https://dotnetdavid. ubuntu. beagleboneblack. R ELATE D Projects Update: It's been crazy In "BeagleBoneBlack" BeagleBone Black : WordPress On Ubuntu In "BeagleBoneBlack" Beaglebone Black : Cloud9 Running under Ubuntu In "BeagleBoneBlack" This entry was posted in BeagleBoneBlack. time lapse. some of your visitors may see an advertisement here.com/2013/12/24/simplesanta-cam-hack-with-beaglebone-black/] . fswebcam. Santa. beaglebone black. cron.