MP1: 8 Directional Tilt Switch

by Brian B.
Basic code to interface with the sensor on Github


I created an eight-directional tilt switch using mostly low tech, recycled materials. This sensor was designed with the goal of making a low tech, low budget sensor with some of the features of an accelerometer. I didn't know what a tilt switch was at the time, so this functions a bit differently from a "traditional" tilt switch. In the traditional version, tilting causes a rolling metal ball (or mercury blob) to touch two contacts on one side of the switch, completing a circuit. In this version, the ball is always connected to a positive charge via the aluminum foil it rolls on and each of the four sides is wired to a separate Arduino input. The major advantage of this setup is that the ball can touch two of the four sides at once, allowing the sensor to detect eight total directions.


The picture above shows the ball bearing resting against two of the horizontal wires running allow the sides of the cube. Beneath the ball, the bottom of the cube is covered with a piece of aluminum foil connected to the Arduino's 5v pin.


The smallest ball bearing that worked well for me was 3/8". The smaller 1/8" and 1/4" ones (which were tested in smaller cubes) failed to make a good connection. The larger 1/2" and 5/8" ones made an even better connection, but were larger and heavier than I wanted.

You can see the switch in action below.

Materials and Parts

Describe the Part's Role In Your Project
Total Cost
Arduino Leonardo
To interface with the sensor
Cheez-It box cardbord
To construct the outer casing, a 1/2" cube
3/8" ball bearing
Rolls around inside to complete 1-2 circuits at a time to sense tilt
1/2" x 1/2" square of aluminum foil
Used to line the bottom and connect to a hot wire so that current flows to the ball wherever it rolls
Wiring, resistors, breadboard, tape, & other basic materials
Used to hook everything up


Please also include an image that shows off all the parts with annotations. As an example (I would have preferred more detailed part labels for the laser and vibration sensor):




  • I first tried smaller ball bearings (1/8" and 1/4"), but they were not heavy enough to properly complete the circuit. The larger, heavier 3/8" ball bearing in the final design works well and achieves a fairly continuous connection. I also tested even larger ball bearings (1/2" and 5/8"), which worked even better at the expense of having a larger, heavier sensor.
  • I tried using aluminum foil on the sides as well as the bottom, but found that bare wires made a much better connection. So I only used foil on the bottom where it was necessary to allow the ball to roll freely.
  • In general, going from an idea that worked well on paper to functioning physical sensor required more work and frustration than I expected for such a simple device.
  • Cheez-its are kinda greasy and gross. Also, I ate too many.

Future Work Ideas

  • As mentioned above, larger, heavier ball bearing got improved performance within the context of this design. However, a more precisely molded casing using better materials would probably accommodate a smaller ball bearing without the issues I encountered.
  • The wires I used to connect to the sensor were very rigid and made physically tilting the device difficult. Using more flexible wires or short wires mounted directly to a breadboard would be an improvement.
  • I originally wanted to add another connection on the top of the cube. The idea was that you could push down on the top to make a connection and it would function like a mouse click.

Thoughts about Project

  • This project felt like it came a little too soon for me. I really didn't feel comfortable using much of the stuff in the lab and rejected most of my initial project ideas in favor of this simpler, more low tech device.
  • I learned that building your own sensor isn't worth it unless you really need something very customized for a project. In the future, I want to put my creativity towards interesting ways to use existing parts. For this project, I had more ideas for weird user interactions that I gave up on because building the switch itself took so long.
  • At first, I really didn't like how my project turned out. Being surrounded by so much technology everyday, it's easy to be underwhelmed by simple things like a tilt switch. It took me some time to appreciate it for what it was.

Links to Inspirations, Code Libraries, and Code Samples