Megatron Encoder spike in the measurements

Hi to everyone,

I have this sensor to measure the angle of a motor.

https://www.megatron.de/kategorie/hall-effekt-handeinsteller/download/306.html

It is working really good beside for an error. I have, always in the same point of the rotation, a spike in the measurement.

Could you think to something reasonable which causes that?

Thanks,
Fabrizio.

Do you have any data to illustrate what you are talking about ?

Yes, attached. I am getting data every 2ms and that is the result.

Do you have a vendor link or datasheet for the sensor ?

In the first message.

Or here:
http://www.megatron.de/en/products/hall-effect-singleturn-rotary-encoder/contactless-hall-effect-encoder-series-ena22-ecoturnR.html

The thing is that the spike is always in the same point of the signal. This is happening also with another encoder and I still don´t understand why.

F.

What is the motor attached to ?
Sorry, I forgot you posted the datasheet in your first post. That datasheet is in German. Does it say that the encoder output is analog 0 to 5Vdc ? Is it possible to turn off the power and move the motor by hand with digital meter reading the output to see what the voltage measurement is at that point. Obviously there is something wrong with the connection or electronics. The reading shown (spike) is not real. It is what is called "dropping bits" in the uprocessor debug terms meaning there is a short or open somewhere causing a bogus reading. You need to bypass the uController and read the encoder analog output manually with a multimeter. Take a photo of the encoder and do a continuity check of the encoder cable pin by pin to check for a bad connection on the cable. There has to be an explanation . The reading has to be false because it is measuring ANGLE and you know the ANGLE cannot be what it shows , where it shows it. Find the cause of the error using a digital multimeter. If two different encoders give you the same reading then it must be in the cable. I cannot explain the fact that it is consistently the same location. That is both a mystery and a clue. Good luck.

I was looking at the raw measurement from the encoder. The one that goes directly to the analog input of the arduino and it looks like there is no jump in those values. For this reason I am thinking that the error should be in how I convert this value to the angle of the motor then.

p.s. The link I sent you in the previous message should be in English.

Another thing I don´t understand is why on the datasheet it says that it is a 12 bit encoder , so I would expect that my analog reading (setting the analogReadResolution(12)) would read a value between 0 and 4095. Instead I read a value between 0 and 3956.

Someone can explain that to me ?

You haven't posted any code so it would be hard to help with that unless you post it.

It is working really good beside for an error. I have, always in the same point of the rotation, a spike in the measurement.

Could you think to something reasonable which causes that?

That isn't a spike ... its a gap/delay in measurement data. See previous reply for a reasonable suggestion.

Agreed. It's not a spike. This simplest way to verify that is to comment out your 12bit resolution statement

 analogReadResolution(12))

so the output is 0 to 255 and plot that. If there is no "anomoly" (gap) when using default resolution then that's your answer.