SKU:
DFR0592
Introduction
This is a Raspberry Pi DC motor driver board with on-board encoder interface, which can drive
2-way DC motor and DC motor with encoder. It communicates with Raspberry Pi via I2C, easy
to configure and drive motors. The DC Motor Driver HAT adopts STM32 micro-processor to
analyze the command sent by the upper host, and then convert into motor drive signal after
calculation. Besides that, a high-performance TB6612FNG motor drive chip is integrated on the
module. The single channel continuous current is 1.2A and the peak current is up to 2A. The
motor driver supports 7~12V wide input voltage.
Specification
•
•
•
•
•
•
•
•
•
•
Main Controller: STM32
Operating Voltage: 7~12V
Logical Voltage: 5V
Motor Driver Chip: TB6612FNG
Communication Interface: I2C
Default IIC Address: 0 x10
Continuous Drive Current: 2A
Working Mode:2-way DC Motor/ 2-way DC Motor with Encoder
2 Indicators
o Power Indicator
o Communication Status Indicator
Dimension: 65×30mm/2.56×1.18”
Board Overview
Num
Name
Description
1
+
External Power Positive (7~12V)
2
-
External Power Negative
3
E1+
Encoder E1 Positive
4
E1-
Encoder E1 Negative
5
E1A
Encoder E1 A Phase Output
6
E1B
Encoder E1 B Phase Output
Num
Name
Description
7
M1+
Motor M1 Positive
8
M1-
Motor M1 Negative
9
M2-
Motor M2 Negative
10
M2+
Motor M2 Positive
11
E2B
Encoder E2 B Phase Output
12
E2A
Encoder E2 A Phase Output
13
E2-
Encoder E2 Negative
14
E2+
Encoder E2 Positive
Dimension Diagram
Function Configuration
•
•
•
•
Control Mode: I2C command
Driving Signal: PWM 100Hz~12750Hz
Encoder Motor Function(Only DC Motor with Encoder)
o Disable/enable Encoder
o Reduction Ratio Configuration
o Get Revolving Speed of the Encoder Motor
Basic Function
o Set Driving Signal Frequency
o Set Duty Ratio
o Adjust Speed
▪ PWM Speed Adjustment (Keep the frequency, change the duty ratio. The
larger the duty ratio, the larger the rotating speed)
▪ Adjust the Driving Signal Frequency
Tutorial (Raspberry Pi)
Requirements
•
Hardware
o Raspberry Pi x 1
o DC Motor Driver HAT x 1
o Metal DC Geared Motor w/Encoder x 2
o DC Motors x 2
NOTE: the operating voltage should be within 7~12V, and the motor's current should not
be more than 2A.
•
Software
o DFRobot_RasbperryPi_Motor_Library
Connection Diagram
Operations
Step1: Plug the DC Motor Driver HAT in a Raspberry Pi's main-board, connect driver and
motor, power up.
Step2: Detect if the I2C interface is enabled. Input the command i2cdetec-y 1, if it is disabled,
the following interface will appear:
Step3: Enable I2C interface. (Skip this step if I2C is already enabled.) Input the command sudo
raspi-config to enter the configuration interface. Shown as below:
When finished the configuration, input sudo reboot to restart Raspberry Pi.
Step4: Detect I2C address. Input i2cdetect -y 1 to detect the device I2C address, shown as
below:
Step5: Download the DFRobot_RaspberryPi_Motor Library. Enter sudo git
clone https://github.com/DFRobot/DFRobot_RaspberryPi_Motor. Input ls to check
commands.
Example
Enter the python catalogue in DFRobot_RaspberryPi_Motor library.
cd /DFRobot_RaspberryPi_Motor/raspberry
How to drive a DC motor with encoder?
Use the variable M1,M2, ALL for id parameter to represent motor M1, motor M2, M1 and M2.
•
Step1. Enable the Encoder:
•
•
•
•
•
set_encoder_enable(self, id)
eg:
board = Board(1,0x10)
set_encoder_enable([board.M1])#Enable encoder motor M1
set_encoder_enable([board.M2])#Enable encoder motor M2
•
set_encoder_enable([board.M1,board.M2])#Enable encoder Motor M1 and M2
set_encoder_enable(board.ALL)#Enable encoder motor M1 and M2
•
Step2. Set the motor reduction ratio(43:1 in demo). Related with the reduction of the
motor.
set_encoder_reduction_ratio(self, id, reduction_ratio)
•
Step3. Set the frequency of PWM signal (1000Hz in demo)
set_moter_pwm_frequency(self, frequency)
•
Step4. Set the rotating direction and speed of motor M1, M2, M1 and M2. (Duty ratio:
0~100)
motor_movement(self, id, orientation, speed)
•
Step5. Get the speed of the encoder motor
get_encoder_speed(self, id)
NOTE: Different motors have different reduction ratio. Please revise the reduction ratio of
the motor before running the codes in the demo.
Click to check more function configuration and usage description.
Run the example DC_Motor_Demo.py. Print the duty ratio and rotating speed of the encoder
motor.
python DC_Motor_Demo.py
•
Program Function: Motor driver generates a signal with 1KHz frequency and a changing
duty ratio within 5%~95% to make the encoder motor M1 to rotate clockwise with speed
first increasing then decreasing; M2 rotate anti-clockwise with speed first increasing then
decreasing, and stop. At the same time, print the rotating speed on the serial port. The
whole program is repeatedly executed.
How to drive a DC motor?
Connect the DC motor to the interface of M1+, M1- or M2+, M2-. Disable the function of
encoder as the above demo, set frequency, duty ratio, rotating direction.
NOTE: For motors without encoder, we cannot get its speed, but only adjust the speed
through PWM.
Compatibility Test
MCU
Pass
Fail
Raspberyy Pi 4B
√
Raspberyy Pi 3B
√
Raspberyy Pi 3B+
√
Raspberyy Pi Zero W
√
MCU
Pass
Raspberyy Pi 2B+
Fail
√
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum
More Documents
Schematic Diagram
DC Motor Driver HAT for Raspberry Pi Wiki - DFRobot/9-8-21
很抱歉,暂时无法提供与“DFR0592”相匹配的价格&库存,您可以联系我们找货
免费人工找货- 国内价格 香港价格
- 1+130.459261+15.60455
- 国内价格
- 1+140.15458
- 3+132.50064