Pulse Width Modulated DC Motor Driver Outputs
Grove connectors
J6
and
J7
are configured for controlling DC motors.
The Raspberry Pi microcomputer supports two hardware PWM outputs:
PWM0
and
PWM1
, each of which can be mapped to several GPIO pins. The following device
tree overlay command must be appended to
/boot/config.txt
to configure the
Raspberry Pi PWM subsystem for the MUNTS-0018 Tutorial I/O Board:
dtoverlay=pwm-2chan,pin=12,func=4,pin2=19,func2=2
Pin Mapping
J6
Pin 1
PWM0
PWM Duty Cycle
J6
Pin 2
GPIO13
Direction
J7
Pin 1
PWM1
PWM Duty Cycle
J7
Pin 2
GPIO18
Direction
Other PWM pin configurations are possible. With no PWM device tree overlay at
all,
J2
,
J3
,
J6
, and
J7
are just mapped to GPIO pins. It is also possible to map
both PWM outputs to one Grove Connector, for motor driver circuits that require
clockwise and counterclockwise speed signals instead of speed and direction.
See the Raspberry Pi device tree overlay
for more information
about the possible PWM output configurations.
Alternate PWM Device Tree Overlay Command for Cytron MD13S
motor driver has the speed and
direction signals swapped:
DIR
is connected to pin 1 (yellow) and
PWM
is
connected to pin 2 (white).
The following device overlay command configures
J6
and
J7
for compatibility with
the MD13S:
dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4
Pin Mapping
J6
Pin 1
GPIO12
Direction
J6
Pin 2
PWM1
PWM Duty Cycle
J7
Pin 1
GPIO19
Direction
J7
Pin 2
PWM0
PWM Duty Cycle
Note: This overlay command makes the servo headers unusable for servos.
MUNTS-0018 Raspberry Pi Tutorial I/O Board User Guide
Page 5 of 11