Coding the Magnetic Encoders in Embedded C for MSP432


I am fairly new to building robots and I am working on a line following robot using components from Pololu store including the RRC04A Chassis, Pololu Micro Metal Gearmotors, and the compatible Magnetic Encoder Pair kit.

My microcontroller is the MSP432 by TI, and as I have not worked with encoders before I am wondering how to program the magnetic encoders to record distance and direction in a flash memory and play back this information when the track is removed.

Are these Pololu Encoders compatible with TI’s MSP432? (I see most of the software is in Arduino code).

If so, could you point me to some resources on programming these encoders in Embedded C for MSP432?

Thank you, and I look forward to hearing from you.


Hello, Chi.

The magnetic encoders in the kit are just standard quadrature encoders providing digital outputs that can be connected directly to digital input pins on your microcontroller. There are many online resources you can find explaining how quadrature encoders work and how to interpret distance, speed and direction from the readings. I recommend looking at the National Instruments guide on quadrature encoder fundamentals as starting point.

- Amanda

Thank you Amanda. Are there any resources on the adequate way to program these encoders in Embedded C? What function to call? How to connect the pins?

Just to be clear, the encoders are not programmable; you need to program you microcontroller to read and interpret the encoder pulses. As I said in my previous post, you can find many resources online on how to use quadrature encoders, including code examples and libraries. (It is possible someone has already written a quadrature encoder library for your microcontroller.)

Regarding your last question, I suggest reading the “Pinout and installation” section on the magnetic encoder board’s product page.

- Amanda