Set Current

The Set Speed command is used to set the motor controller’s target current output. The motor controller’s current operating mode will be set to CURRENT mode. The command timeout counter is reset when this command is received.

If the commanded current is less than the configured minimum current, the motor is stopped unless the CAN bus command is sent with a specified Current Off Delay.

Command Parameters

ParameterUnitsDescription
CurrentampsTarget motor current, in amps
Current Off Delaysec(CAN bus only)
Optional parameter. If commanded, the current controller will be prevented from switching off modulation for target currents less than the configured minimum current for this amount of time.
This parameter is only functional when operating an FOC motor.

[reveal1 title=”Web App”]

  1. Switch to Operate tab
  2. From the Control Mode selection box, select Current Control
  3. Under Current Control, specify a minimum and maximum commandable amperage
  4. a. Drag the slider to change the commanded current
    OR
    b. Type a current value into the manual entry box and click Set Current

[/reveal1]

[reveal1 title=”Serial Interface”]

This command follows the standard VESC serial packet format.

Command Structure

ByteDatatypeValueScalerDescription
0uint80x02Packet start byte
1uint80x05Packet length
2uint80x06Packet ID [COMM_SET_CURRENT]
3int321000Target current, in amps
7uint16CRC16 of data section
9uint80x03Stop byte

Command Examples

The following table shows an example command to set the target current to 5 amps.

Start ByteLengthPIDCurrentCRC16End Byte
Hex0x020x050x060x000013880x8B250x03
Integer2565000356213

The following table shows an example command to set the target current to -10 amps.

Start ByteLengthPIDCurrentCRC16End Byte
Hex0x020x050x060xFFFFD8F00x3AD40x03
Integer256-10000150603

Command Response

There is no response for this command.

[/reveal1]

[reveal1 title=”CAN Bus Interface”]

This command follows the standard VESC CAN command frame format.

The CAN bus command has two formats – one with the optional minimum current controller timeout and one without.

Without the timeout:

Packet Identifier:0x01 [CAN_PACKET_SET_CURRENT]
Data Length Code:4
Contents:[int32] Target current * 1000

With the timeout:

Packet Identifier:0x01 [CAN_PACKET_SET_CURRENT]
Data Length Code:6
Contents:[int16] Current timeout * 1000
[int32] Target current * 1000

Command Response

There is no response for this command.

[/reveal1]