Practical usage of the built-in hall sensor
Practical usage of the built-in hall sensor
The ESP32 hat a built-in hall sensor. That pretty much all that we seem to know.
Where is that hall sensor placed, where its sensitivity optimal?
In which direction?
Is it possible to use it to evaluate a DC current?
Who knows more?
Where is that hall sensor placed, where its sensitivity optimal?
In which direction?
Is it possible to use it to evaluate a DC current?
Who knows more?
Re: Practical usage of the built-in hall sensor
It can sense a magnet and would make a good wifi door open detector, but It's the wrong choice for current measurements.
There's an Arduino example showing how to use it.
Try it with a magnet and you will see where it is sensitive and how much.
There's an Arduino example showing how to use it.
Try it with a magnet and you will see where it is sensitive and how much.
Re: Practical usage of the built-in hall sensor
To my experience it is completely unusable.woofy! wrote: Try it with a magnet and you will see where it is sensitive and how much.
It requires two analog inputs A0 and A3 to have initial config.
With the standard gain -11dB and a pseudo 12 bit, the analog inputs are so noisy and non-linear that it really hurts.
With gain of 0dB and 10 bit ADC, you begin to get something halfway usable, albeit with an offset.
But then you can't use the built-in hall sensor at all.
Re: Practical usage of the built-in hall sensor
Hi @rin67630,
I'm currently using ADC1_CH0 and ADC3_CH3 for measuring other analog voltage.
Do you know if the Hall sensor is still usable in this condition? I.e. Does the external voltage applied to VP/VN sensor pins affect the measurement of Hall sensor?
Or is it internally "switched"?
Thanks
I'm currently using ADC1_CH0 and ADC3_CH3 for measuring other analog voltage.
Do you know if the Hall sensor is still usable in this condition? I.e. Does the external voltage applied to VP/VN sensor pins affect the measurement of Hall sensor?
Or is it internally "switched"?
Thanks
Re: Practical usage of the built-in hall sensor
No it isn't usable at all, specially if you switch the input ranges.davdav wrote:Hi @rin67630,
I'm currently using ADC1_CH0 and ADC3_CH3 for measuring other analog voltage.
Do you know if the Hall sensor is still usable in this condition?
Thanks
Re: Practical usage of the built-in hall sensor
OK thank you.
Re: Practical usage of the built-in hall sensor
I just tested the default program for reading the Hall sensor (see https://github.com/espressif/arduino-es ... Sensor.ino) ... I agree, very noisy. But if you average over, let's say, 1000 measurements then the readings are very stable and reliable. So setting the measuring intervall to 100 microseconds per single mesurement( which is enough for one cycle) you end up with a frequency of 10 averaged values per second. By the way, the values represent the magnetic field strength perpendicular to the ESP-board directly at the "upper right corner" of the ESP-mount near GPIO pin22 (with earth magnetic field bias). Below you will find my suggestion for the modified programming example. Try and check it out with the Serial Plotter in the Arduino IDE.
// Hall sensor test
int i;
long h;
void setup()
{
Serial.begin(115200);
}
void loop()
{
h=0;
for(i=0;i<1000;i++)
{
h += hallRead();
delayMicroseconds(100);
}
Serial.print("Hall sensor value: ");
Serial.println((double)h/1000.);
}
// Hall sensor test
int i;
long h;
void setup()
{
Serial.begin(115200);
}
void loop()
{
h=0;
for(i=0;i<1000;i++)
{
h += hallRead();
delayMicroseconds(100);
}
Serial.print("Hall sensor value: ");
Serial.println((double)h/1000.);
}
Re: Practical usage of the built-in hall sensor
Hello again,
I was still wondering where the hall sensor is located and so I was looking for a simple way to find it out. So here is my solution and how you can verify this by yourself:
1) Straigthen out a paperclip to form a straight metal rod.
2) Magnetize the rod by pulling it along a strong magnet. Since now the magentic field is emerging directly from the tips (in parallel direction to the rod) you now have a very defined probing tool.
3) Position one tip of the rod perpendicular to the surface of the ESP32-cover at the upper position of the spacing between the C and the E of the CE sign (see picture attached).
4) Move the tip at that position perpendicularly on and off (result see second picture)
5) When changing to the tip at the other side the signal change will be opposite.
Have fun
By the way, leaving out the 100µs delay in the previous program gives 20 relatively stable readings per second.
I was still wondering where the hall sensor is located and so I was looking for a simple way to find it out. So here is my solution and how you can verify this by yourself:
1) Straigthen out a paperclip to form a straight metal rod.
2) Magnetize the rod by pulling it along a strong magnet. Since now the magentic field is emerging directly from the tips (in parallel direction to the rod) you now have a very defined probing tool.
3) Position one tip of the rod perpendicular to the surface of the ESP32-cover at the upper position of the spacing between the C and the E of the CE sign (see picture attached).
4) Move the tip at that position perpendicularly on and off (result see second picture)
5) When changing to the tip at the other side the signal change will be opposite.
Have fun
By the way, leaving out the 100µs delay in the previous program gives 20 relatively stable readings per second.
- Attachments
-
- ESP32_hall_position.jpg (13.58 KiB) Viewed 42015 times
-
- hall_sensor_test.jpg (20.09 KiB) Viewed 42015 times
Re: Practical usage of the built-in hall sensor
So, as an answer to the original question by @rin67630 and related to my previous posts - here I present a calibration measurement just performed today. Approaching and removing a permanent magnet shows a quite remarkable signal change. I measured the magnetic field strength of the permanent magnet using a teslameter I have at work and then performed the mesurement with the ESP32-board. The viewgraph below shows the results. Applying 95mT (milli Tesla) gives rise to 63 scale units which pretty much means a scaling factor of 1.5 scale units per 1mT ! Subtracting the initial sensor offset and then multiplying the result by a factor of 1.5 now provides a nice magnetic gauge in units of mT.
Additionally I could verify that the hall sensor indeed is only sensitive to the magnetic field component perpendicular to the ESP32 cover by placing it inside a large homogenous magnetic field provided by Helmholtz coils and turning the board into different angles. Magnetic field parallel to the board has no effect, perpendicular shows maximum effect. Specifically, magnetic field direction upwards increases the reading values, direction downwards decreases the values. So I think that should be all that we need to know about the built in hall sensor.
Additionally I could verify that the hall sensor indeed is only sensitive to the magnetic field component perpendicular to the ESP32 cover by placing it inside a large homogenous magnetic field provided by Helmholtz coils and turning the board into different angles. Magnetic field parallel to the board has no effect, perpendicular shows maximum effect. Specifically, magnetic field direction upwards increases the reading values, direction downwards decreases the values. So I think that should be all that we need to know about the built in hall sensor.
- Attachments
-
- ESP32_hall_sensor_calibration.jpg (50.73 KiB) Viewed 41918 times
Re: Practical usage of the built-in hall sensor
Funny thing - still questioning the scale of measured readings of the Hall sensor - I discovered, that my USB connection runs at 7.0 Volt - not 5 Volt as it is supposed to be - and the 3.3V reference had approx. 4.8V ! I cross checked my ADC readings with a voltmeter and I must admit that all my ADC readings have to be corrected for that factor 4.8/3.3. This means that the scaling factor 1.5 of my previous measurement is obsolete - therefore the scale units in a corrected diagram directly represent the field strength in mT. This is very nice now and I assume, that the layout of the hall sensor regarding geometry and driving current was just designed this way. My new measurement below shows the change from 0 to a 100mT magnetic field of another permanent magnet (offset subtracted). The left scale in fact now represents the scale in mT units - I am pleased.
- Attachments
-
- ESP32_hall_measurement_of_100mT.jpg (47.3 KiB) Viewed 41859 times
Who is online
Users browsing this forum: No registered users and 19 guests