How to do Projection Mapping with the Pi Cap
Find out how to do projection mapping using the Pi Cap
Taking inspiration from your projects, we created a projection mapping tutorial using the Pi Cap. To make your project to work wirelessly over WiFi, then this is the tutorial for you. We used MadMapper as a projection mapping software, but you can use other software if you prefer.
Pi Zero W is the best Raspberry Pi to use, because it is small, compact, and offers integrated WiFi. If you don’t have a Pi Cap, you can check out the Touch Board tutorial, however, you won’t be able to use the Touch Board wirelessly.
To begin you will need:
Electric Paint 50ml
Electric Paint 10ml
laptop running MadMapper and Processing
Setting up the Pi Cap
If this is your first time using the Pi Cap, we suggest completing the tutorial on how to set-up your Pi Cap with a Raspberry Pi Zero first. In this tutorial, our Pi Zero is connected to our laptop via SSH which this allows us to have a wireless setup.
Additionally, this project requires both Processing and OSC with the Pi Cap. Follow the Pi Cap + Grapher tutorial for a good introduction to both.
Prepare the animations in MadMapper
Touch commands are going to be sent to Processing via OSC and then to MadMapper to trigger two animations. Click here to download two sample animations.
Open MadMapper and drag and drop the animations into the workspace. Make sure to change the “Loop movie” setting to “Play the movie to the end of the loop and pause” so that the animation only plays once.
If you like to, you can connect the projector to your laptop now and project the animations by going into “Full Screen Mode”.
Run the Processing code
Now you need to download the script that receives the OSC signals from the Pi Cap and sends another OSC signal to MadMapper. You can download this script here. To add our Pi Cap and MadMapper connection sketch to Processing, the picap_madmapper folder needs to be moved to the Processing Sketchbook Folder. This will be different for each operating system:
Libraries/Documents/Processing or My Documents/Processing
If this folder does not exist, you have to create it first.
On your Pi, run one of the “picap-datastream-osc” codes, including your laptop’s hostname. In Processing hit the run button. When you touch electrode 0 or 1, it should play the respective animation in MadMapper. Gotta love OSC!
Paint the triggers
Now we need to start thinking about where we want to project the animation. We used some painted cardboard, which we attached to the wall. But you can use plywood, a blank canvas or paint directly onto a wall.
Next, we need to paint the graphics to start the animation using Electric Paint. You can paint the graphics either by hand, use stencils, or screen print. In this case, we simply painted a circle and square by hand.
Connecting to the Pi Cap
The next step is connecting the graphics to the Pi Cap. The Pi Zero has an advantage compared to the Raspberry Pi because it is so small. As a result, you can attach our surface mount Pi Cap with the electrodes straight onto your project!
In the first place, turn your Pi Zero off and unplug it. If you are using a material where you can use the surface behind the graphics, for example with plywood or cardboard, then you can connect to the Pi Cap through the material. We used black nails, but you could also drill a hole and then use a screw, or some cable.
Then, to connect to the electrodes, you can use any conductive material, such as wires, copper tape or Electric Paint. We used copper tape, pierced it with black nails, and added a bit of Electric Paint to get a strong connection. Then we cold soldered the Pi Cap to the tape. To get a full overview on how you can connect to the sensors, have a look here.
Touch the paint and watch the animation
After the paint has dried, connect your Pi Zero to power and run the OSC code. Then, connect the projector to the laptop and run the Processing code. Touch the paint and watch the animation unfold!
If you look inside the code you can find the lines “mediasList = “bubble_animation.mp4″;” and “mediasList = “bubble_animation.mp4″;”. The number inside the square bracket corresponds to the electrode that is touched, so for example when touching electrode 0, MadMapper is going to play “bubble_animation.mp4”. If you want to use your own animation, you need to change the name in Processing. Therefore, if you want to include “animation1.mp4”, you need to include this filename in Processing, e.g. “mediasList = “bubble_animation.mp4″;”.
It could be that touching the Electric Paint doesn’t trigger the animation too well. Probably, this might be because the distance between the Electric Paint and the Pi Cap is too long. Consequently, you could try changing the sensitivity of the Pi Cap’s electrodes, you can learn on how to do this here.