Arduino Nano connected to a 0-360 degree hall sensor

Hi all ,

I have connected the arduino to the 0-360 degree hall sensor, i am trying to read values from it. this is my simple code


void setup() {
 
  Serial.begin(9600);
}

void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A3);
  
  // print out the value you read in the Serial Montitor:
  Serial.println(sensorValue);
  delay(50);  // delay in between reads for stability
}

This is the link to the encoder i am using
https://vi.aliexpress.com/item/4000143910873.html?spm=a2g0o.order_list.order_list_main.15.d2f81802A6MHz2&gatewayAdapt=glo2vnm

when i rotate the knob of the encoder, i get values from 0 to 1023. But at this 1023 the value remains constant for sometime until it changes to 0 back again.
I also tested it with the multimeter, and it shows when the voltage is between 4.7V to 5V , the value is 1023 and it remains constant.

I want to eliminate this issue of having a constant value even though the knob is rotated for precise measurements.

Please help on how to solve this issue.

I moved your topic to an appropriate forum category @aparna97.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Hello aparna97

Welcome back.

Post the datasheet hall sensor to check the interface details.

What sort of Arduino are you using?
It sounds like you are using a 3V3 processor with a 5V A/D reference voltage. Which would explain what you are seeing.

Hi @paulpaulson ,

This is from Aliexpress. There is no datasheet. But these are the specs from the website.
Effective electrical angle 360º

Resolution 360°/4096(12 bit)≈0.088°

Linearity Standard:0.3%;customizable precision:0.2%;

Super precision:0.15%

Update Speed 0.6ms / 0.2ms(high-speed)

Operating voltage 5V±10%

Output signal 0~5V(ratio)

Operating Current <16mA

Maximum and minimum output deviation

Load resistance >10KΩ

Mechanical parameters

Mechanical angle 360º(No stop)

Protection class IP40

Working temperature -30℃~+80℃

Storage temperature -30℃~+80℃

The rotational torque <5mN·m

Mechanical life >10 million transfer

Weight About 25g

Housing Anodized aluminum surface Shaft Stainless steel

Electrical terminals Thick gold plated brass terminals

This is the arduino nano I am usinghttps://sg.element14.com/arduino/a000005/arduino-nano-evaluation-board/dp/1848691

OK so we now need to see a diagram of how you have wired it up.

Can you measure that with a voltmeter?

image
its similar to this, instead of pot, i have wired up the sensor

Yes, I measures using multimeter. I can see the voltage changing in a linear way from 0 to 5V. and in the arduino output , I can see when the voltage is from 4.7 to 5 V the output from arduino is 1023 and not changing.

That link from where you bought it from shows your component will only work up to 3V3, so that is your problem you have the wrong part.

Exactly.

You mean the sensor works only till 3.3V?

Sorry I didn't understand, I have shown the wiring diagram on how I wired it up

Nope, i bought the 0-5V variation in this.

So why did you post the wrong part?
Or maybe it is labeled wrong?

Your measurements with your voltmeter show you have something wrong with your setup, we are trying to find out what.

Can we discuss on what the issue is please? I accidently posted it with the wrong variation

If the label on the part is wrong, then multimeter will show it I guess. but in multimeter it is 0 to 5V when i turn the knob.

The issue is that you bought a part from AliExpress, people who have a reputation for selling junk. I think you bought junk.

But how is it showing the correct values in the multimeter but not the arduino code