Arduino noob, using A3144 Hall sensor to make tachometer with Arduino Uno. I am also interested in making a Gauss meter but am aware that not all Hall sensors are linear. However, this tutorial uses a KY-003 Hall sensor which is literally just the A3144 with a 680Ω resistor and an LED. When i copy his exact setup and use his code, I get no change in reading when a magnetic field is present, which really doesn't make any sense regardless of it being a switch or not.
I can absolutely send in pictures, but I do have my wiring does exactly as he shows on the site.
The code is also the code on the site.
I have noticed that in the code, it says sensorRead = analogRead(sensorPin);
my intuitive guess is that this is supposed to read the output of the sensor in an "analog" way, regardless of it being connected to digital 10. If i am wrong, totally explain why. Any help is much needed and appreciated. thanks
it does seem unbelievable because it is a Hall switch, but how do you explain his pictures? Or do you think some guy just pieced together a guide using random photos across the web thinking he knew what he was talking about.
I looked at the sources for analogRead() and I believe it treats 10 as a synonym for A2. For pin numbers 14 (A0) and higher it subtracts 14. It then masks off all but the bottom three bits. In binary, decimal 10 is 0b1010. The bottom three bits are 0b010 which is decimal 2.
So analogRead(10) is reading A2, which is not connected.
All of the analog inputs share a common Sample/Hold capacitor. When an analog input is not connected, it doesn't add or remove much charge on the S/H capacitor. Most of the charge on the capacitor will have come from the last time A1 was read. A1 is connected to the 'calibration' potentiometer.
Note: There is even code to report "INTENSITY ERROR!" if you accidently connect A2 to Ground or +5V.
The LCD is displaying 1000 times the difference between the measured voltages at A1 and A2. This will depend mostly on what electrical noise the A2 pin is picking up.
The Hall-effect switch connected to digital pin 10 is not used at all.
How about this? The only review says that the analog output seemed to work well. Has option for both. I think I have heard iffy things about these types of modules though. Let me know, much appreciated. This is all for physics project due next month!
The Honeywell SS49E looks like it is quite linear from -1000 to +1000 Gauss. The analog input range is 1/5 scale to 4/5 scale so 205 to 819. You can translate to Gauss with: int Gauss = map(analogRead(HallPin, 205, 819, -1000, 1000);
Note that outside the 205 to 819 range it is likely to be non-linear so values under -1000 or over +1000 should not be used.