If anyone has been waiting for the code repository for PiDoorbell, the Raspberry Pi project we presented at PyCon a couple of weeks ago, at least part of it (the parts I wrote) is also available in my GitHub scripts repo, in the rpi subdirectory. It's licensed as GPLv2-or-later.
That includes the code that drives the HC-SR04 sonar rangefinder, and the script that takes photos and handles figuring out whether you have a USB camera or a Pi Camera module.
It doesn't include the Dropbox or Twilio code. For that I'm afraid you'll have to wait for the official PiDoorbell repo. I'm not clear what the holdup is on getting the repo opened up.
The camera script, piphoto.py, has changed quite a bit in the couple of weeks since PyCon. I've been working on a similar project that doesn't use the rangefinder, and relies only on the camera to detect motion, by measuring changes between the previous photo and the current one. I'm building a wildlife camera, and the rangefinder trick doesn't work well if there's a bird feeder already occupying the target range.
Of course, using motion detection means I'll get a lot of spurious photos of shadows, tree limbs bending in the wind and so forth. It'll be an interesting challenge seeing if I can make the code smart enough to handle that. Of course, I'll write about the project in much more detail once I have it working.
It looks like the biggest issue will be finding a decent camera I can control from a Pi. The Pi Camera module looked so appealing -- and it comes in a night version, with the IR filter removed, perfect for those coyote, rabbit and deer pictures! -- but sadly, it looks like its quality is so poor that it really isn't useful for much of anything. It's great for detecting what types of animals visit you (especially at night), but, sadly, no good for taking photos you'd actually want to display.
If anyone knows of a good camera that can be driven from Linux over USB -- perhaps a normal digital camera that supports the USB camera protocol? -- please let me know! My web searches so far haven't been very illuminating.
Meanwhile, I hope someone finds the rangefinder and camera driving software useful. And stay tuned for more detailed articles about my wildlife camera project!
I'm back from Montreal, settling back in.
The PiDoorbell tutorial went well, in the end. Of course just about everything that could go wrong, did. The hard-wired ethernet connection we'd been promised didn't materialize, and there was no way to get the Raspberry Pis onto the conference wi-fi because it used browser authentication (it still baffles me why anyone still uses that! Browser authentication made sense in 2007 when lots of people only had 801.11g and couldn't do WPA; it makes absolutely zero sense now).
Anyway, lacking a sensible way to get everyone's Pis on the net, Deepa stepped as network engineer for the tutorial and hooked up the router she had brought to her laptop's wi-fi connection so the Pis could route through that.
Then we found we had too few SD cards. We didn't realize why until afterward: when we compared the attendee count to the sign-up list we'd gotten, we had quite a few more attendees than we'd planned for. We had a few extra SD cards, but not enough, so I and a couple of the other instructors/TAs had to loan out SD cards we'd brought for our own Pis. ("Now edit /etc/network/interfaces ... okay, pretend you didn't see that, that's the password for my home router, now delete that and change it to ...")
Then some of the SD cards turned out not to have been updated with the latest packages, Mac users couldn't find the drivers to run the serial cable, Windows users (or was it Macs?) had trouble setting static ethernet addresses so they could ssh to the Pi, all the problems we'd expected and a few we hadn't.
But despite all the problems, the TAs: Deepa (who was more like a co-presenter than a TA), Serpil, Lyz and Stuart, plus Rupa and I, were able to get everyone working. All the attendees got their LEDs blinking, their sonar rangefinders rangefinding, and the PiDoorbell script running. Many people brought cameras and got their Pis snapping pictures when the sensor registered someone in front of it. Time restrictions and network problems meant that most people didn't get the Dropbox and Twilio registration finished to get notifications sent to their phones, but that's okay -- we knew that was a long shot, and everybody got far enough that they can add the network notifications later if they want.
And the most important thing is that everybody looked like they were having a good time. We haven't seen the reviews (I'm not sure if PyCon shares reviews with the tutorial instructors; I hope so, but a lot of conferences don't) but I hope everybody had fun and felt like they got something out of it.
The rest of PyCon was excellent, too. I went to some great talks, got lots of ideas for new projects and packages I want to try, had fun meeting new people, and got to see a little of Montreal. And ate a lot of good food.
Now I'm back in the land of enchantment, with its crazy weather -- we've gone from snow to sun to cold breezes to HOT to threatening thunderstorm in the couple of days I've been back. Never a dull moment! I confess I'm missing those chocolate croissants for breakfast just a little bit. We still don't have internet: it's nearly 9 weeks since Comcast's first visit, and their latest prediction (which changes every time I talk to them) is a week from today.
But it's warm and sunny this morning, there's a white-crowned sparrow singing outside the window, and I've just seen our first hummingbird (a male -- I think it's a broad-tailed, but it'll take a while to be confident of IDs on all these new-to-me birds). PyCon was fun -- but it's nice to be home.