The AH49E is a small, versatile and linear reverb device powered by the magnetic field of a permanent magnet or an electromagnet. The output voltage is adjusted by the supply voltage and varies proportional to the strength of the magnetic field. The integrated circuit is characterized by a low output noise, which eliminates the need for external filtering. It has precision resistors for increased temperature stability and accuracy. The operating temperature range of these linear hall sensors is -40°C to +85 °C, suitable for commercial, private and industrial applications.

The sensor emits an analog voltage signal via its output, which indicates the strength of the magnetic field.

Technical data

Chipset AH49E
A low-noise output makes filtering practically superfluous
Reacts to positive and negative Gauss (Gauss is the unit in which Magnetic Force is measured.)
Measuring range -40 °C to 85 ° C
Electricity consumption 3.5mA at 5V

Pin Assignment

Code example Arduino

Connection assignment Arduino

Arduino Sensor
Pin A5 Signal
5V +V
Mass GND

The program measures the current voltage value on the sensor, calculates the current resistance value of the sensor from this and the known series resistor, and outputs the results on the serial output.

int sensorPin  =  A5 ;  //  Here the input-Pin is declared
// Serial output in 9600 baud
void setup ( )
    Serial.begin (9600);
// The program measures  the current voltage value on the sensor,
// calculates from these and the known serial resistance the current
// Resistance value of the sensor and outputs the results on the serial output
void loop ( )
        //  Current voltage value is measured...
    int  rawValue = analogRead (sensorPin);
        float  voltage  =  rawValue *   (5.0/1023)   *  1000;
        float resitance  =  10 000  *   (voltage / (5000.0 – voltage));
    //  ... and here output to the serial interface
    Serial.print("Voltage value: ") ;  Serial.print(voltage) Serial.print("mV") ;
    Serial.print (", resistance value:");  Serial.print(resitance) Serial.println("Ohm") ;
    Serial.println (“---------------------------------------”)  ;

    delay (500)  ;

Sample program download

Code example Raspberry Pi

Programming example in the programming language Python

Pin assignment Raspberry Pi

Raspberry Pi Sensor
KY-053 A0 Signal
3.3V [Pin 1 ] +V
Mass [ Pin 6 ] GND
Sensor KY-053
Signal A0
+V 3,3V [Pin 1 ]
GND Mass [ Pin 6 ]
Raspberry Pi KY-053
GPIO 3 [ Pin 5 ] SCL
Gpio 2 [Pin 3 ] SDA

Analogue sensor, therefore the following must be observed

In contrast to the Arduino, the Raspberry Pi has no analog inputs or there is no ADC (analogue digital converter) integrated in the chip of the Raspberry Pi. This limits the Raspberry Pi when you want to use sensors where no digital values are output [Voltage value exceeded -> digital ON | Voltage value below -> digital OFF | Example: button pressed [ A] Button released [OFF]], but this should be a continuous variable value (example: potentiometer -> Other position = Other voltage value)

To avoid this problem, our sensor kit X40 with the KY-053 has a module with 16 bit accurate ADC, which you can use on the Raspberry to be able to add 4 analog inputs. This is connected via I2C to the Raspberry Pi, takes over the analog measurement and passes the value digitally to the Raspberry Pi.

Therefore, we recommend to switch the KY-053 module with the said ADC in between for analog sensors of this set. Further information can be found on the [KY-053] information page ( Analog Digital Converter

The program uses the corresponding ADS1x15 and I2C Python libraries from Adafruit to control the ADS1115 ADC. These were published under the MIT license under the following link The required libraries are not included in the lower download package.

The program measures the current voltage value at the ADC with the help of the ADS1115 ADC, calculates the current resistance of the NTC, calculates the temperature in advance with the help of certain values for this sensor and outputs it to the console.

Please note that you need to enable I2C on your Raspberry Pi before using this example.

# ! /usr/bin/python
#  coding = utf-8

import time
import board
import busio
import  adafruit_ads1x15.ads1115 as  ADS
from  adafruit_ads1x15.analog_in import AnalogIn

#  Create the I2C bus
i2c  =  busio. I2C (board. SCL, board. SDA)

#  Create the  ADC object  using the  I2C  bus
ads  =  ADS.ADS1115(i2c)
voltageMax  =  3.3
#  Create single-ended input on channels
chan0  =  AnalogIn(ads, ADS.P0)
chan1 = AnalogIn(ads, ADS.P1)
chan2 =  AnalogIn(ads, ADS.P2)
chan3 = AnalogIn(ads, ADS.P3)

while True:
    resistance  =  chan0.voltage / (voltageMax – chan0.voltage)   *  10 000

    print (“Voltage value: “,'%.2f'  % chan0.voltage”,V, resistance:  ",'%.2f' % resistance,  "Ω" )

Sample program download

To start with the command:

sudo python3

Code example Micro:Bit

Connection assignment Micro : Bit:

Micro: Bit Sensor
Pin 1 Signal
3V +V
Mass GND

This is a MakeCode example for Micro: Bit which essentially does the same as the examples of the other two variants. However, this example is closer to the Raspberry Pi example than the Arduino example.

Sample program download