SVP-1284 current-sensing circuit

I jumper-ed CS1 to analog input 1 and CS2 to analog input 2 and set the motor speed from -255 to +255 in a loop. I used analog_read(1) and analog_read(2) to read the current values but always see zero. I do see the motor leds change brightness and color. I know the analog inputs work, because I have used them to test some IR distance sensors.

I have only one motor connected and it should draw 30ma at max speed (vbatt=9v).

Am I missing something???

``````int motor_speed = 0;

while (1)
{
set_motors(motor_speed, motor_speed);
motor_speed++;
if (motor_speed > 255)
{
motor_speed = -255;
}
delay_ms(10);
clear();
printf("c1=%4d c2=%4d", cur1, cur2);
delay_ms(50);
}``````

Mike

Hello Mike.

The CS pins output 850 mV/A, so if your motor is drawing 30 mA, the output voltage on the CS pin is only around 25 mV, which would result in a value of 1 when performing 8-bit conversions. Given how slowly you’re ramping up the motor speed, I’m guessing that your motor is spending quite a bit of time drawing less than 30 mA. What happens if you try measuring the current while stalling your motor? I’d also make the test simpler and just set you motor speed to a constant 255. You can independently probe the voltage on the CS outputs with a multimeter to see if what kind of voltages are there when your motor is running and when it’s not.

- Ben

I am using 10 bit mode (I did not show that part in my example snip), but figured it might be that the value was too small. I put a 10 ohm resistor across the motor output and saw it register current and burnt my finger ;).

Thanks!
Mike

I think stalling your motor might have been easier on your finger, but I’m glad to hear that it was just a low signal issue!

- Ben

Hi,

I’m having some trouble measuring low current values. I have the same system (SVP-1284), but I’m driving a stepper that draws about .25A off of Vadj, set to 5V. I’m powering the board with a 12V/2A regulated supply (after having trouble with a few wall warts).

For motor currents (measured with an ammeter in series) below about 0.13A I get close to zero voltage on the current monitor pins when measured by the analog inputs on the SVP-1284 or when measured with a voltmeter. For currents above 0.13A the current monitor voltage does rise with a slope not too far from the 850 mV/A spec. Here are the actual data I collected:

motor_command_counts = [255 240 195 164 127 87 0]
measured_current_Amps = [0.24 0.22 0.17 0.15 0.11 0.08 0]
analog_read_millivolts = [147 112 54 10 0 0 0]
measured_CS_millivolts = [144 118 59 29 3 2 0]

If you plot measured_current vs. measured_CS, you see a breakpoint at around 0.13A, below which the CS voltage is near zero. Is this normal, or is there maybe a ground offset problem?

Thanks,

-Arthur

Hello.

Can you tell me exactly how you’re connecting your ammeter?

- Ben

For the current measurement, I connected a multimeter in series with one coil of the stepper motor (a bipolar 4 wire model wired into the SVP-1284 screw terminals). And the current I measured matched the current commands pretty well:

motor_command_counts = [255 240 195 164 127 87 0]
measured_current_Amps = [0.24 0.22 0.17 0.15 0.11 0.08 0]

When I measured the CS voltage, I grounded the multimeter to one of grounds on the analog input header. Note that this was a different test because I was working with only 1 multimeter and couldn’t measure both at the same time. But I was monitoring the CS voltage during the earlier current test via the SVP-1284 ADC inputs, and (considering noise and round-off) they seem reasonably consistent with the later voltmeter measurements. Both make it look like there’s an offset affecting the CS voltage output:

analog_read_millivolts = [147 112 54 10 0 0 0]; % SVP-1284 ADC measurement of CS voltage
measured_CS_millivolts = [144 118 59 29 3 2 0]; % voltmeter measurement of CS voltage

-Arthur