555 ball whacker

YouTube player

This project uses a simple 555 timer chip and a feedback loop to control a servo-controlled wooden arm. Whenever an object comes close to a photosensor mounted on the end of the arm, it blocks the amount of light detected, which triggers the arm to swat the object away.

Check out more Weekend Projects.

Project Steps

Create the Stand

I designed a simple frame to hold all the parts, cut from 1/4″ birch plywood.

For this design, you can use a 4″ carriage bolt across the top, from which gold wire and thread can be tied to suspend the “ball,” in this case, a plastic egg.

Here’s a simple template that can be used to cut out your own stand. Feel free to tweak it to your liking.

Populate the Breadboard

Install the 555 timer on the breadboard, straddling the central “trench.”

Add the resistors: 1.5kΩ (Brown-Green-Red-Gold), 47kΩ (Yellow-Violet-Orange-Gold), 15kΩ (Brown-Green-Orange-Gold), 2.2kΩ (Red-Red-Red-Gold), 10kΩ (Brown-Black-Orange-Gold)

Add the 1000μF and 1μF capacitors. These are polarized and need to go in the right way around.

Add the diode. This is also polarized and needs to go in the right way around.

The schematic here shows all of the connections.

Connect the Offboard Components

Wire up the servo’s red (+5v), black (Gnd), and yellow (Control) connections from the circuit on the breadboard.

Connect the photoresistor (aka light-dependent resistor or LDR) to the circuit using wires long enough to reach up the wooden arm.

Drill a small hole in the end of the arm to hold the photodiode and insert it. Tape the wires down the arm to the breadboard.

Attach the wooden arm to the servomotor such that it leans slightly away from the ball. Mount the breadboard and servomotor onto the stand.

Connect the battery holder to the power and ground rails along the sides of the breadboard.

The connections you may not be able to see on the breadboard (second photo) are: Diode to Pin 6 of the IC, large cap between +5V and the 6th column of holes, small cap between Ground and Pin 2 of the IC.

Final Setup

I built the frame from what I had lying around. To hold the servo and breadboard, I glued down a few off-cuts of plywood.

For the arm, I used a 6″ piece of square dowel. I wrapped the photoresistor wires around it and secured them with tape.

I used jeweler’s wire to secure the arm to the servo — just loop the wire around and twist it tight.

Position a desk lamp so that it shines light towards the photosensor, from the other side of the hanging object.

Insert batteries into the battery holder and watch the fun. If the arm swings the wrong way, turn the servomotor around.

It might take some tweaking to find the “sweet” spot” where the light/sensor/ball all align to create the whacking action. But when you get it, it’s pretty funny to watch…

You can see the ball whacker in action here.


This project is a great example of a cybernetic, or "self-governing" system. These kinds of systems have been around since the steam age (check out fly-ball governors for an early example of the technology).

With this kind of analog robotic control system. remarkably human-like behaviour can be obtained without the need for complex digital programming.