KY-024 Hall effect sensor giving bad readings

I just bought a KY-024 linear hall effect sensor from amazon, and whenever I plug it in using this simple script:

#define s1a A0 //Sensor 1 analog input pin
#define s1d 5 //Sensor 1 digital input pin

void setup() {
 pinMode(s1a, INPUT);
 pinMode(s1d, INPUT);
 Serial.begin(9600);
}

void loop() {
 Serial.println(analogRead(s1a));
}

The serial output looks like this:
5ZNn0OVZvH
From what I've read, the output should be around 512 (depending on the adjustable sensitivity screw) and it'll increase/decrease depending on the magnetic field detected.

No matter how close I bring a magnet near the sensor, the value stays at 1023.
I've tried loosening/tightening the little screw on the K-024 to adjust the sensitivity but it didn't help.

However, if I touch the sensor with my finger, it does give me a reading:
WkwI36KUvz
(repeatedly touching the sensor)
The little sensitivity screw does effect whether or not touching the sensor will give me a result.

Here's a rather crude wiring diagram (sorry! :grimacing:):

AO -> A0
G -> GND
+ -> 5V
DO -> 5

I've tried two of my four K-024 sensors in this exact same arrangement and neither of the two have worked.

Here's the datasheet that I've been using so far: http://www.epitran.it/ebayDrive/datasheet/20.pdf

If you need any more details let me know, thanks! :slight_smile:

The sensitivity control, based on the data sheet you linked to, only adjusts the voltage being compared to by the comparitor. When the analog voltage matches or exceed the set voltage, the LED2 and digital output switch. The "sensitivity has no relation to the sensor itself.

Did you try the sample program from the data sheet?
Paul

Thanks Paul,

I just tried the datasheet script and its a similar result. It reads "Analog Voltage Output: 5V" constantly, and the voltage only dips if I touch the sensor. I'm pretty sure that the sensitivity screw does change the analog output, as when I tried touching the sensor with low sensitivity, the "1023" value only dipped to "1022", but when I tried touching it with high sensitivity, the "1023" value dipped down to ~500

Interestingly enough I've just built and successfully tested a 3 axis hall effect sensor for a levitation project.

Can you use a testmeter to check the supply voltage to the hall sensor itself - this should be 4.5V minimum. Then check the output pin on the sensor itself - with no magnets in the vicinity the voltage should be close to 2.5V (or half the supply volts).
Your magnet should alter this!!

Do you have a schematic for the module itself.

I have found a schematic for the KY-024:


https://easyeda.com/rakowski.hub/ky-024

This was the amazon listing if it helps:

I don't own a multimeter so I don't think this is possible for the moment.

Silly question - you have connected to the 5V pin on the Arduino, not the adjacent 3.3V?

I've connected it to the 5V pin

OK, then connect the 3.3V output in place of the sensor output - your reading should be around 675 give or take a few. You now have a testmeter that works, so use it to probe the Hall device directly!!

I'm a little confused about this, did you mean to move the 5V pin to the 3.3V pin? If so, that's what I did, and I got this output in the serial monitor:

Not sure on what you mean by this. Please bear with me, I hardly know what I'm doing :sweat_smile:

The A0 pin on the Arduino can be used as a voltmeter - so remove the blue lead from the sensor module to A0, now use another wire from A0 to whatever point you wish to check. Your programme serial output is a voltmeter reading fullscale of 1023 for a 5V input or 675 for a 3.3V input. This 3.3v reading is important as it ensures that the internal ADC reference is 5V (Vcc) and not some other value by default.

I should have added - restore the original power connection to 5V pin first!! Sorry

This is working and I am able to probe with the A0 pin.
wkzuGh8ebr
When the probe is connected to nothing it looks like this which I assume is normal?
What do you suggest I should probe with the A0 pin?

That's to be expected - first check the 3.3V to calibrate your testmeter!! It should read around 675. Then probe directly on the Hall device pins to see if that is working OK. Moving you magnet will hopefully alter the reading on the output pin from its nominal reading of around 512 counts.

I would put a delay in the loop. Sampling at that max rate may not be the best test.

Probing 3.3V was good- read ~675

I probed all of the pins, DO gave me 1023 when I touched the sensor and ~10 when I did not. Ground gave me 0, 5V gave me 1023, and AO gave me 1023. Still, no amount of moving the sensor close to the magnet would change AO from 1023 or DO from ~10. Do you suggest probing something else on the KY-024?

Putting a 1 second delay in the loop function does not effect my results.

So it's reading 1023 on the actual lead of the Hall sensor IC !! That's clearly not correct as even with a magnetic overload it shouldn't be that high. Double check the positive lead reads 1023 and the ground lead reads 0. You might also try adjusting the potentiometer away from its extreme ends and then repeating all the measurements. Confirm that your readings are on the leads from the Hall sensor to the circuit board.

From what you have said previously, a lack of 0V (gnd) on the sensor pin would be consistent with the results you have seen previously. If that is not the case, then I will admit to being stumped for the moment!!

I have to go in a few minutes and i'll be gone for a few hours but ill double check my results from the A0 voltmeter thing.

Touching DO on the module -> 10 unless touching the sensor then 1023
Touching + on the module -> 1023
Touching G on the module -> 0
Touching AO on the module -> 1023 unless touching the sensor then ~900

Tightening the screw (increase sensitivity)

Touching DO on the module -> 10 unless touching the sensor then 1023
Touching + on the module -> 1023
Touching G on the module -> 0
Touching AO on the module -> 1023 unless touching the sensor then ~200, still unaffected by magnet

I am just probing the four bits of metal pins sticking out shown in the image below

Sorry - not there, I meant on the three lead sensor at the other end of the board, that is the actual Hall effect IC. I'm of air now - will check in again tomorrow morning.

I've found it out!!

My hall effect sensors WEREN'T FULLY SOLDERED

I'm a little ashamed I didn't notice this earlier but whatever.

My hall effect sensor should look like this:

image

Instead, mine looks like this:

IMG_1835

Notice how the middle pin of the sensor has just been lazily wrapped around the sensor.

After "unfolding" the sensor

But that's not all, the actual sensor bit in the amazon product images is a different component from what I've bought

image
(Amazon listing)


(Similar sensor to the one on the amazon page)

Notice how mine is a semicircle while the one on the amazon page is like a trapezoid. The semicircle sensor that I have is labeled with:

KSP
13
JO8

I haven't been able to find a sensor matching this description yet.

I haven't seen the "semicircle" sensor that I have used in any KY-024 images online. It probably doesn't matter, just something to note.

Okay, no big deal, just unsolder and re-solder right? Well I don't have a solder station but I probably should buy one given how cheap they can get. I'm wondering if I can just cut the two soldered wires of the sensor, then one-by-one, hot glue the 3 pins to the correct spots on the PCB? Okay, that sounds like a hobby electronics sin but would it be possible? This is my first ever electronics project and if I ever do a second one I'll be sure to buy a soldering kit.

I should probably buy a soldering kit, but if the hot glue idea isn't catastrophically horrible I'd like to know if its a feasible option.

Now for the soldering part,

This is an image I found for the pinout of a similar sensor (the trapezoid one I mentioned earlier)


I've found that label 1 in this image is 5v, and label 2 is ground label 3 is where the other pin is supposed to go based on product images. My question is, should I just put the extra pin in hole 3 or should I cut the wires and move pin 2 to hole 3 and move the middle pin to where pin 2 was?

All four of my hall sensors arrived like this, any ideas what I should do?

I've also found this image, which is useful:


I can then infer that in order from left to right, the pins on the KY-024 are +5V, Ground, Output
So now we just have to find out which pins are which in this semicircular, unknown sensor component.

I have found the semicircle KY-024 here: https://www.aliexpress.com/i/33002918195.html, there appears to be no useful info though

I have now found what appears to be the sensor itself here: https://www.aliexpress.com/i/32991007776.html
From the product description, it appears to just be a transistor. I hope I wasn't scammed. The transistor linked above is sold by the same company who sold the KY-024 with the ksp13 semicircle soldered to it.

I have also found the "KSP13 JO8", the exact same transistor that was soldered to my KY-024
https://www.alibaba.com/product-detail/KSP13-TO-92-Transistor-KSP-13_1600272491973.html?spm=a2700.7724857.normal_offer.d_image.eef85b0cqVfLqU

The Alibaba listing for the KSP13 transistor:
image
The "sensor" that was soldered to my KSP-024

I think I might've been scammed, and "Gump's grocery" on amazon just soldered a transistor to my KY-024 instead of an actual hall-effect sensor. :cry:

1 Like