Arduino projects

Mechanical sensors for Arduino

Mechanical sensors for Arduino

Mechanical sensors for Arduino

Content

  • 1 Tact button module KY-004 [5]
  • 2 Vibration sensor KY-002 [6]
  • 3 Shock sensor KY-031 [8]
  • 4 Turn sensor KY-020 [9]
  • 5 Mechanical rotation sensor
  • 6 Joystick KY-040 [16-17]

The number of sensors designed to work with the Arduino platform is truly incalculable. If desired, you can purchase almost any ready-made module from a banal button to a radiation detector. These sensors can be purchased individually or in sets of various sizes. One of these relatively cheap kits can be purchased on Ali for $10. The kit comes in a plastic bag, some of the sensors, about a third were packed in individual bags. Together with the sensors, a separate sheet with a list of equipment is included in the package .

This set includes 37 devices that allow you to register a variety of phenomena and processes, as well as a small number of the simplest information output devices [1-3]. The purchase of such a set is justified at the initial stage, when it is required to study the features of the operation of a large number of different devices. The kit can be connected to Arduino UNO or Arduino Nano boards without soldering, which is a definite plus at the first stage of work.

In the first part of this review, we will talk about mechanical sensors that respond to pressure, vibration, rotation, etc. Most of the sensors described below are connected, in fact, in the same way as a digital button. For example, in the memory of the microcontroller on the Arduino UNO board, you can write a program that, on commands from the sensor, lights up the LED connected to digital port 13, the code is taken from [4].

Tact button module KY-004 [5]

Mechanical sensors for Arduino

Mechanical sensors for Arduino

The module size is 24 x 15 mm, weight is 1.3 g. In addition to the button, a resistor with a resistance of 10 kOhm is installed on the board. A three-pin connector is used for connection, the common terminal of the connector is marked with a “-” sign, the central contact is used to supply + 5V supply voltage, the information contact is marked with “S”

Mechanical sensors for Arduino

In general, the usual digital button. The use of such a module, perhaps, is justified only in circuits where it is required to connect 1-2 buttons to the microcontroller.

Vibration sensor KY-002 [6]

Mechanical sensors for Arduino

Mechanical sensors for Arduino

The module size is 24 x 15 x 15 mm, weight is 1.2 g. Structurally, the sensor is a cylindrical metal spring along the axis, which is the conductor, which closes at sharp accelerations imparted to the device [7]. Wiring diagram, logic of operation and marking of contacts are similar to those of the tact button module KY-004

Mechanical sensors for Arduino

It should be borne in mind that this sensor reacts differently to accelerations in different directions. It perceives accelerations across the axis of the sensor well, but it reacts noticeably worse to accelerations along the axis of the sensor. The sensor is soldered to the board with the marking of the contacts, on which it coincides with that of the two previous sensors.

Shock sensor KY-031 [8]

Mechanical sensors for Arduino

Mechanical sensors for Arduino

Module size 30 x 18 mm, weight 1.6 g. The sensor is a spring contact in a rectangular plastic case. The sensor is sensitive to accelerations directed across the longitudinal axis of the sensor

Mechanical sensors for Arduino

Turn sensor KY-020 [9]

Module size 24 x 15 mm, weight 1.3 g. The sensor is a metal ball that closes contacts when the board changes its position in space by about 90 degrees.

Useful:   Improved hood lighting: LED strip and regulator

Mechanical sensors for Arduino

Mechanical sensors for Arduino

The device is connected completely identical to the KY-004 button.

Mechanical sensors for Arduino

It should be borne in mind that the sensor is completely unsuitable for detecting small turns. In general, like the two previous mechanical sensors, this design can sometimes not work very reliably.

Mechanical rotation sensor

Mechanical rotation sensor (Valkoder or encoder) KY-040 [10-15]. The valcoder is a group of mechanical contacts according to the closure sequence, which can be judged on the speed and direction of rotation of its rod. Directly below the stem is a button that can be used by pressing the stem. Unfortunately, in the copy that the author got, this button is very sticky, so there is no question of reliable operation.

Mechanical sensors for Arduino

Mechanical sensors for Arduino

Module size 30 x 18 mm, height 28 mm, weight 6.5 g. The board has two mounting holes, 3 mm in diameter, at a distance of 14 mm from each other. The module has five outputs:

  • “GND” – common,
  • “+” – power supply 5 V,
  • “SW” – button output,
  • “DT” and “CLK” – outputs of signals from the encoder.

The operation of the button is similar to that of any digital button such as KY-004 or similar. From the “DT” and “CLK” pins, when the device stem rotates, sequences of high and low logic level signals, shifted in phase by about a quarter of a period, can be read. Determining with the help of these meanders the speed and direction of rotation of the knob of the encoder, it is possible, for example, to control the brightness of the LED [14]. The main advantage of this device over a variable resistor is that the angle of rotation of the shaft encoder is not limited by anything.

Mechanical sensors for Arduino

Mechanical sensors for Arduino

Joystick KY-040 [16-17]

The joystick is a combined sensor of two variable resistors and a digital button. Structurally, the module is a printed circuit board on which the joystick module is located. The joystick handle is mechanically connected to a pair of variable resistors, 10 kOhm resistance. Deflection of the handle causes a change in the resistance of the resistors. Pressing the joystick closes the button below it. However, the reliability of the button operation leaves much to be desired, especially at large deflection angles of the joystick handle.

Mechanical sensors for Arduino

Mechanical sensors for Arduino

Module size 40 x 26 mm, height 28 mm, weight 9.8 g. The board has four mounting holes, 3 mm in diameter, located at the vertices of a rectangle with sides of 20 and 26 mm. The board has five outputs:

  1. “GND” – common,
  2. “+5V” power supply,
  3. “VRx” – outputs of a variable resistor encoding movement along the X axis,
  4. “VRy” – outputs of a variable resistor encoding movement along the Y axis,
  5. “SW” – button output.

Mechanical sensors for Arduino

Mechanical sensors for Arduino

You can write a simple program that will use the LED connected to the 13th digital port to display the pressing of the joystick button, and output information about the resistance of variable resistors to the serial port terminal.

  • 1) https://arduino-kit.ru/catalog/id/37-v-1-nabor-datchikov
  • 2) https://arduinomaster.ru/arduino-kit/nabor-arduino-sensor-kit-37-v-1/
  • 3) https://mysku.ru/blog/china-stores/37299.html
  • 4) http://robocraft.ru/blog/arduino/57.html
  • 5) https://arduino-kit.ru/catalog/id/modul-taktovoy-knopki
  • 6) https://arduino-kit.ru/catalog/id/modul-datchika-vibratsii
  • 7) https://arduino-kit.ru/userfiles/image/SW-1801_a.jpg
  • 8) https://arduino-kit.ru/catalog/id/modul-datchika-udara
  • 9) https://arduino-kit.ru/catalog/id/modul-datchika-naklona_
  • 10) https://arduino-kit.ru/catalog/id/modul-datchika-vrascheniya-_valkoder_
  • 11) https://mysku.ru/blog/aliexpress/40668.html
  • 12) https://datagor.ru/microcontrollers/281-chto-est-valkoder….html
  • 13) http://www.zi-zi.ru/docs/modules/info_KY-040.pdf
  • 14) http://cxem.net/arduino/arduino8.php
  • 15) http://mypractic.ru/urok-55-rabota-s-inkrementalnym-enkoderom-v-arduino-biblioteka-encod_er-h.html
  • 16) http://soltau.ru/index.php/arduino/item/384-kak-podklyuchit-jojstik-k-arduino
  • 17) http://www.zi-zi.ru/module/module-ky023

One Comment

  1. Hi! I know this is kind of off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding one? Thanks a lot!

Leave a Reply

Back to top button