Encoder wiring

So I have the AS5030 8-bit Programmable Magnetic Rotary Encoder but I don’t know how to wire it. When I am coding (in java) it requires 2 channels, but the board that we got only has one 3 prong connector coming out, does anyone know how to wire this?

Are you using the Encoders that go on the shafts of the Cimple Gearboxes that came in the kit? If so this is what we did, if Not were using different encoders.

There are 4 wires coming from the encoder. +5v, ground, and signal A and signal B.

These are all wired to the Digital I/O of the digital sidecar. The 2 signal wires will go into separate ports in the digital sidecar.

No, we are using the demo board that comes with the AS5030 8-bit Programmable Magnetic Rotary Encoder. I am looking on how to wire the two output channels


According to this documentation http://www.usfirst.org/uploadedFiles/Community/FRC/Game_and_Season__Info/2010_Assets/AS5030-AB-2%200%20Adapterboard%20User%20Manual%20Rev1.pdf

there is only one signal wire used according to page four when outputting a PWM or analog value. Two wire is DIO, CLK. The encoder in the WPIlib is meant specifically for thr E4P optical encoder since that one needs two signal wires as a quadrature encoder.

So how could I use this encoder in a PID loop(we are using java, but any language should be okay). We are try to track the RPMs of a spinning axle.


Read the documentation I have linked to. This encoder relies on a magnet mounted to a rotating shaft being really close to it (0.5mm to 2.0mm) so I am not sure if you can even properly set this up depending on what is available. The code itself depends on which signal type you wish to use.

I read the documentation. Could you go into detail on how to program the encoder into a PID loop. Right now I have it as an AnalogChannel, but I don’t know how to get the rate from that. How do I get rate, like rpms?


I am not experienced with these encoders so I cannot help you that much. According to the documentation you would have to be able to count every time the voltage changes from 5V to 0V or vice versa (full rotation.) Rate if I am thinking correctly would be change in counts (since last count measurement) divided by time (since last count measurement) for this encoder not accounting for error. There is a thread dedicated to Speed based PID Control Loops if you search for it.

Partially right, partially wrong. The WPIlib Encoder class is designed to handle any quadrature encoder; the E4P is just standard to use in FRC due to USDigital’s sponsorship.

You might be able to use the gear tooth counter class for this encoder.

How do I wire the AS5030 encoder for high rpm uses, like 4000 rpms?