I was going to include this on the Timelapse page, but I think it better to be separated
As I said on the Timelapse page I’ve been playing with the Pi Zero W and have ended up making several small time lapse cameras for what seemed to be useful purposes at the time. But I do suspect that they may have been done to give me an excuse to play and to design and make the enclosures using Solidworks and my 3D printer!
So far I have made three very similar assemblies with slightly different applications and therefore different mounts:
- a bicycle mount (simple timelapse)
- a window mount (acts like a dash cam)
- a rotating mount using a planetary gear assembly
I also created a mount fitted to my polytunnel frame on the allotment. This setup used a small solar panel to trickle charge the USB power bank so I could leave it for days and the photos were stored on a USB stick attached to the Pi. I also built another rig for the in the tunnel that incorporated a motion sensor, infrared camera and infrared leds to try and spot any intruders of either the four legged furry kind or two legged human kind wandering about during the hours of darkness!
The most recent projects have been based on the functionality of my original rig that had the camera repeating moving a distance and then taking a photo thus adding some movement in the resulting compiled video of all the still images. Except this time the camera is the small Pi Camera and not an expensive DSLR thus providing several benefits, including much decreased size, weight and increased portability, notionally weather proof, not so obviously valuable. Powered by the same USB power bank mentioned earlier. There are two versions, linear movement and a rotational movement.
The Linear Rig
This is based around a rail and carriage slideway assembly I salvaged from a skip at work after a clearout, way, way, way over specified for this application but hey it was free!
What’s in the box?
A Pi Zero W with GPIO header fitted.
A 16Gb Micro SD card.
A 12 volt DC high torque motor 37rpm.
A Pi Camera with short flexi-tail.
An L298N motor controller.
A USB Power Bank 5000mAh.
A right angle USB adaptor.
A USB breakout adaptor.
Switches.
Various jumper wires.


the whats, why and wire.
The thing that does the work is a Python script on the Pi which triggers the camera then tells the motor to run then triggers the camera and so on. Variables within the script define the frame count of photos and the pulse time and delay between photos. The script is configured to make two complete runs backwards and forwards, although this could be increased or decreased of course. A typical set of variables would be say 450, pulse length of 0.1 seconds, and a interval delay of 5 seconds. This would result in 1800 photos taken over about 2.5 hours. As the Pi has wifi it is simple to connect to and edit the variables via Putty or VNC using a laptop or desktop pc or a tablet.
The Shutdown/Restart button almost does what it says, pressing it when the Pi is powered will shut it down safely and hopefully avoid corrupting the SD card as can happen by just unplugging or switching off the power. I found how to install this button on the internet. I did find that the restart action does not happen when used with some power banks, but then it is a simple matter of pressing the bank’s own power button or unplugging and re-plugging when the Pi is powered down.
The Script Start button does what it suggests. When pressed it runs the Python script that starts the timelapse running. The Pi can be configured to run scripts on power up but I found this button useful as it avoids having to power down and power up the Pi to get the script to run. Again found on the internet.
The two motor switches seemed like a good idea at the time and I suppose they do still have their uses. One switch controls the power on signal being sent via the Pi, three position forward/off/reverse. The other similar switch is directly connected to the Power Bank and was intended to allow the camera carriage to be positioned on the rail, this actually turned out to not be essential as the carriage can be just pushed along the rail, I wasn’t sure at the time if the motor’s gearbox mechanical advantage would allow this. I avoid having both switches in their on positions at the same time and if I do just push the carriage along the rail I try to make sure both switches are in the ‘off’ position just in case any volts are created that might fry the Pi!
Even though the motor is rated at 12 volts it runs perfectly happily at the 5 volts supplied by the Power Bank. The Motor Controller is happy driven by the power bank, but still connect the power to the 12 volt or VCC terminal and not to the terminal marked 5V. The Motor Controller is required, without it the motor is ‘slow’ to start and ‘slow’ to stop e.g., when switched off it continues to run for a second or so. The electrickery of the Controller provides ‘instant’ start and ‘instant’ stop so very short pulse times and therefore very small movement can be specified..
The Box and the Other Bits.
All of the bespoke parts including the gear and the gear racks were designed using Solidworks 2020 and printed in ABS on a Flashforge Dreamer 3D printer.