Language: EN


How to read the integrated Hall sensor in the ESP32

The ESP32 is equipped with an integrated Hall sensor that can be used to detect magnetic fields.

A Hall sensor is a device that takes advantage of the Hall effect, a physical phenomenon in which an electric current in a conductor is deflected when placed in a perpendicular magnetic field.

Only the ESP32 (no version) incorporates this sensor. It was removed in the ESP32-S2 models onwards, because it had issues with measurement accuracy.

In fact, it has been removed even in the official documentation as of 12/27/2022, as stated in this note PCN20221202 Remove Hall Sensor from ESP32 Series Documentation.pdf

However, if you have an ESP32 that has an integrated Hall sensor, it is still possible to use it. This can be useful for small projects, experiments, or training exercises.

Hall Sensor Configuration

The software API provided by Espressif Systems, the manufacturer of ESP32, allows easy access to the Hall sensor data.

void setup() 

void loop() 
  // read hall effect sensor value
  int val = hallRead();
  // print the results to the serial monitor