Difficulty with 133 - Set M1 Max Current Limit

General discussion of using Roboclaw motor controllers
Post Reply
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Difficulty with 133 - Set M1 Max Current Limit

Post by Basicmicro Support »

That command has been updated but the documentation is a little out of date for that command. The SetCurrent commands were updated to be the same syntax across all the products(Roboclaw and MCP). The updated syntax is:

Addr, CMD, Max(4 bytes), Min(4 bytes, set as 0s on Roboclaw), CRC16

You code should be something like this:

cmd_bytes=struct.pack('>BB','0x80',133)
data_bytes=struct.pack('>L',500) + struct.pack('>L',0)
write_crc=CRCCITT().calculate(cmd_bytes+data_bytes)
crc_bytes=struct.pack('>H',write_crc)
port.write(cmd_bytes+data_bytes+crc_bytes)

Note: your old code would have been wrong for the old syntax as well. You have to calculate the CRC16 across all bytes(including the zeros).

Note2: I did not test this code so you may(probably) need to tweak it.
tempest766
Posts: 3
Joined: Wed Jan 17, 2018 2:09 pm
Re: Difficulty with 133 - Set M1 Max Current Limit

Post by tempest766 »

This is important for me to know as well. Customer was previously using servo control and tasked me to introduce USB packet serial control of the motors (both methods open loop control). Motors are stalling in packet serial mode when under load.

What is the power-on default value of the "read max current M?" packet per product, assuming no windoze setup was done using your config program?

Does the "set max current M?" value represent the max stall current or max running current that should be delivered to the motor?

My time on-site with the Roboblaw hardware is limited so I'd like to understand what sane values would be BEFORE visiting the customer again.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Difficulty with 133 - Set M1 Max Current Limit

Post by Basicmicro Support »

The default setting for current limit is the over current limit of the particular model(eg 60amps on the 2x30A etc...). This setting is the maximum allowed current(peak). This setting also is overridden by the controller if the maximum current based on board temperature is lower than this setting at any give instant.
tempest766
Posts: 3
Joined: Wed Jan 17, 2018 2:09 pm
Re: Difficulty with 133 - Set M1 Max Current Limit

Post by tempest766 »

Your answer is unclear to me. Is that max current limit you are referring to PER MOTOR, or total aggregate current? Each motor has a max current setting. All I'm interested in is the default of each individual motor, not the aggregate.

By your logic, the board could pull four times the rating of the controller 2x30A pulling 120AMPS for the combined motors?

For the 2x30A (per motor) what is the default value I will get if I query using packet #135 or #136?

I don't have the hardware in front of me so I cannot investigate.

Thank you for your assistance.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Difficulty with 133 - Set M1 Max Current Limit

Post by Basicmicro Support »

The current limit is per motor.

For a very short time yes. Assuming both channels were pulling 60amps it would heat up to 85C in a couple seconds at the same time it would reduce the maximum allowed current automatically. Temperature dictated current limits override user set current limits.

Again, assuming you are using a 2x30A the default settings would return 6000(that current limit in 10 milliamp increments).

Post Reply