I’ve recently been developing an I2C motor controller board for UC Berkeley’s Pioneers in Engineering (PiE), a club who’s purpose is to run a high school robotics competition. PiE creates the kit of parts which high schoolers use to create their robots and provides them with college mentors to help them through the process of building their robot. This year, this means building a motor controller to provide a cheaper alternative to the Pololu Simple motor controller.
We decided to use the Freescale MC33887 H-bridge chip and the ATMEGA328 microcontroller. The ATMEGA328 allows us to read encoder signals making them accessible over the I2C interface and can run a PID using current sensing or the encoder. It’s also the same chip used on Arduino boards so we can use the Arduino IDE and libraries. Allowing the encoders to be read through the motor controller frees up processing on the main controller and simplifies wiring.
Some modifications were necessary to upload the Arduino bootloader on the ATMEGA328 because it has different signature bits from the ATMEGA328P. I haven’t yet figured out how to upload the bootloader using the Arduino IDE and found it easier to just use avrdude directly from the command line.
Later, I created a new revision which is significantly smaller (slightly larger than the Pololu simple motor controller). See the schematic, PCB design, and partially assembled board on the right.
As I continued working on the firmware for the device, the Arduino libraries became cumbersome, so I decided to switch to pure AVR C code.
The code I uploaded to the ATMEGA is available on GitHub along with some test software here: https://github.com/keeganmann/PiE-Motor-Controller
The eagle files are available here on google docs.
We’ve created documentation for the high school students on PiE’s public wiki.
Here are some videos: