Main Content

PCA9685 DC Motor

Control power and direction of a DC motor

Since R2023a

Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.

  • M1 M2 DC Motors block

Libraries:
Simulink Support Package for Arduino Hardware / Common

Description

The PCA9685 DC Motor block controls the power and direction of a DC motor connected to PCA9685 PWM chip-based shields such as Adafruit Motor Shield V2. The input signal determines the power supplied to the motor and the direction of rotation of the motor.

Supported Hardware

The PCA9685 DC Motor block supports all Arduino boards.

Ports

Input

expand all

The sign of the input signal determines the direction of rotation of the DC motor. A positive sign indicates a forward rotation, whereas a negative sign indicates a reverse rotation. The amplitude determines the power supplied to the motor.

  • 1 to 100: Forward rotation, minimum to maximum power.

  • –1 to –100: Reverse rotation, minimum to maximum power.

  • 0: No power is supplied.

Any out-of-range values, at the block input port has the same effect as the maximum or minimum input values.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Parameters

expand all

Specify the I2C module on the Arduino® hardware to communicate with sensor peripherals. For more information on the Arduino pin mapping and modules that hardware boards support, see Pin Mapping for Arduino Timer Independent Blocks.

Enter the PCA9685 address on the PCA9685 PWM chip-based shield that is connected to the DC motor.

Specify the frequency (in hertz) on the PCA9685 PWM chip-based shield that is connected to the DC motor for generating the pulse-width modulated signal.

Specify the motor channel on the PCA9685 PWM chip-based shield that is connected to the DC motor.

Do not assign the same channel number to more than one DC Motor block within the same model.

Version History

Introduced in R2023a