35in1 Sensor Kit - Vibration Sensors

The set contains three of these sensors

Shock Sensor:

Between the pin S and the pin GND - the sensor is switched. A 10kOhm resistor is switched as a pull-up resistor between S and the middle pin. The sensor itself consists of an elongated plastic box in which there is a spring which is equipped with a contact at the end. The contact has a small distance from the underlying contact surface. The switch is open by a push from above or below swings the spring up and down so that the contact at the end of the spring touches the contact surface. The switch is closed. Since the contact is closed several times in case of a shock, the sensor on the Arduino must be connected to an interruptable input in order to register the event safely. The sensor has a medium sensitivity.

Ball switch:

This sensor contains two metal balls that close the two contacts in case of shocks. More detailed information on how the switch is set up could not be found. The type designation is HDX 2100. The ball switch lies between the shots S and -. The S connector is also connected to the middle pin via a 10kOhm resistor. If you put +5V to the middle pin, this resistor serves all pullup resistance. Since the contact is closed for a short time in case of vibrations, the use of an interruptable input is also recommended here. The sensor responds to stronger vibrations and position changes.

Tilt switch:

The tilt switch also uses zei balls to make contact. If the tube is tilted upwards with the balls, the balls fall down and close the contact. This happens already at small angles of about 10 degrees. The sensor can be operated as a digital input, but again the use of an interrupt is useful, because at small angles the contact is not very stable. The sensor is quite sensitive and is particularly suitable for detecting inclinations. However, it is also suitable for detecting vibrations, but this requires the use of an interrupt.

Test circuit:

The circuit is very simple and identical for all three modules. - is connected to GND and the middle pin to +5V. We connect the sensor output S to the interruptable input D2. As an indication we use the internal led to pin D13.



Test program for testing vibration sensors
using interrupts
const byte display = 13;
const byte sensor = 2;
const byte dauer = 1000; Timing
global variable
byte led = LOW; current state of the display Led
void setup()
Pre-assign preparation sensor as input and interrupt
The interrupt service routine is called service and the interrupt
should extend with the falling flank
pinMode(sensor, INPUT);
Interrupt Service Routine
Called when the sensor input goes to 0
void service()
led = HIGH; led is set to HIGH
Main loop
void loop()
digitalWrite (display,led);current state is output
if state is HIGH, we leave the led switched on longer,
so that we can perceive the event
if (led == HIGH)
delay (duration);
then we reset the value



Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN