Using Current Sense With Arduino for Control

I recently wired up the 18v17 up to my Arduino to controller ramping up and down a compressor with in rush current too high for my power supply. I’m now ramping the compressor up using the PWM control and it starts up like a dream. So that’s one problem solved.

The problem I have now is that the compressor gets turned out by an in-line pressure switch hooked to the pressure tank. I’m looking to see if I can get another pressure switch that I could directly signal the Arduino to ramp power on and off. I was wondering if I could use the current sense pin instead…

When I ramp the power down, if I leave the PWM at say 5% would that be enough for the current sense pin to change when the pressure switch kicks on? If so, I’d monitor that pin going “high” (whatever high at that low speed is) and then ramp it up to full until the current dropped off when the pressure switch shuts the compressor off.

Is that feasible?


Just to be clear, you are using the G2 High-Power Motor Driver 18v17; is that correct?

It sounds like you want to use the motor driver in series with a pressure sensitive switch and monitor its state through the motor driver’s current sense pin. When the pressure switch is closed, the current should flow through the H-bridge and motor and not when the switch is opened. I do not see any specific problems with doing something from like that, but implementing it will probably depend on things specific to your system. Do you have an oscilloscope you could use to look at the voltage of the CS pin under the conditions you describe? What current does your motor draw at 5% duty cycle? Can you post a link to the motor’s datasheet? What frequency are you providing your PWM signal at?

If my understanding of your setup is wrong, can you post a wiring diagram of your proposed connections?

- Amanda

Hi @AmandaS,

Yes, that’s the driver and that’s how I’d like to use it. Here’s a quick sketch…

I do have a scope. I can do the test as you described. Just wanted to see if that made sense before I took the time to set it up.