Skip to content

Hall Sensor returns random values - unaffected by presence of strong magnet #4866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
garyjamessilva opened this issue Feb 27, 2021 · 2 comments · Fixed by #5268
Closed

Hall Sensor returns random values - unaffected by presence of strong magnet #4866

garyjamessilva opened this issue Feb 27, 2021 · 2 comments · Fixed by #5268

Comments

@garyjamessilva
Copy link

Since v1.0.5 update, hallRead() return random data. (Was working ok in V1.0.4)

When a strong magnet is present near chip random data persists as though magnet has no effect on hall sensor.

Same results when trying 2 different Sparkfun ESP32 Thing Plus boards.

using Mac OSX as build device


int val = 0;
void setup() {
Serial.begin(115200);
}

void loop() {
// put your main code here, to run repeatedly:
val = hallRead();
// print the results to the serial monitor:
//Serial.print("sensor = ");
Serial.println(val);//to graph

delay(100);
}

Debug Messages:

4:51:56.272 -> -170
14:51:56.272 -> 71
14:51:56.272 -> -268
14:51:56.272 -> -263
14:51:56.272 -> -263
14:51:56.347 -> -263
14:51:56.347 -> -294
14:51:56.347 -> -295
14:51:56.347 -> -297
14:51:56.347 -> -53
14:51:56.347 -> -172
14:51:56.347 -> -170
14:51:56.347 -> -170
14:51:56.347 -> 93
14:51:56.347 -> -167
14:51:56.347 -> -167
14:51:56.347 -> -168
14:51:56.347 -> -172
14:51:56.347 -> -166
14:51:56.347 -> -167
14:51:56.347 -> -166
14:51:56.347 -> 72
14:51:56.347 -> -173
14:51:56.347 -> -171
14:51:56.347 -> -170
14:51:56.347 -> -167
14:51:56.347 -> -164
14:51:56.347 -> -168
14:51:56.347 -> -168
14:51:56.347 -> 71
14:51:56.347 -> -234
14:51:56.347 -> -238
14:51:56.347 -> -261
14:51:56.347 -> -264
14:51:56.347 -> -266
14:51:56.347 -> -266
14:51:56.347 -> -291
14:51:56.347 -> -60
14:51:56.347 -> -170
14:51:56.347 -> -170
14:51:56.347 -> -162
14:51:56.347 -> 68
14:51:56.347 -> -234
14:51:56.347 -> -145
14:51:56.347 -> -168
14:51:56.347 -> -169
14:51:56.347 -> -171
14:51:56.347 -> -169
14:51:56.347 -> -171
14:51:56.347 -> -166
14:51:56.347 -> -168
14:51:56.347 -> 93
14:51:56.347 -> -170
14:51:56.347 -> -168
14:51:56.347 -> -170
14:51:56.347 -> -169
14:51:56.347 -> -169
14:51:56.347 -> -170
14:51:56.347 -> -169
14:51:56.347 -> 71
14:51:56.347 -> -269
14:51:56.347 -> -266
14:51:56.347 -> -263
14:51:56.347 -> -263
14:51:56.347 -> -263
14:51:56.347 -> -296
14:51:56.347 -> -295
14:51:56.347 -> -48
14:51:56.347 -> -170
14:51:56.347 -> -168
14:51:56.347 -> -172
14:51:56.347 -> 67

@codemee
Copy link

codemee commented Jun 9, 2021

I got the same issue in Windows. Downgrading the ESP32 package to 1.0.4 or 1.0.3 solved the problem.

@lbernstone
Copy link
Contributor

I'll fix this in v2.0. For 1.0.x, you can use this:

#include <driver/adc.h>
void setup() {
Serial.begin(115200);
}

void loop() {
Serial.printf("idf read: %d\n", hall_sensor_read());
delay(100);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants