Digital control of current

Using the digital current control version of the MP6500, I want to switch the stepper current between 1.5A (operational) and 0.5A (standby). So I have left pin i1 open-circuit and am switching pin i2 between ground and +5V from a digital pin on the arduino as required. But when in low-current mode (pin i2 HIGH) the stepper vibrates noisily rather than just sitting there as expected (no stepping in this mode).
So is pulling pin i2 to +5v the same as leaving it open-circuit (high-Z as on the data sheet)? If not, is there a recommended way of driving i2 from an arduino to get the desired effect?
If the two modes of operation are equivalent, does anybody have any thoughts as to why I am getting this strange behaviour?

Thanks,
Paul.

Paul, instead of pulling the Arduino pin connected to i2 to 5V, try changing it to an input using pinMode(n, INPUT). That will make i2 high-Z. To switch it to ground, you’ll have to switch the pinMode back to OUTPUT. I’m not sure if you also have to digitalWrite(n, LOW) each time–test it to see if it remembers that you left the pin LOW.

Edit: it looks like the pin is always set LOW when it is switched from INPUT to OUTPUT (someone please correct me if I’m wrong!) so you don’t have to worry about digitalWrite()

1 Like

Hi, Macman44.

I moved your post to the support section of our forum since that seems more appropriate.

As jlo mentioned, you should set the Arduino pin you are using to an input to put it in a high impedance state. I am not sure about whether the output is set back to low automatically, when it is changed back to an output, so I would just add the extra line to my code.

If that does not change the vibration and noise, it might be that 0.5A is not enough current for the motor to hold in your application. Stepper motors draw the most current when they are holding.

-Claire

1 Like

That’s an ingenious solution, and it works well.

Obviously pulling i2 to HIGH was the wrong approach - I wasn’t sure after reading the writeup on the web page. Update to the webpage indicated?

0.5A is quite enough to hold the motor for me, as there isn’t much torque required. I just wanted to reduce the motor and driver heating during extended hold periods, and to be sure the motor didn’t move slightly if I shut it off entirely.

Thanks to both for the helpful replies.
Paul.