Skip to main content

Servo Controlled Time-Lapse Camera | Raspberry Pi | DesignSpark

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

Screen_Shot_2018-08-01_at_09.56_.47__81bf3526bae7fb1bd3a29a5d07fc3a7d4deb549d.png

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.

screen_shot_2017-10-19_at_09_21_35_RSyARWk12E_35aa4379c277f10f3285e29e8c8bbe8e498050cc.jpg

Step 2: Configuring the Raspberry Pi Zero

Screen_Shot_2018-08-01_at_10.18_.56__402b88cb8fa259a99b693ed6bd7769806f9ebcd8.png

  • 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:

Screen_Shot_2018-08-01_at_10.21_.04__96723c79598234e7ac5172b169af1f0ed4d170e5.png

Step 3: Install OC05 Servo Driver

Screen_Shot_2018-08-01_at_10.21_.04_2__551b7a5e465c83f16caeae9eb584c38d1802b95c.png

This will install the Servo Driver library, once installed, test by:

Screen_Shot_2018-08-01_at_10.21_.04_2_2__3ac279e4591df10d0d03f29f25d18eacb6f639dd.png

Step 4: Program

  • Replicate the code below in xservo.py.
  • Create a frames directory

Screen_Shot_2018-08-01_at_10.25_.09__ee530af601aa1e4a0266d1c3cc69035af9896754.png

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

 

Downloads

Aspiring space scientist and engineer. Intern at XinaBox. Crazy about making electronics simple.
DesignSpark Electrical Logolinkedin