Dave from DesignSpark
How do you feel about this article? Help us to provide better content for you.
Dave from DesignSpark
Thank you! Your feedback has been received.
Dave from DesignSpark
There was a problem submitting your feedback, please try again later.
Dave from DesignSpark
What do you think of this article?
We created a servo controlled camera running on a RasPi Zero and using ☒CHIPs to control/drive a servo.
Shoot a panning time-lapse video using the RasPi Zero, plus Pi camera, a Servo and the OC05 Servo Driver/Controller.
Parts list
Qty | Product | Part number | |
---|---|---|---|
1 | Raspberry Pi Camera V2 Camera Module, CSI-2, 3280 x 2464 Resolution | 913-2666 | |
1 | XinaBox OC05 Servo Driver Stepper Module for BU33SD5, PCA9685 for Motion Control, Positional Control | 174-3716 | |
1 | AVX BTB Series, Male PCB Edge Connector SMT, 10 Way, 2 Row, 2mm Pitch, 2.5A | 174-4977 | |
Step 1: Prepare your SD Card for Raspberry Pi Zero
- Download and unzip Raspbian Lite
- Download and install Etcher
- Use Etcher to flash Raspbian Lite to a Micro-SD card
- Open your terminal and go to the root of the SD Card
The last 3 lines set up the RasPi Zero (and only the Zero) to be able to network via the USB port. Just verify that the last line has no newline before ' modules...' in cmdline.txt!
- Eject the SD Card
- Assemble everything as per this video:
- Connect USB Cable between your RasPi Zero and your computer.
- Either use a Mac or install Bonjour to SSH to your RasPi Zero:
ssh pi@raspberrypi.local
- Password is
raspberry
- Finally setup internet sharing on your computer allowing Broadcom Ethernet to connect to your WiFi via your computer.
Step 2: Configuring the Raspberry Pi Zero
- The first 3 lines makes full use of your SD card, activates I2C for the servo controller and activates the PIcamera.
- Then I2C tools are getting installed and then PIcamera drivers.
- Then reboot to make the changes take effect.
- Login again.
- Test the connection to your servo controller, and if everything is fine you should see this:
Step 3: Install OC05 Servo Driver
This will install the Servo Driver library, once installed, test by:
Step 4: Program
- Replicate the code below in xservo.py.
- Create a frames directory
It should now start taking pictures and store them in frames.
Step 5: Extra steps
- You can have the program run automatically by
crontab -e
- And then write at the bottom of the file:
@reboot python /home/pi/xservo.py
- Once your shoot is finished, you can copy the pictures to your computer. I use
scp
- And then I use convert from ImageMagick, like this:
convert -quality 100 frames*.jpg outputfile.mpeg