Wallace and Gromit, two of the world’s most beloved cartoon characters, started life as primitive pieces of colored putty. But like other non-digital animations, they come to life by painstakingly photographing the scene 24 times for every second of footage.

You don’t need high-end equipment to make your own movie: in this age of digital cameras or high-resolution smartphones, anyone can try. Here on .com we have covered various examples of slow motion camera apps. for many years for smartphones, and this is a great solution.

But what if you want something more permanent? If you have a Raspberry Pi with a PiCam camera module, you’re on your way to building your own stop-motion animation studio!

Get your beats together

For this project, you will need a Raspberry Pi computer and a PiCam module that is compatible with all versions of the Pi. If you don’t already have one, these are inexpensive digital camera modules with 1080p video capability that can be purchased from Amazon for as little as $30.

These are just the basics, however. If you’re planning on building a fully top-down tabletop animation rig (including the cel animation used by cartoonists), you’ll also need to assemble a podium — essentially a stand or gear to hold our PiCam freeze frame.

You may prefer to avoid this if you’re doing Wallace & Gromit-style side-by-side animation, for which you’ll just need a proper grip for Raspberry Pi and PiCam and a tripod. Plus, a smartphone dashboard mount can prove invaluable.

aya-did-rpi-stopmotion button-panel-mounting

You may also find it useful to have a Raspberry Pi case that allows you to mount the camera as shown in the picture above. You can get them pretty cheap on Amazon.

Finally, you may appreciate adding a button to take photos rather than typing a command into the Pi via SSH To do this, you’ll need a solderless breadboard, two female-to-female wires, and a bi-state button.

While you’re thinking about it, here’s a video on how to make plasticine bunnies.

Set up the PiCam module

If you haven’t set up PiCam yet, then you need to start by connecting it to your Raspberry Pi.

You will find the destination socket a short distance from the Ethernet port, although its exact location depends on which Raspberry Pi module you are using. Start by lifting up the plastic clip on the connector, then slide the PiCam flex cable into position so the metal connectors are facing away from the Ethernet cable.

With the PiCam plugged in, you can get involved in all sorts of projects, from using the Pi as a security camera to turning it into a video camera. We recently covered a number of great Raspberry Pi camera designs. what you might want to take a look at before proceeding.

Setting up your Raspberry Pi as a camera

With the PiCam connected, it’s time to connect and boot up the Raspberry Pi as usual. With the Raspbian operating system, you will be fine which can be manually installed on the SD card. or, if you prefer, holding hands using the NOOBs tool

After booting up and properly configuring (usually with sudo raspi-config) it’s time to start testing the camera. Boot into the GUI (type startx if you booted to a screen with text) and at the command prompt type:

raspistill -o image1.jpg 

A photo of what is in front of the camera will be taken, which you will find by opening File Manager and reviewing home catalog. Double click to open the image for further study — you will notice that it is upside down.

(If you want to make more images now, just change the filename in the command from image1.jpg to image2.jpg, etc.)

So Picum is working.

Introducing Stop Motion

Then it’s time to enter the Python code to start capturing your animation.

Start a new Python project and enter the following:

 import picamera from RPi import GPIO button = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(button, GPIO.IN, GPIO.PUD_UP) with picamera.PiCamera() as camera: camera.start_preview() frame = 1 while True: GPIO.wait_for_edge(button, GPIO.FALLING) camera.capture('/home/pi/animation/frame%03d.jpg' % frame) frame += 1 camera.stop_preview() 

Save it as something recognizable, like animation.py.

Create and connect your button

We can now capture images that are automatically saved to a folder in your Pi’s storage. To further automate the process, we can connect a button to the Pi’s GPIO array to bind each image in the animation sequence.

Connect the button to the solderless breadboard as shown by connecting two wires to pins 6 and 11 on the GPIO header (or GND and GPIO17).


Once connected, you will be able to press the button to take each shot on your stop motion camera. However, instead of running in Python, you need to open a new terminal window and type:

 sudo python3 animation.py 

With this launch, your stop motion project will capture the desired image with every button press. However, when you’re all done, you need to press CTRL+C to end the script.

We build our podium

Various options are available for the construction of the grandstand. You could, for example, opt for a DIY wood installation like this:

Alternatively you can use LEGO or maybe Meccano:


However, thanks to things like mobile phone holders and tripods, we don’t have to worry too much about building a traditional grandstand since technology has advanced a lot since these devices were used.

Sew it all together

For now, your stop-motion project will just be a collection of images saved in the same directory (as specified in the script).

To turn these shots into a movie, you need to use ffmpeg which you can install with

 sudo apt-get install ffmpeg 

Open a terminal window and enter the following script, taking care to change the file path accordingly if you have used something else.

 ffmpeg -y -f image2 -i /home/pi/Desktop/stop-motion/frame%03d.jpg -r 24 -vcodec libx264 -profile high -preset slow /home/pi/Desktop/stop-motion/animation.mp4 

When you’re ready, use the OMX Player to view the animation:

 omxplayer animation.mp4 

Too much code? Try it

If you prefer a less manual approach based on mouse input, then Stopmotion for Raspberry Pi is perfect. To do this, you must first install the package raspicam-extras so use the following:

 sudo apt-get install uv4l uv4l-raspicam uv4l-raspicam-extras sudo apt-get install stopmotion 


Stopmotion is a desktop application. All you have to do is make sure the camera is detected, line up your shot, and hit the capture button. We had some issues with the export feature (File > Export), but this should allow you to output stitched images as an AVI file.

Two Ways to Make a Freeze Movie with Raspberry Pi

It’s always good to have an alternative to fall back on. While we love the rawness of the manual switch solution, it must be said that the slow motion app is very easy to use. In terms of results, there are very few choices between these two options, so we’ll leave it up to you to decide which one you’ll use.

Feel free to share the results of your PiCam motion stops in the comments below!

Похожие записи