You are a beginner with Croduino. Or electronics? A specific module caught your eye, but you do not know how to use it? Do not worry, HUM is here for you! How to Use Module (HUM) is a blog tutorials series by e-radionica where you will find all you need in order to begin working with your favorite module. Tutorials include: technical characteristics, work principle, instructions on how to connect module with Croduino and the basic code. Everything else is left to your imagination.



Vibration sensor module is a breakout module for the SW-420 vibration sensor with the LM393 comparator. Except for vibration detectors, we find it in anti-theft devices.

Model: SW-420
Voltage: 3.3V-5V
Electricity: >15mA
Dimensions: 3.8 x 1.3 x 0.7 cm
Weight: 5g


The main part of the module is a vibration sensor SW-420. These sensors usually have a little ball inside. When it moves, the “impacts” are detected on the edges and in all directions thanks to the roller shaped housing. The module itself has two signaling LEDs: the red one is a power LED, and the green one is activated while detecting vibrations or titrations. When there is no detected vibration the output module logic is LOW and vice versa.
On the module, there is also LM393 analogue voltage comparator which functions as a small voltmeter with integrated switches. It measures voltage in two different points and compares the difference. If the voltage in the first point is higher than that of the second one, the switch is on. In reverse, the switch is off. The comparison voltage is adjusted using built-in potentiometer on the module, using which we decide when the module will send LOW signal via digital output pin. This allows us to use module even without logic controllers.


Vcc – 3.3V ili 5V
gnd – gnd
D0 – digital pin 2


The principle is very uncomplicated. The module sends HIGH signal via D0 pin onto Croduino when it reads off a vibration or impulse (given the sensibility we have set on the potentiometer). To apply this we can use the code that comes with Arduino IDE  DigitalReadSerial”, and find it in:

File – Examples – Basic – DigitalReadSerial

Each 1ms, it reads the status of the digital pin 2 and prints the value (0 for LOW, 1 for HIGH)  in SerialMonitor.