Page 1 of 1

ESP32 Dev Module hall Sensor issues

Posted: Thu Oct 08, 2020 6:12 pm
by Lillithet
I am having issues with the hall sensor of the ESP32.

When I do hallRead() (arduino IDE) I mostly a value around 20, occasionally (every 9ish reads on average) I get a value > 220. Is there a reason for this? Is there any way to electronically fix this? Software wise I take an average of 5 values, which would be fine if the "triggered" sensor would deliver a high enough value. Unfortunately the triggered value is about 60 or -20 (so 40 more or less depending on the magnet side) when I hold the magnet directly against the case. Is this a normal value? What are the possible reasons that this is so low?
I've also noticed when the Inputs 36 and 39 are connected to 3.3, the hall sensor drops far enough that the measured value is not noticeably at a triggered state when close to the magnet, why is this?
On a completely different note, I also had issues with inputs 39 and 36 when in INPUT_PULLUP mode, where pulling them to low would also pull the other pin as well as pin 23, why does this happen?

Any insight to these issues would be greatly appreciated.

Thanks in advance.

Re: ESP32 Dev Module hall Sensor issues

Posted: Mon Nov 09, 2020 6:30 am
by becorey
If it's always a glitch for a single reading, you could detect that and throw out the glitch reading. The real magnet should give you the measurable quantity for several readings in a row. That could be your criteria for detecting the magnet. Don't just average the previous 5 readings, but check if it is stable for ~3 readings in a row.