My Raspberry Pi dual motor driver has evolved quite a bit since I last wrote about it. In the original incarnation, I had planned on using the PWM capability straight from the Raspberry Pi to drive the TB6621FNG motor driver. That didn’t work so well due to the fact that Linux on the Pi isn’t a real-time OS, and there is only one hardware PWM.
To get around that, I added a PIC16F1826 to directly drive the motor. The Pi will send commands over I2C to the PIC, which will control the motor driver. It’s almost identical to an older (pre-Raspberry Pi) design I have.
Once I figured out how to reliably use I2C on the Pi, it turned out to be a good route to take. The PIC is inexpensive and plenty capable of doing the job. The Pi doesn’t need to worry about real-time control.
Below, I’ve got the almost complete robot stack: Motor mounting board, USB hub with WiFi adapter, Pi Zero, LiPoly supply, and I2C motor driver board. It’s also got a Sparkfun IMU board that will soon be replaced by my own.