Image 1/8

Photocells were embedded in a table and covered by objects. Picking the objects up triggered audio clips describing how they might be used in the future.

Photocells as switches


This tutorial outlines how to use a photocell, which is an analog sensor, as a switch. This allows for interactivity to occur without pressing a button, but in a more subtle way, by just picking up an object. Photocells (also known as photoresistors) are cheap sensors that detect differences in light levels. This tutorial steps through a simple circuit and Arduino serial communication to allow you to trigger sound clips in Processing when a photocell’s light exposure changes.


What you'll need

Tools: ● Soldering iron and helping hands ● Solder and flux ● Breadboard ● Wirecutter and strippers
● Heat gun (or lighter in a pinch) ● Drill and bits to match diameter of photocells
● Laptop running Arduino and Processing

Parts: ● Arduino UNO ● 10K resistors ● Heat shrink ● Solid core wire to solder to shield
● Stranded wire to extend photocells ● Perfboard shield ● Screw terminals to secure photocell leads

Image 2/8

Photocells as switches


For Sea Level Stories, an installation where people were invited to experience a speculative future, transporting them to the year 2200 when sea levels have risen 25 feet and the world is a warmer place, I made a simple and cheap way to trigger audio clips when people picked up various objects.

Image 3/8

image from arduinobasics


Build the circuit

The circuit is pretty simple. Here it is laid out on a breadboard in Fritzing. Add more photocells depending on how many objects/audio clips you want to trigger. I used five. I ended up soldering the five resistors and wires to ground, signal and power, and using screw terminals to house each side of the photocell onto a perfboard shield that sat on top of the Arduino. Using screw terminals I could extend the leads on the photocells with longer wire, and ensure that the circuit would be more robust for the installation.

Image 4/8

perfboard shield with five resistors | underside of perfboard shield | soldered shield setup without photocells

1. cont.

Build the circuit

There are perfboard products that recreate some of the connections you get for free in a breadboard. I didn’t have that, so had to make a lot of the connections myself.

Image 5/8


Extend the leads on the photocells

(if embedding into a table or other object). Use a solder iron to solder the stranded wire to the photocells, securing the bonds with the heat shrink.

Image 6/8


Install photocell audio triggers in object tables

Decide where you would like to place the other objects on the side tables and drill holes under the places where the objects will rest on the table surfaces. Use a drill bit that is slightly larger than the diameter of the photocell. Insert photo cells into the drilled holes, securing them in place with duct tape, The photocell surface should be flush with the edge of the wood, so they are exposed to light when it's uncovered.

Image 7/8

(Caption: Swapping out photocells with others that have been soldered with long lengths of flexible wire in order to be embedded within a table)


Connect photocell audio triggers to the circuit board

Fasten the ends of the stranded wire into their berths under the screw terminals.

Image 8/8


Upload the code

Upload the follow Arduino code to your Arduino. This just reads the sensor values and sends them over serial to a Processing program. The Processing code reads in the array of sensor values, and checks to see if any are above the threshold value. If they are above, then the sound file plays, if they are below it stops playing. Adjust the array size of audio files to match the number of audio files and photocells you’re using (it’s currently 5). Rename the audio files to match ones you’re using. Remove audio files from the array if you have fewer than five, or add more to the array if you have more. Adjust the threshold values based on the values you’re receiving from the Photocell, which you can see in Arduino’s serial monitor, so that audio files only play when the photocell is uncovered. Start playing with the light levels in the Processing code needed to trigger the audio start playing when you move the objects away from their corresponding photocells.

Photocells as switches
Genevive Hoffman Vol 1