Reference

Library

API Description

  • set_encoder_enable(self, id): Enable encoder for specified motor(s). Use the variable M1,M2, ALL for id parameter to represent motor M1, motor M2, M1 and M2.
    Example: set_encoder_enable([board.M1]) (Enable encoder motor M1)
  • set_encoder_reduction_ratio(self, id, reduction_ratio): Set the motor reduction ratio. Related with the reduction of the motor.
  • set_moter_pwm_frequency(self, frequency): Set the frequency of PWM signal.
  • motor_movement(self, id, orientation, speed): Set the rotating direction and speed of motor M1, M2, M1 and M2. (Duty ratio: 0~100)
  • get_encoder_speed(self, id): Get the speed of the encoder motor.

Principle

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.

  • Encoder Motor Function(Only DC Motor with Encoder)
    • Disable/enable Encoder
    • Reduction Ratio Configuration
    • Get Revolving Speed of the Encoder Motor
  • Basic Function
    • Set Driving Signal Frequency
    • Set Duty Ratio
    • 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

Compatibility Test

MCU Pass Fail
Raspberyy Pi 4B
Raspberyy Pi 3B
Raspberyy Pi 3B+
Raspberyy Pi Zero W
Raspberyy Pi 2B+
rock 4se

More Documents

Schematic Diagram

Was this article helpful?

TOP