How To Use Encoders Over I2C?

Hello everyone!
I need to use 4 encoders, so that would be 8 pins, which would take up all the Analog Ins and expansion.
I’ve read about using something like an Arduino as an I2C bus for the extra inputs. I have no idea how to do this. When I try to to the regular I2C for the pin, it doesn’t work. Sort of hard to explain, I’m not even sure if I’m doing it right.
Can someone please tell me how to do this? Thanks for any and all responses.
P.S. This is my first post here, so if I’m doing something wrong, please let me know.

What type of encoders are they? If they’re quadrature encoders, which are the ones that take up 2 pins, they hook up to the DIO pins, not the Analog Input pins, and you have 26 of those easy to access. I’ve never actually seen an encoder with an analog output that takes 2 pins, so I would suspect they would be the type that plug into the DIO ports.

With an exact model we can help more and ensure things are hooked up correctly. Interfacing with an external arduino is doable, but would be much easier if you can hook everything into the roborio.

Aw crud, you’re right. They’re DIO. Sorry to bother you, haven’t gotten them from FIRST choice yet so I couldn’t check. Thanks

If you do find yourself in a case of needing to expand IO beyond the MXP, it is legal to use some other processor to read sensor input (think, Arduino mega or similar), and transmit the data back over I2C, SPI, Serial, Ethernet, or whatever else you feel like. The downside is that you have write the driver for communication on both sides.

A simpler approach to data transfer between the RIO and a coprocessor could involve Network Tables. As long as your coprocessor can connect on Ethernet, network tables is implemented in a bazillion languages. Pick your favorite:

Good ole’ Java and C++

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.