SLYA080 july   2023 TMAG5273

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Problem with Mechanical Knobs and Rotary Encoders
  5. 2Using 3D Hall Sensor for Angle Measurement
  6. 3On-Axis and Off-Axis Test
    1. 3.1 On-Axis Test
    2. 3.2 Off-Axis Test
  7. 4Push-Button Knob Function Test
  8. 5Summary
  9. 6References

Push-Button Knob Function Test

In some application scenarios, detecting the knob angle is not the only need, sometimes users also need to add push-button functionality. Take the on-axis test as an example to demonstrate how to use the 3D Hall-effect sensor to realize the push-button function.

In on-axis test, the magnetic field strength of the z-axis is basically unchanged, so determining whether the knob is pressed or not can only be judged by detecting the change of the magnetic field of the X and Y axes. However, when the knob is rotated, the magnetic field of the X and Y axes are also changing, which can prove difficult for the user to distinguish whether the change is caused by pressing the knob or rotating the knob. However, in use scenarios, the X and Y axes change caused by rotation is still somewhat different from pressing, which can be judged by considering the following two points:

  1. Absolute magnetic field strength: When the knob is pressed and rotated, their absolute magnetic field strength is different. We can set the magnetic field threshold to judge whether to press or rotate. However, this is related to the installation of the actual magnet, and cannot be regarded as a sufficient and necessary condition.
  2. The sudden change of the magnetic field per unit time: Compared with normal rotation, when the knob is pressed, the sudden change of the magnetic field in the X and Y axes is larger.

Here we use a knob that can be pushed, as shown in Figure 4-1shows how to use a knob that can be pushed and placement of the 3D Hall sensor under the knob.

GUID-20230622-SS0I-RSWC-JKRB-GR0Q8CCHZMKD-low.png Figure 4-1 Push-Button Knob

Use the above knob to perform push button test and no push button test, and get the X and Y axes magnetic field data as shown in Figure 4-2. Users manually rotate the knob and use UART to receive data. Since the amount of data is not large, the curve is not very smooth.

GUID-20230622-SS0I-W0ZV-QVW3-LVWZZXF53KVN-low.svg Figure 4-2 Push-Button Function Data Output

From the figure, we can come to the following conclusions:

  1. No matter whether the knob is pressed or not, the trend of X and Y magnetic field changes is the same, which means that the obtained angle is also the same.
  2. When the knob is pressed, the magnetic field strength of the X and Y axes is greater than when the knob is not pressed.
  3. Press the button at any time, the sudden change of the magnetic field strength is pronounced.

The flow chart of the software implementation is showed as Figure 4-3:

GUID-20230622-SS0I-PNGB-CK2R-NDVFTHWGZNLC-low.svg Figure 4-3 Push-Button Function Software Flow Chart