In this instructable I'll show you how to make a simple tilt switch, this tilt switch works best with microcontrollers that can debounce the signal and overcome interferences produced by vibrations.
There are many ways to make a tilt switch, this one is a cheap and easy way to do one.
-Easy to make.
-Perfect for small projects with microcontrollers.
-Vulnerable to vibrations.
-Not really suitable for 3d motion (might activate at different angles depending on how it's placed).
-Quite exposed to the elements, might not have a very long life under rough conditions.
- Shrink tube (5mm - 3/16inches Ø).
- Bearing ball ( 3mm Ø) (or many of a smaller size).
- Male pin strip.
Bend the pins until the ball fits nicely between them, this will prevent unstable connections, don't bend them too much, just the right angle so the pins fit inside the shrink tube.
You can also use 2 pairs or pins and make a bi directional tilt switch.
Cut about 2cm (0,8 inches) of shrink tube and place the pins inside it, leave about 1mm of separation between the end of the shrink tube and the black plastic that holds the pins, then proceed to heat that part until the tube contracts and can hold the piece by itself, be careful when you heat the part near the long pins, too much heat applied near the end of the pins and the gap won't be enough for the ball to touch them, try to heat only near the base.
Add the ball, if you want more stable connections you can try to put many balls with a smaller diameter.
Close the end by heating the tube, if you want to close it completely you can heat it and melt the end pressing it with pliers.
If all has gone right you should have a functional tilt switch.