Hey Nathan,
Thanks for your response on this. For the sake of brevity, let me just add my approximated readings for voltage/current of my motor under no load conditions by voltmeter:
![image](https://forum.pololu.com/uploads/default/original/2X/f/f0f59272622ae6721e58a8a5aa59fe06f4cf6b86.png)
I learned another valuable lesson here, which is to always verify your ground truths before proceeding with either data collection or analysis. I find the current draw changes somewhat unsurprising because this motor has been through a good amount of use. The Arduino/Motor Driver combo we were using to read this was giving us wrong voltage values because we were running the power supply at a higher voltage due to some earlier issues (which are now corrected). The Arduino readings are as follows for the exact same motor under the exact same conditions:
![image](https://forum.pololu.com/uploads/default/original/2X/1/119ed47529d27b0d4526beb9ecf615fa3124b934.png)
We are using the Dual MC33926 Motor Driver for taking in the power supply and feeding it to the motors. Arduino is used solely for data collection and feedback control via encoders and is powered by USB. The power supply was run at 27.5V and we’re going to drop that down to 12V and observe the difference. I think we were mistaken about exactly what was being measured by the A0, A1 pins.
What I’m trying to currently solve is how to fix this. So far the Arduino voltage displays a very predictable fraction of the real voltage, but the current seems to display no such relationship.
![image](https://forum.pololu.com/uploads/default/original/2X/f/f7310714530b9bcb0b4e9bc29256bc747703afad.png)
In either case, I will update if we find anything. Let me know if you have any insights.
Edit: Solved the voltage mystery and have one additional question about the current one.
Voltage was a simple conversion issue in Matlab where we left the old voltage constant in. It now converts to well within range of the measured values via voltmeter.
For current, I want to make sure I understand the motor controller library. It says the following in the c++ code:
/ Return motor 1 current value in milliamps.
unsigned int DualMC33926MotorShield::getM1CurrentMilliamps()
{
// 5V / 1024 ADC counts / 525 mV per A = 9 mA per count
return analogRead(_M1FB) * 9;
The commented items there refer to internal calculations from the library/architecture, yes? In other words, if we use our Arduino command:
current1 = md.getM1CurrentMilliamps()
The variable will store the approximated current in milliamps, no additional calculation required, correct? Also in the user manual it states that “The pin voltage is roughly 525 mV per amp of output current.” In that calculation, I understand it means approximately 9 mA of resolution in reading the current, correct? Or rather, 1 ADC count of resolution.
I think I will return to my lab and run our power supply at 12V and report findings.
Edit2: After reducing the power supply to 12.5V, I noticed that the current values are roughly half of those I obtained at 27V. It’s not giving the current of the motor draw, it’s giving some sort of current from the power supply, but definitely nowhere near the actual value.
Edit3: I am stumped. I have switched out both the Arduino and Motor Shield individually (we have backups) because I thought it was perhaps a burnout from use. The motor continually displays the same current at 130 RPM, 14V power supply to the shield: about 0.2-0.22A. This is inline with your motor performance curve. Yet the draw on my Arduino output is the following:
Dual MC33926 Motor Dual MC33926 Motor Shield
RPM1: 0 RPM2: 0 k1 V: 360 k2 V: 360 M1 current: 585 M2 current: 513
RPM1: -109 RPM2: -122 k1 V: 326 k2 V: 349 M1 current: 72 M2 current: 45
RPM1: -122 RPM2: -118 k1 V: 354 k2 V: 340 M1 current: 45 M2 current: 45
RPM1: -122 RPM2: -122 k1 V: 354 k2 V: 348 M1 current: 27 M2 current: 54
RPM1: -126 RPM2: -126 k1 V: 355 k2 V: 351 M1 current: 54 M2 current: 36
RPM1: -126 RPM2: -122 k1 V: 360 k2 V: 350 M1 current: 27 M2 current: 36
RPM1: -118 RPM2: -118 k1 V: 356 k2 V: 354 M1 current: 45 M2 current: 45
RPM1: -122 RPM2: -126 k1 V: 355 k2 V: 356 M1 current: 36 M2 current: 54
RPM1: -126 RPM2: -126 k1 V: 358 k2 V: 355 M1 current: 54 M2 current: 45
RPM1: -122 RPM2: -126 k1 V: 358 k2 V: 355 M1 current: 36 M2 current: 45
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 353 M1 current: 54 M2 current: 45
RPM1: -126 RPM2: -130 k1 V: 358 k2 V: 357 M1 current: 36 M2 current: 36
RPM1: -126 RPM2: -122 k1 V: 360 k2 V: 354 M1 current: 27 M2 current: 45
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 355 M1 current: 45 M2 current: 36
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 353 M1 current: 54 M2 current: 27
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 357 M1 current: 36 M2 current: 54
RPM1: -126 RPM2: -126 k1 V: 358 k2 V: 354 M1 current: 9 M2 current: 45
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 352 M1 current: 54 M2 current: 36
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 356 M1 current: 36 M2 current: 45
RPM1: -126 RPM2: -126 k1 V: 358 k2 V: 356 M1 current: 54 M2 current: 45
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 354 M1 current: 45 M2 current: 36
RPM1: -126 RPM2: -130 k1 V: 355 k2 V: 359 M1 current: 45 M2 current: 27
RPM1: -126 RPM2: -122 k1 V: 360 k2 V: 354 M1 current: 45 M2 current: 54
RPM1: -126 RPM2: -126 k1 V: 356 k2 V: 355 M1 current: 27 M2 current: 27
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 355 M1 current: 45 M2 current: 54
RPM1: -126 RPM2: -122 k1 V: 360 k2 V: 355 M1 current: 45 M2 current: 27
RPM1: -126 RPM2: -126 k1 V: 360 k2 V: 353 M1 current: 36 M2 current: 45
RPM1: -46 RPM2: -97 k1 V: 185 k2 V: 218 M1 current: 45 M2 current: 18
RPM1: -97 RPM2: -84 k1 V: 273 k2 V: 255 M1 current: 18 M2 current: 45
RPM1: -97 RPM2: -101 k1 V: 282 k2 V: 280 M1 current: 45 M2 current: 45
RPM1: -105 RPM2: -105 k1 V: 303 k2 V: 302 M1 current: 45 M2 current: 36
RPM1: -109 RPM2: -109 k1 V: 325 k2 V: 314 M1 current: 45 M2 current: 54
RPM1: -113 RPM2: -118 k1 V: 329 k2 V: 331 M1 current: 18 M2 current: 45
RPM1: -118 RPM2: -118 k1 V: 344 k2 V: 334 M1 current: 36 M2 current: 45
RPM1: -122 RPM2: -122 k1 V: 352 k2 V: 342 M1 current: 54 M2 current: 18
RPM1: -122 RPM2: -122 k1 V: 354 k2 V: 346 M1 current: 45 M2 current: 36
RPM1: -126 RPM2: -126 k1 V: 355 k2 V: 353 M1 current: 27 M2 current: 27
RPM1: -126 RPM2: -126 k1 V: 355 k2 V: 354 M1 current: 27 M2 current: 36
The current output is supposed to be in millivolts and the k value is a number out of 400 where 400 is the power supply number. 360/400*14V = 12.6V which is ballpark close. 27mA is not enough to power a motor… it’s barely enough to power the encoder! There is seemingly no difference I can make, other than to change the power supply voltage. This seems to affect the number and the number is directly proportional to the power supply voltage. Something interesting is if I change the motor direction from -k to k, the exact same speed comes out as follows:
Dual MC33926 Motd
Dual MC33926 Motor Shield
RPM1: 0 RPM2: 0 k1 V: 360 k2 V: 360 M1 current: 630 M2 current: 513
RPM1: 109 RPM2: 122 k1 V: 330 k2 V: 346 M1 current: 63 M2 current: 63
RPM1: 122 RPM2: 118 k1 V: 355 k2 V: 340 M1 current: 54 M2 current: 81
RPM1: 122 RPM2: 126 k1 V: 354 k2 V: 348 M1 current: 63 M2 current: 45
RPM1: 122 RPM2: 126 k1 V: 353 k2 V: 352 M1 current: 72 M2 current: 81
RPM1: 126 RPM2: 126 k1 V: 360 k2 V: 351 M1 current: 54 M2 current: 45
RPM1: 126 RPM2: 126 k1 V: 358 k2 V: 351 M1 current: 54 M2 current: 45
RPM1: 126 RPM2: 126 k1 V: 358 k2 V: 352 M1 current: 63 M2 current: 27
RPM1: 126 RPM2: 126 k1 V: 360 k2 V: 350 M1 current: 63 M2 current: 36
RPM1: 126 RPM2: 126 k1 V: 360 k2 V: 350 M1 current: 99 M2 current: 45
RPM1: 126 RPM2: 130 k1 V: 358 k2 V: 354 M1 current: 54 M2 current: 81
RPM1: 126 RPM2: 126 k1 V: 357 k2 V: 355 M1 current: 81 M2 current: 54
RPM1: 126 RPM2: 126 k1 V: 360 k2 V: 352 M1 current: 81 M2 current: 72
RPM1: 130 RPM2: 126 k1 V: 360 k2 V: 350 M1 current: 45 M2 current: 63
RPM1: 126 RPM2: 130 k1 V: 357 k2 V: 355 M1 current: 54 M2 current: 27
RPM1: 126 RPM2: 126 k1 V: 357 k2 V: 357 M1 current: 81 M2 current: 63
RPM1: 126 RPM2: 126 k1 V: 360 k2 V: 351 M1 current: 18 M2 current: 63
RPM1: 126 RPM2: 130 k1 V: 357 k2 V: 352 M1 current: 54 M2 current: 54
RPM1: 126 RPM2: 130 k1 V: 360 k2 V: 358 M1 current: 54 M2 current: 81
RPM1: 130 RPM2: 130 k1 V: 360 k2 V: 356 M1 current: 81 M2 current: 54
RPM1: 130 RPM2: 130 k1 V: 360 k2 V: 353 M1 current: 63 M2 current: 36
RPM1: 130 RPM2: 130 k1 V: 360 k2 V: 353 M1 current: 72 M2 current: 54
RPM1: 126 RPM2: 130 k1 V: 357 k2 V: 357 M1 current: 54 M2 current: 27
RPM1: 130 RPM2: 130 k1 V: 360 k2 V: 355 M1 current: 45 M2 current: 63
RPM1: 130 RPM2: 126 k1 V: 360 k2 V: 352 M1 current: 63 M2 current: 54
RPM1: 122 RPM2: 122 k1 V: 360 k2 V: 350 M1 current: 72 M2 current: 63
RPM1: 126 RPM2: 126 k1 V: 358 k2 V: 349 M1 current: 54 M2 current: 54
RPM1: 126 RPM2: 126 k1 V: 357 k2 V: 350 M1 current: 81 M2 current: 54
RPM1: 126 RPM2: 122 k1 V: 360 k2 V: 348 M1 current: 63 M2 current: 45
RPM1: 126 RPM2: 126 k1 V: 358 k2 V: 350 M1 current: 81 M2 current: 45
RPM1: 126 RPM2: 126 k1 V: 357 k2 V: 351 M1 current: 63 M2 current: 27
RPM1: 126 RPM2: 126 k1 V: 360 k2 V: 349 M1 current: 54 M2 current: 54
RPM1: 126 RPM2: 130 k1 V: 354 k2 V: 354 M1 current: 81 M2 current: 54
RPM1: 126 RPM2: 130 k1 V: 354 k2 V: 355 M1 current: 45 M2 current: 18
RPM1: 71 RPM2: 71 k1 V: 360 k2 V: 360 M1 current: 9 M2 current: 0
RPM1: 0 RPM2: 0 k1 V: 360 k2 V: 360 M1 current: 9 M2 current: 0
RPM1: 0 RPM2: 0 k1 V: 360 k2 V: 360 M1 current: 9 M2 current: 0
RPM1: 0 RPM2: 0 k1 V: 360 k2 V: 360 M1 current: 9 M2 current: 0
RPM1: 0 RPM2: 0 k1 V: 360 k2 V: 360 M1 current: 9 M2 current: 0
RPM1: 0 RPM2: 0 k1 V: 360 k2 V: 360 M1 current: 9 M2 current: 0
Here is the writing diagram. Note the only change is that we are powering both of the motor encoders from 5V per suggestion. Any ideas?