Dual VNH5019 - getM1CurrentMilliamps() value when stopped

Hi All

I’m using the Dual VNH5019 shield and I’ve written a program to operate a 12V DC car power window motor which is driving a butterfly value (drives a gear through 270 degrees) which turns the butterfly through 90 degrees. Anyway I’m having trouble with one of the safety checks I’ve added. I’m testing to make sure that when the motor is stopped getM1CurrentMilliamps() should be returning 0. I understand after issuing setM1Speed(0) there will be transient currents until the motor has reached stand-still, but after that I should expect to see 0 current shouldn’t I ?

This occurs even without the PC connected, but to try and work out what’s going on here is my simplified test and my observations:

I’m just calling getM1CurrentMilliamps() in loop and printing the result. I’m not issuing any command to adjust the motor at all. I have the jumper set to power the arduino from the motor supply and have the arduino connected to the PC so I can use the serial monitor. I start with the supply to the motor shield turned OFF and the arduino just powered by USB. The logging shows getM1CurrentMilliamps() = 0mA. When I switch the motor supply on I now see getM1CurrentMilliamps() returning a range of values under 250mA (measuring every 100ms). Eventually (after 30s to 1 min) this seems to settle and getM1CurrentMilliamps() returns 0mA again, almost like something warming up or inductance stabilising?? If I power the whole thing down the behaviour is repeatable.

Motor current: 0mA
Motor current: 0mA
Motor current: 102mA
Motor current: 0mA
Motor current: 0mA
Motor current: 0mA
Motor current: 102mA
Motor current: 34mA
Motor current: 0mA
Motor current: 0mA
Motor current: 0mA
Motor current: 102mA
Motor current: 34mA
Motor current: 0mA
Motor current: 0mA
Motor current: 0mA
Motor current: 68mA
Motor current: 102mA
etc

Can anyone shed any light on this? I’ve tried adding a 100uF electrolitic capacitor in the power supply spot on the shield without any effect and I’ve also tried adding a 0.1uF ceramic capacitor across the motor output without any effect either. The wiring to the motor is quite long (it’s at the opposite end of the car) but when I’m testing the car is switched off so there shouldn’t be many other currents etc… ?

Any insights greatly appreciated. Is my safety check a waste of time - ie is it an incorrect assumption that there shouldn’t be any measured motor current when the system is idle?

Hello.

What you’re seeing is normal. Keep in mind that a motor current reading of 102 mA corresponds to a mere 14 mV (or 3 counts out of 1023) on your Arduino’s analog input. In general, you should not expect to get very accurate low-current measurements from this shield since it is designed to report currents up to 30 A. I think the idea of a safety check is fine, but you should be checking that the current is above a threshold that is reliably exceeded when the motors are energized but that is never reached when the motors are off (it sounds like 200 mA might work for this).

- Ben

Hi Ben

Thanks for that - very helpful - that also explains why the same numbers seemed to keep appearing which i was curious about but seems so obvious now.

The fast response is especially appreciated given it’s over the weekend - caught me by surprise and means I’m able to keep playing with my project :slight_smile:

Thanks again