I am experimenting with SW-420 vibration sensor modules I just got from China. The digital out pin is supposed to output HIGH when sensor detects vibration, and LOW, when at rest.

There's an onboard LED that is lit when sensor is at rest and goes out when it has detected vibration.

However, with several (sometimes many) attempts at light poking, I can provoke a state when the LED is out constantly, although there is no movement. Usually it takes a light touch to kick it out of this state and the onboard LED lits up to show that the sensor is at rest.

I am wondering if this is a typical behavior of the vibration switch and I should program the firmware accordingly, to detect and handle a situation when the sensor gives uninterrupted HIGH for unreasonable stretch of time.


2 Answers 2


Looking at some details of the SW-420 vibration switch here, it seems that the switch can be on or off (stable) without vibration and produces pulses when there is vibration.

enter image description here



Define the input by XORing the digital input with previous sample.
Then define conditions for either state or frequency of toggles or duration or count of events in each period according to what you expect as an event or noise or false alarm

Then test vs spec for any condition and revise spec until perfect. If you know stats, consider error rate , probability of error and stress environment that may accelerate errors like wearout with constant vibration, cold temp, with random jogs,

the interface: enter image description here

The test conditions for comparator logic duty cycle and possibly frequency as 104 (0.1uF cap) acts a smoothing filter that reduces as pot wiper goes to either end., So filtering will change with pot threshold as well as bias towards output duty cycle, so define your conditions well and error rate. The pot setting may or may not be critical to your app. If you ask for reliability data from http://beelee-switch.com/ the smart switch maker, and have a high volume interest, you can get it translated from someone local.

old answer

It seems you are good at finding a flaw in the design.

If you can hear anything moving inside, it could be an electro-mechanical switch metastable operating point that may have a silent position.

Are these design defects common? usually only in prototypes or early release rushed product.

What is it exactly? Who knows, it's undocumented.


I recall a design 20 years ago in Montreal our company made for someone which was a mobile digital personal alarm that could be tied to a camera on the beach or a bike nearby for theft protection alarm on motion. It used a 9V battery with a ball-bearing in large piezo diaphragm that acted as a microphone sensitive to the slightest ball bearing motion. THen it's uC reversed the flow of current with its step-up voltage coil and drove 100V into the piezo disc as a beeping alarm. It had digital options for allowing selectable false alerts 1,2, or 3 but it also had a tiny metastable stiction spot on one direction and a few other minor prototype design/assembly flaws I suggested to fix. The owner of the product suggested it was our contract manufacturing fault (C-MAC Electronics). I cleared that up fault confusion with a list of designer faults and suggested fixes.

  • \$\begingroup\$ Indeed, there is high-pitch rattling sound. Presumably, it comes from the blue cylindrical switch. From the diagram posted by Jack, one can see there's a roller inside that might be the one making the noise. \$\endgroup\$
    – Passiday
    Commented Jun 12, 2018 at 7:35
  • \$\begingroup\$ So that means the designer is wrong to assume the switch position for idle is off and made a mickey mouse comparator and sold it without a description. Don't you just love this secret science and it's cheap and it sells. ae01.alicdn.com/kf/UT8vC1zXnRbXXagOFbX6/202654950/… \$\endgroup\$ Commented Jun 12, 2018 at 13:20
  • \$\begingroup\$ Yeah tbh I find it hard to see any significant change in performance when I adjust the pot. Maybe I have received a Chinese dud, who knows. Otoh, I don't have a lab where I can set up specific vibration level and then run tests to gather stats. But it's fine for the proof-of-concept phase. \$\endgroup\$
    – Passiday
    Commented Jun 12, 2018 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.