1.7 KiB
| title | date | draft | summary | author | series | tags | |||
|---|---|---|---|---|---|---|---|---|---|
| STM32 For Beginners [5]: Motors | 2024-10-10T00:36:00+03:00 | true | ... | Rusted Skull |
|
|
Thus far we've learned very basic ways of making our microcontroller interact with the world: GPIO mostly. But to build a folkrace robot we need a little bit more. Motors, specifically motors with variable speed would help. The most simple motor to use in this scenario is a DC motor, like the Pololu micro metal gearmotors.
Driving DC Motors, Theory
To drive a DC motor, we typically use a H-bridge based motor driver. In the case of the Robotics Club course, we are given a Pololu DRV8835 carrier board which contains the Texas Instruments DRV8835 dual H-bridge chip. "Dual" in this case means that one board can drive two motors, perfect for a simple differential-drive folkrace robot.
{{< figure src="https://a.pololu-files.com/picture/0J4056.1200.jpg" caption="Source: https://wwww.pololu.com" >}}
If we look at the "Using the motor driver" section in the "Description" of the carrier board's page, we notice the following diagram:
{{< figure src="https://a.pololu-files.com/picture/0J4058.600.png" caption="Source: https://www.pololu.com" >}}
The right side is dedicated to the motors, and the left side specifies the input signals expected from the microcontroller. We immediately notice that for this control scheme, the "phase-enabled mode", we need to generate two PWM signals, alongside a few GPIO output signals. Let's look a little closer as PWM now, since that's the missing piece for us.