Magnetic Encoder Help

We have an AS5130 magnetic encoder from ASM. We’re trying to get some readings off of it so we can determine our shooter angle. i’m having trouble getting any response from it.

here’s what we’ve done so far.

wiring is as follows (per an email from an ASM representative)
5V to Digital I/O 5V
GND to Digital I/O (-)
Vout to Digital I/O Signal

Programming:

  1. We used the Encoder class, meant for quadrature encoders. We know this is not a quadrature but we tried it anyways. We called the digital I/O channel that it was plugged into and an unused channel as well because it required 2 channels in the constructor. We were unable to read any values.
  2. Some CD posts suggested using the Counter class. We tried that as well and were not able to get any readings either.
  3. We also tried the PWM class since it should be a PWM signal coming out of the sensor. This classes constructor calls for a pin on the PWM channels on the digital sidecar as opposed to the digitial I/O channels. So we moved the connection as required to a PWM channel. This time we didn’t just get no readings, we got an diamond shaped error icon in the output field of the SmartDashboard as if the output was not a number/correct format or something???
  4. Lastly, we also read on CD as well as some FIRST forums that a low pass filter could be used to convert it to an analog signal read from the analog breakout. When we did that we found out pretty quickly (and luckily before damaging anything) that it was making the transistor on the breakout module heat up enough to burn your finger within a couple of seconds.

Firstly, my guess is that you did not call the start() method in Encoder or Counter. Second, how are you using an encoder to measure your shooter angle? Encoders are meant for things that rotate more than 360 degrees, and not really for positional measurements.

The “diamond shaped error icon” is the infinity symbol. You probably called getPeriod() when it was reading zero.

You probably shorted the connection on the analog breakout. Make sure the PWM is in the correct orientation.

We did call the .start() and .reset() methods in the initialize() section of the command both when we used the Encoder and Counter classes.

We have a magnet mounted to the end of the shaft on which the shooter table pivots and the encoder board mounted right next to the magnet. An ASM representative told us that these specific encoders are meant to give a reading every 1.4 degrees which makes it applicable for our position sensing.

the diamond infinity error showed for both .getRaw() and .getVoltage() methods in the PWM class. if that means i was reading 0 then that’s no good either. =/

we can check the wiring on the low pass filter tomorrow but my electrical guy says he’s pretty sure he did it right.

any other ideas?

I’m looking at the datasheet for AS5130 and I don’t see any square wave quadrature signals like what the WPILib Encoder class is expecting.

we can check the wiring on the low pass filter tomorrow but my electrical guy says he’s pretty sure he did it right.

Can you post a quick hand-sketch of the filter circuit you used and how you have the AS5130 wired to the cRIO analog input? Include pin numbers of the 5130 and component values of the filter.