Skip to content
If this is your first visit, please click here to learn about shipping and delivery.
If this is your first visit, please touch here to learn about shipping and delivery.
Mechanical ball tilt switches with two connection leads

Making a Tilt Switch Reliable: Mounting Direction, Settling Time and Event Tests

A tilt switch gives a simple contact state rather than a continuous angle measurement. That is often enough for a small display that changes mode when turned, a tabletop game or an experiment that distinguishes two resting orientations. The challenge is deciding when a changing contact represents a meaningful change in position.

The PMD Way tilt ball switches use a mechanical ball arrangement and are available in the tilt switch collection. Their usefulness depends on how they are mounted and interpreted. This guide uses a low-voltage orientation demonstrator, with an indicator showing the accepted state.

Choose between motion detection and resting orientation

These are different tasks. A motion detector may treat a brief contact change as interesting. An orientation indicator may deliberately ignore that same change until the object has settled.

Write the requirement before choosing a filtering method. For example: “Change the display mode after the box has remained in the second orientation for a short settling period.” That is more useful than “Trigger whenever the input changes.”

OncQue’s tilt-switch overview describes threshold devices that provide an on/off signal and identifies different angle options. A switch does not tell you every intermediate angle or necessarily distinguish every direction of rotation.

Map the actual switch on a simple fixture

Attach the switch to a small card or bracket without stressing its leads. Mark the lead direction and one reference face. With the component disconnected from powered circuitry, observe continuity while rotating the fixture slowly through the intended range.

Record which orientations give an open contact, which give a closed contact and where the result becomes intermittent. Approach the transition from both directions. Repeat the movement several times instead of treating one observed angle as a calibration certificate.

The store’s angle description helps identify the intended operation, but it does not specify a guaranteed precision threshold for every installation. C&K’s rolling-ball sensor datasheet illustrates why orientation drawings and exact model specifications matter. Its ratings and geometry belong to those C&K parts, not automatically to the PMD Way switch.

Also rotate the fixture about another axis. If the application permits the box to be rolled or inverted, verify those positions explicitly. A one-axis sketch does not describe every possible three-dimensional orientation.

Use an appropriate low-voltage input circuit

Check the selected switch’s electrical limits and its suitability for the intended signal current. The ball-switch listing does not provide a complete electrical datasheet, so do not assume it can directly switch a motor, lamp or other load.

For a suitable dry-contact switch, a common logic arrangement connects the contact between an input and ground, with a pull-up on the input. Arduino’s official InputPullupSerial example explains the resulting states: open reads HIGH and closed reads LOW.

Use the host’s permitted input voltage and verify its pull-up configuration. Keep initial wiring short and supported. Show the raw contact state on a diagnostic display or serial output before adding any application behaviour.

Keep raw state, candidate state and accepted state separate

A useful software structure maintains three values. The raw state is the latest electrical reading. The candidate state is the position currently being considered. The accepted state is the one the application uses.

  1. Read the contact.
  2. If it differs from the candidate, replace the candidate and restart its stability timer.
  3. If the candidate remains unchanged for the chosen interval, accept it.
  4. Generate an orientation-change event only if the accepted state actually changes.

Arduino’s debounce example provides the underlying stability-check idea. For an orientation interface, the selected interval may also serve as a deliberate settling requirement. It should be chosen for the user interaction, not copied as a universal sensor specification.

For instance, a hypothetical 200 ms settling interval might suit a hand-turned display. A brief 30 ms change would not alter its mode, while a sustained new state would. These numbers are starting points for an interface experiment, not guaranteed bounce characteristics of the switch.

Understand what filtering can and cannot fix

Waiting for stability can suppress short transitions. It cannot create information the switch does not provide. If two physically different orientations produce the same contact state, software cannot reliably distinguish them from that one input alone.

A long delay can also hide real movement. A tilt-to-select game may feel sluggish if the filtering is chosen for a slowly rotated display. Keep raw readings available while tuning so that you can distinguish genuine contact behaviour from a software response that is simply too slow.

Do not call the filtered state an angle measurement. If the project needs numerical inclination, consider an appropriate sensor and calibration method. Analog Devices’ inclination-sensing application note explains accelerometer-based tilt measurement and why acceleration other than gravity can disturb that interpretation.

Test the installed enclosure, not only the loose switch

Useful orientation-input tests
Action What to check
Rotate slowly through the transition Accepted state changes once after settling
Hold near the transition Unstable input does not create repeated application events
Set the box down normally A brief disturbance does not cause an unwanted mode change
Return from several directions The intended resting state is recognised consistently
Restart in either resting orientation Startup follows the documented policy

Compare the fixture test with the final enclosure. Tightening a bracket or routing a wire can change the mounting angle. Mark the correct orientation so the switch can be replaced without repeating the entire mechanical investigation.

Define startup and fault behaviour

At startup, allow the contact to establish a stable state before displaying a confident orientation. Decide whether initial acceptance should count as an event or merely initialise the display. Keeping these separate prevents an unwanted action every time the project is powered.

A disconnected wire may look like an open switch, and a short may look like a closed one. This simple circuit does not provide comprehensive fault detection. Use it for an appropriately bounded interface; a safety-critical tip-over function needs a purpose-designed and validated system.

Save the mounting sketch, transition observations and settling settings with the project. A reliable tilt input comes from matching the mechanical behaviour to the question the software is actually trying to answer.

Previous article Battery Power for Arduino Projects: Voltage Range, Runtime and Regulator Heat