Artful Bytes

A blog about building and programming hardware.

Motor Control with PWM in C

April 18, 2023 1 min read

In this video, I write C code to control four brushed DC motors using two motor drivers (TB6612FNG) and a microcontroller (MSP430). Each motor driver requires two control inputs and one pulse-width modulation (PWM) input. I create three abstraction layers: a PWM driver at the bottom, a motor driver in the middle, and a simplified drive interface at the top. 21 videos in and something is finally moving.