Can I use a uC to set DRV8825 current limit?

Hello folks,

I was hoping to ask if there is any way to hijack the voltage reference on the DRV8825 boards, so that I use use a pwm pin on my baby orangutan to control the current limit on 4 DRV8825 boards.

It would be extremely useful for me to be able to decide in the orangutan code what the current limit should be. That said, I don’t quite know if it’s possible or how I would do. I don’t need to change the current limit frequently, but at the least should be able to set it once. At the most I would want to make set it to “x value” for a brief bit, and then to x/2 for a lower holding torque for a while, and then back to x-value.

I was thinking through that I could have a LED feedback system to help manually setting the voltage, but it still isn’t nearly as powerful as if I could use one 1khz pwm signal to roughly set the current limit for the DRV8825.

Has this been done before?


Hi, Tomek.

Are you asking how you could control the voltage at VREF with a microcontroller in general (i.e. what kind of circuits you could use) or if we had any recommendations for how to go about doing that type of modification on the DRV8825 carrier specifically?


Hi Claire,

yes! I think I’m asking the latter point. I am comfortable figuring out how to get a voltage from my microcontroller to some point on a PCB, but I don’t know what I could do to make that useful for the DRV8825 carrier.

Is it enough for me to turn the pot on the carrier board to the lowest voltage possible, and then wire in a pin on my end to try and get a voltage on Vref? I assume I would have to do more to at least disable the vRef system that it’s using right now, and possibly also a few other details. I don’t quite understand the DRV8825 board, but I’m hoping it might be relatively easy to describe how I might go about modifying the system so that I could control the current limit with my MCU.

I am comfortable with some basic SMD reworking, and like I said, the code I’m not too worried about, assuming a PWM signal would be enough for vRef. If I could get away with it, I would run a standard 1khz arduino PWM signal, but if I need to, I could modify the frequency and add passive components to smooth out the signal.

What I don’t really know is how the current control system works and whether what I’m asking is a feasible modification to your DRV8825 board.

Hello, Tomek.

Turning the potentiometer all the way to zero is definitely not the way to do it since that would short the signal you provide to ground. If you are comfortable removing the pot, that would probably be best since you wouldn’t have to calculate its effects and you wouldn’t have to worry about inadvertently setting it to a bad setpoint. You could then solder your signal wire to the pot’s wiper terminal pad or to the via we expose for checking the VREF voltage.

If you want to generate arbitrary voltages via PWM from a microcontroller, I think you should at least send the signal through an RC filter and then possibly buffer that before it goes to the DRV8825 pin.

Another approach if you just need a few current levels is to keep the pot on and set to the highest current, and then put pull-down resistors on VREF that you selectively enable for lower current levels.

- Jan

Hello Jan,

I appreciate the response! I haven’t gotten to this project yet, but I will be pursuing those options. I definitively appreciate the response. I think the more software heavy version will be best for me (pwm signal), and I can do a small RC filter, I will probably consider a buffer of some sort to divide my voltage since my controller is 0-5V with a 8-bit timer (though I guess I could commandeer the 10bit timer) and we’re talking about much lower voltages. But from first thought I imagine a voltage divider could be a problematic way of operating this.

The pull-down resistors made me consider maybe doing this with a digital potentiometer…Do you know much current it would need to be capable of? Alternatively, if I end up settling on just 2-3 current settings that I need, I can use small transistors to enable real pull-down resistors or disable with spare pins.

I think you can combine your RC filter and voltage divider and then have that result go to the buffer. With the buffer output going to your VREF input, the input impedance (including the contribution from the trimpot) won’t matter much. If you go with the digital potentiometer, you should probably remove the mechanical one; I haven’t looked into them, but I expect that they would all handle just the VREF input on the driver chip.

- Jan

Hi Tomek,

I tried the same but with mixed results. I tried rc switches with different values, both the resistors and the condensators, but I could not find out a real working solution. One rc switch worked, but with a lot of additional noise, and the oths show strange behaviours. My multimeter shows some usable results on the rc output in, e.g. 0.5 V, but I have no oscilloscope, and so I am afraid that the voltage is not stable enough for providing a usable signal for the very Pin.

Did you have more luck? May I ask you, if you found a working solution for that topic?

Thanks a lot, that would be very helpful for me and certainly others, too!