Motor Driver on Raspberry pi & Encoder on Arduino

Is it possible to use the motor driver attached to run two motors like this while having the encoder attached to the arduino? Is there any way to have all of it attached to the raspberry pi? Is there a motor driver that can handle two of these motors while having all of the encoders attached on the raspberry pi? Any and all information would be super helpful.

Hello, Andrew.

It should generally be fine to use an Arduino to process the encoder signals of a motor being driven from a different source like a Raspberry Pi. If you want the Raspberry Pi to have access to that information, you will probably need to set up some kind of communication between the two devices (like TTL serial or I2C). However, if all you need the Arduino to do is process the encoder signals, it is probably more practical to use some kind of dedicated quadrature decoder board (though I do not have any specific recommendations for one).

By the way, we generally recommend choosing a motor driver that can handle the stall current of your motor continuously. The Dual TB9051FTG Motor Driver for Raspberry Pi that you linked to is a bit underpowered for the 12V 37D gearmotor you specified. So, if you do try to use them together, I recommend taking some precautions like acceleration limiting and limiting the maximum duty cycle (which would limit the top speed and torque available).

The Raspberry Pi boards are generally not good at timing-sensitive tasks like processing encoder signals, but depending on what you want to use the encoder feedback to do, you might consider using a motor controller that has support for processing the encoders directly. For example, the Jrk G2 controllers can use a single channel of the quadrature encoder as tachometer feedback to do closed-loop speed control, and it has a few interface options that can be used with the Raspberry Pi, such as USB, TTL serial, or I2C. Please note that the Jrk G2 has a single motor channel output, so you would need one for each motor you want to independently control. Another option might be the RoboClaw motor controllers, which come in a few different versions, including the dual channel RoboClaw 2x7A, and can be configured to use quadrature encoder signals for closed-loop position control of brushed DC motors. It can be controlled via USB or TTL serial. I recommend reading through the product pages and user’s guides for those controllers to see if either of them seem like a good fit for your application.


So if I were to get the motor driver shield for arduino I would be able to connect the encoder to the arduino and get all of the information and control the motors that way?

Yes, you could control the motors and read the encoder signals from the same Arduino. We do not have any specific examples for doing so, but you can use our Arduino library for the Pololu Dual TB9051FTG Motor Driver Shield for controlling the driver and a suitable rotary encoder library for reading the encoder signals (I generally recommend using one that supports interrupts).