In part 1 we covered the hardware setup of my Raspberry Pi based timelapse camera. Now we tackle the software.
- Configurable image capture interval.
- Images are stored on a USB flash drive for easy retrieval.
- Only takes pictures during the day. Daytime is determined by the awesome sunwait utility that calculates sunrise and sunset based on latitude and longitude.
- The image capture script can be bypassed by flipping a switch connected to GPIO so you can boot into the OS.
- A log is written to keep track of battery voltage over time.
- The script is updated from the USB flash drive on every boot so you don’t need to manually boot into the OS every time you want to tweak the interval. Simply update the script on the flash drive and on second boot, you’ll be running the new code.
The couple scripts are written in bash and are available in my github here: https://github.com/dewoodruff/picam
Continue reading picam – Raspberry Pi battery powered timelapse camera – part 2 – software
Timelapse cameras are fun. I’ve done a few timelapse videos (like this one with a really crappy webcam driven by an original Eee PC laptop) and I have some ideas for other long term videos in the future, so I wanted a higher quality, more autonomous setup. My requirements:
- Waterproof so I can strap it to a tree for a few weeks
- Long battery life, so I can strap it to a tree for a few weeks
- Infinitely configurable delay between images depending on my goal for the video
- Easy to retrieve the images from it
- Don’t take pictures over night, because I’m lazy and don’t want to manually weed out black pictures. Sleeping over night means more battery life and less storage used too.
A Raspberry Pi seemed like a perfect platform. They are low power, they have camera module support, they’re small, and they’re cheap. With some extra hardware and scripting I can also turn it off between pictures to save even more power.
Here’s how I built it. Part 1 is the hardware setup and part 2 is the software.
Continue reading picam – Raspberry Pi battery powered timelapse camera – part 1 – hardware
There are numerous python libraries out there for the 16 port MCP23017 GPIO expander chip that works with the Raspberry Pi, so why yet another one? None of the ones I could find actually implement interrupts via the chip Polling is not ideal for my home monitoring setup. I was already monitoring via interrupts and the onboard GPIO pins using the awesome RPIO module and wanted to continue using interrupts with the expansion chip. So I built my own module, leveraging Adafruit’s I2C library for the nitty gritty backend interface.
- Simple digital input and output via all pins
- Input interrupts
- Interrupt port mirroring is configurable – either INTA and INTB can trigger independently for their respective GPIO port banks, or both INTA and INTB can trigger at the same time regardless of what GPIO pin causes the interrupt
- Configurable interrupt polarity – INT could pull the pin high or push it low
- Each GPIO pin can be configured for interrupts independently to either compare against the previous value or against a default pin value
- A utility method cleanupInterrupts that can be called periodically to clear the interrupt if it somehow gets stuck on
You can find the library on my BitBucket.
Stick around after the break for a breakdown of how to use it.
Continue reading MCP23017 GPIO Expander python 3 Library – With Interrupts!
There are a variety of extremely cheep USB wifi dongles available on ebay that work wonderfully… once you get them working. I picked one up for $4 for my Raspberry Pi and had trouble getting it to work under Raspbian. Here’s what you need to do for the current Ralink USB adapters out there.
Continue reading Get the Ralink 28xx USB Dongle Running on Raspbian 7 (Raspberry Pi)