3.3. Motors
Motor drivers
Two on-board Texas Instruments DRV8838 motor drivers power the Balboa’s two micro metal
gearmotors. Four Arduino pins are used to control the drivers:
•
Digital pin 15
, or PB1, controls the
right motor direction
(LOW drives the motor forward,
HIGH drives it in reverse).
•
Digital pin 16
, or PB2, controls the
left motor direction
.
•
Digital pin 9
, or PB5, controls the
right motor speed
with PWM (pulse width modulation)
generated by the ATmega32U4’s Timer1.
•
Digital pin 10
, or PB6, controls the
left motor speed
with PWM.
Note that “forward” refers to the rotation direction that would cause a balancing Balboa to move in the
direction its battery cover is facing.
For more information about the drivers, see the
[https://www.pololu.com/file/0J806/
(1MB pdf). We also sell a
[https://www.pololu.com/product/2990]
for this driver.
The Balboa32U4 library provides functions that allow you to easily control the motors, and it can
optionally take care of flipping a direction signal for you if you accidentally soldered in a motor
backwards (see
As your batteries run out, the voltage supplied to the motor drivers (VSW) will decrease,
which will make the motors slower. It is possible to account for this in your code
by monitoring the battery voltage (see
) or using the encoders and other
sensors to monitor the movement of the robot.
3.4. Quadrature encoders
Pololu Balboa 32U4 Balancing Robot User’s Guide
© 2001–2019 Pololu Corporation
3. Balboa 32U4 in detail
Page 17 of 97