1 Simple Reed Contact:
The module consists of a reed switch and a pull-up resistor. The Reed switch is a glass tube with magnetic contact tongues inside. If the glass tube is moved into an outer magnetic field, the contact tongues move towards each other and close the contact. This sensor is very well suited to detect the presence of an object inside which a magnet is located or to measure the speed when the magnet moves past the reed switch once at a revolution.
2 Reed Contact with Comparator:
The same reed contact is used here. In contrast to the simple module, a comparator LM393 is used here. Advantage exact switching and green statusled that lights up when the contact has been closed.
Application of the same as the simple Reed module. The analog output is basically useless. The digital output is set to 0V when the switch is closed.
3 Simple linear Hall sensor:
This sensor uses the so-called Hall effect. If a simple current flow-through Hall sensor is placed in a magnetic field running vertically, the output voltage is proportional to the product of magnetic flux density and current.
With the sensor of type 48E, the current flows parallel to the circuit board, which means that the magnet must be approximated from above or below.
The output voltage of the sensor is approx. 2.5 V. If one approaches a magnet in the direction shown in the image, the output voltage decreases or rises depending on whether the north or south pole of the magnet points in the direction of the hall sensor. The closer the magnet is to the reverb sensor, the stronger the change in the output voltage becomes.
In addition to the presence of a magnetic field, the linear reverb sensor can also detect the direction and strength of the magnetic field. If a magnet moves parallel to the reverb sensor, for example, by finding the maximum, the magnet can be positioned exactly opposite the reverberation sensor.
4 linear hall sensor with comparator:
This module also uses a sensor of type 48E and at the analog output A0 is largely the same signal as with the simple module. In addition, this module has a comparator LM393 which switches the digital output to LOW from a certain threshold value. There is also a green LED that lights up whenever the threshold has been exceeded. The potentiometer can be used to adjust the sensitivity. However, the comparator only works with one direction of the magnetic field. If you turn the magent over, the comparator does not switch and the digital output remains on HIGH.
5 Digital Hall Sensor:
This module uses a reverberation sensor with built-in threshold switch of type 3141. A red LED is attached to the module, which lights up whenever the output S goes to LOW. This sensor also only works in one direction of the magnetic field. The sensitivity is significantly lower than with the linear hall sensor 48E.
If the linear hall sensor switches with a certain magnet already at a distance of 50 mm, the sensor switches 3141 with the same magnet only at a distance of approx. 10 mm.
Test circuit and program:
The first test program is for sensors with digital output. For sensors 1 and 5, we connect the middle pin to +5V, the pin with GND and the S pin with D2 on the Arduino. For the modules with comparator (2 and 4), the + pin is connected to +5V, the GND pin to GND and the D0 pin to D2 on the Arduino.
We use the internal LED for display.
const byte led = 13;
we read the sensor state and
turn on the led when the sensor is on LOW
For the modules with analog output (3 and 4) we use the following circuit:
The picture shows the displacement for module 4 with comparator. For the simple linear hall sensor module 3, we connect the middle pin with the red wire, the pin with the black wire and the S pin with the yellow wire. The program reads the value from the sensor and compares it with two thresholdvalues for the North Pole and The South Pole. If one of the two threshold values is exceeded or exceeded, the two colors LED turns red or green. The value of the sensor is also output to the serial port and can be visualized with the serial plotter of the Arduino IDE.
const byte nord = 8; Advertisement North Pole
const byte sued = 9; Display South Pole
const int sw = 50; relative threshold value
Serial.begin(115200); Start serial interface
pinMode (north, OUTPUT);
pinMode (sued, OUTPUT);
int val = analogRead (input); value of the sensor without magnetic field approx. 512
digitalWrite(north, (val > (512+sw)) > 562 we show North
digitalWrite(sued, (val < (512-sw))); < 462 we show South
Serial.print(val); Output of the values via serial interface for the plotter
Display of the serial plotter. One can see the decrease or increase of the output voltage when approaching the magnet depending on the direction of the magnetic field. The red and green lines show the set threshold values.