G2 Motor Controller Driver Errors

I have been using the High-Power Simple Motor Controller G2 24v12 (product 1365) and found it to work very well. Recently I was doing some high speed sweeps in Python and ended up getting a Driver Error. The manual indicates:

I am not sure how to reset this. So far I have two controllers that are in this state and don’t want to risk more experimentation. When they are in this state they will not run at all. I have other controllers that are working so I know the code is working.

Here is the code that I am running - sweep to 1500 works but once I sweep to 3200 I get the driver error and the card will never work again. I’m running 12V into the power input.


# Uses the smbus2 library to send and receive data from a
# Simple Motor Controller G2.
# Works on Linux with either Python 2 or Python 3.
#
# NOTE: The SMC's input mode must be "Serial/USB".
# NOTE: You might need to change the 'SMBus(3)' line below to specify the
# correct I2C bus device.
# NOTE: You might need to change the 'address = 13' line below to match
# the device number of your Simple Motor Controller.
from smbus2 import SMBus, i2c_msg
import time
from itertools import chain

class SmcG2I2C(object):
    def __init__(self, bus, address):
        self.bus = bus
        self.address = address


    # Sends the Exit Safe Start command, which is required to drive the motor.
    def exit_safe_start(self):
        write = i2c_msg.write(self.address, [0x83])
        self.bus.i2c_rdwr(write)

    # Sets the SMC's target speed (-3200 to 3200).
    def set_target_speed(self, speed):
        cmd = 0x85 # Motor forward
        if speed < 0:
            cmd = 0x86 # Motor reverse
            speed = -speed
        buffer = [cmd, speed & 0x1F, speed >> 5 & 0x7F]
        write = i2c_msg.write(self.address, buffer)
        #print(buffer)
        self.bus.i2c_rdwr(write)

    # Gets the specified variable as an unsigned value.
    def get_variable(self, id):
        write = i2c_msg.write(self.address, [0xA1, id])
        read = i2c_msg.read(self.address, 2)
        self.bus.i2c_rdwr(write, read)
        b = list(read)
        return b[0] + 256 * b[1]

    # Gets the specified variable as a signed value.
    def get_variable_signed(self, id):
        value = self.get_variable(id)
        if value >= 0x8000:
            value -= 0x10000
        return value

    # Gets the target speed (-3200 to 3200).
    def get_target_speed(self):
        return self.get_variable_signed(20)

    # Gets a number where each bit represents a different error, and the
    # bit is 1 if the error is currently active.
    # See the user's guide for definitions of the different error bits.
    def get_error_status(self):
        return self.get_variable(0)

# Open a handle to "/dev/i2c-3", representing the I2C bus.
bus = SMBus(1) # change from 3
# Select the I2C address of the Simple Motor Controller (the device number).
address = 15
smc = SmcG2I2C(bus, address)
smc.exit_safe_start()
error_status = smc.get_error_status()
print("Error status: 0x{:04X}".format(error_status))
target_speed = smc.get_target_speed()
print("Target speed is {}.".format(target_speed))
for var in range(0,46,1):
   temp = smc.get_variable(var)
   print("Var {} = {}".format(var,temp))

new_speed = 3200 if target_speed <= 0 else -3200
print("Setting target speed to {}.\n".format(new_speed));
#smc.set_target_speed(new_speed)
time.sleep(1)
new_speed = 0
#smc.set_target_speed(new_speed)
count = 0
start = time.time()
for i in chain(range(0,1500,1),range(1500,0,-1)): #Note: 3200 will cause the Driver Error problem
   smc.set_target_speed(i)
   target_speed = smc.get_target_speed()
   count += 1
   print("Target = {}".format(target_speed))
   print("speed = {}".format(i))
   time.sleep(0.001)

end = time.time()
duration = end-start
countPerSec = count/duration
scan = duration/count
print("Count = {}, in {} seconds, {} per second, {} seconds/scan".format(count,duration,countPerSec,scan))

Thinking that maybe the power steps were too large causing a spike in back EMF which may have damaged the board? Are there flyback diodes in the design?

Hello.

Do the two controllers that reported this error start working again if you power cycle them and try to use them through the Simple Motor Control Center G2? What about if you disconnect your motor from the controller?

The MOSFETs used for the H-bridge in the motor controller have built-in diodes, but it is possible that a high voltage/current spike from your motor trying to draw too much power could damage the Simple Motor Controller. Can you provide more information about your setup; what motor and power supply are you using? Some pictures showing your connections would also be useful.

- Patrick

Just a 0-30V variable power supply (set to 12V). Can deliver 10A peak. Running Andymark 775 redline motors (with encoder) and 20:1 gearbox. No load on the gearbox.

After getting the error the controller never works again even in the PC software. Just gives the driver error.

Unfortunately, if the driver error is being triggered as soon as you power up the controller, then it is probably damaged. Since your motor has a stall current value of 130A, it easily has to potential to draw more power than what the driver on the High-Power Simple Motor Controller G2 24v12 can handle.

You might be able to get these controllers working with your motors across a greater duty cycle range if you can find an appropriate combination of hardware current limits and acceleration/deceleration limits. If you decide to try that, I would recommend adding some fuses to your circuit to protect the motor controller while you are testing different limits. It would also be a good idea to monitor VIN with an oscilloscope to check if voltage spikes are an issue. The safest option though would probably be to switch to a higher-power motor controller where you will have greater safety margins, like some of the RoboClaw Motor Controllers.

- Patrick

Patrick,

Thanks for the response. I find it hard to comprehend that it I have a power supply with a maximum current of 10A and the board will limit the current to 18A that the motor will “draw more power (current) than that.” Are you saying the at the current limit setting in the software doesn’t do anything? How can the power supply supply more current that it is rated for (and by a huge margin). I do have 10A fuses on the input to the board and they did not blow but that is just limiting the current from the power supplies. Are you suggesting to add fuses to the motor Out A/Out B leads?

What does the “Current Limit” setting in the Simple Motor Control Center G2 do if it does not limit current?

I would also think the diodes that you say are in the design should be able to protect the circuit.

I suppose I can work on the “Hard Limits” section of the control. Do you have any suggested values?

Using a RoboClaw controller such as the 60A controller and connecting it to a 10A power supply does not seem to make a lot of sense. Can you further explain your thought process on this? I connect through I2C which the RoboClaw controllers don’t seem to support. A have projects with 5 motors and just adding I2C addresses is a very nice feature.

Sorry for all the questions. I have about 15 of these controllers and they have generally worked very well. I’m just trying to understand what went wrong and how to correct it.

Sorry, I went over this with some other engineers here and I don’t think the problem is directly from too much current. If you are trying to draw more than the supply can deliver, you can get some very complex interactions, with a simplification being something like the motor controller getting turned on and off very rapidly. However, since you were sweeping over speeds, we now think the most likely explanation is that you set up something like regenerative braking that caused a big voltage spike on the main supply, which if unconstrained (e.g. because the power supply is not a battery and cannot handle large current dumped into it) can rise until something breaks (usually motor controller or power supply).

You should be able to narrow it down a lot by looking at the supply with an oscilloscope. Typically you will be able to see it if the motor is already spun up and then you sweep the duty cycle downward. To limit the likelihood of more destruction while doing this test, run at a lower voltage, and don’t let the motor speed up too much (i.e. limit the top speed at first). So for example, use 9V or 12V, power the motor to 30%, then sweep the duty cycle down and watch what happens to the regenerated voltage. Once you see it, you will see how much there is and how much room you have to play with to make the initial voltage and speed higher.

- Patrick

Patrick,

Thanks. I’ll lower the voltage and limit the acceleration steps, put a scope on the VIN and try to creep up on the problem by slowly increasing the acceleration rate and the voltage. May take a few days to have the time available to do this but will try to post the results.