One QuadServo board being used to control 3 custom servo motors
For a robotics project I needed a way of controlling at least 12 motors with analogue feedback to turn then in to servo-motors. I needed a separate board for each of the 4 ‘legs’ of the robot which have 3 motors each.
I designed a small PCB (36mm x 33mm) around the Atmel ATXMega32 and 2 x TB6612FNG dual motor drivers. This allows each board to fully control 4 x DC motors and with analogue feedback turn then into servo motors. I added access to the spare pins which were later used to control 8 x RC servos using the standard PWM servo protocol (https://en.wikipedia.org/wiki/Servo_control).
I had 8 PCB’s manufactured with PCB-POOL (https://www.pcb-pool.com/), it cost €93. They are certainly not the cheapest but the quality is excellent and I got the boards in a week.
- ATXMega32 @ 32MHZ
- USB for programming or debug UART
- ISP connector for programming and debugging
- 2 x dual DC motor drivers
- 2.5v reference for analogue feed back
PCB was designed in Eagle, it fits with the free version limitation.
The software is written in C using Atmel Studio. The diagram above shows a simple representation: Commands come in through the UART and are buffered in a fifo, the main loop just looks into the fifo and decodes the commands as they come in. The DC servo motor control is done in a timer interrupt, it reads the ADC and performs a PID control of the 4 motors. Another timer is used to generate the RC servo outputs.
- PID control of 4 x DC motors with analogue feedback
- Control of 8 x RC servos on the spare 8 output
- ..or use spare I/O for GPIO control
- Use USB as debug or comms serial port
Hardware and software files are here: