M5StickC Hall Sensor not working
-
You can't read the Hall Sensor on the M5StickC.
According to the ESP32 manual the internal hall sensor on the ESP32 is connected to the analog channels on pins GPIO36 and GPIO39.
The ESP32 document note reads: "It is also possible to read the internal hall effect sensor via ADC1 by calling dedicated function hall_sensor_read(). Note that even the hall sensor is internal to ESP32, reading from it uses channels 0 and 3 of ADC1 (GPIO 36 and 39). Do not connect anything else to these pins and do not change their configuration."
The M5StickC uses pin GPIO39 as the hardware button pin B switchingthe stick on and off (always monitoring for a 6 sec press) , GPIO36 is brought out to the connector at the top of the device and there is no schematic showing it has no internal strings attached ..
-
I'm find this project, and in get date from Hall sensor, using MicroPython and M5 libs:
https://m5stack.hackster.io/Max-Lavrov/hall-sensor-and-temperature-sensor-in-esp32-934ba8 -
What is the Hall sensor actually measuring in that example? I dont see any evidence of a changing external magnetic field. Also I wonder if it's a problem that there is also a magnet in the M5StickC case.
-
It's simple, fill in the code from the example, hold the magnet to the M5stickC and you will see that the readings will change significantly! The magnet is needed strong enough, because The sensor is far away in the device.