SparkFun Monster Moto Shield current sensing issue

I am using SparkFun Monster Moto Shield for driving two DC motors. The Shield is working fine and i am able to drive the motor in both directions. However, the current sensing is continuously showing "zero" in serial monitor of Arduino UNO. I am confused why the shield is not measuring any current. I want to measure normal current of 750 mA and stall current of 6 A but getting zero value continuously. If any one help me i shall be very thankful.

How do you have the CS pin connected? Can you post a wiring diagram? And your program.

The link for accessing the schematics of the IC are as under

Moreover as per the manufacturer the current sensing pins are directly attached to arduino analog pin A2 and A3, but the pins when accessed through serial monitor are giving a value of zero.

Yes, I saw the schematic, but haven't seen your program.

Here is one of the code that i am testing
#define BRAKEVCC 0
#define CW 1
#define CCW 2
#define BRAKEGND 3
#define CS_THRESHOLD 100

/* VNH2SP30 pin definitions
xxx[0] controls ‘1’ outputs
xxx[1] controls ‘2’ outputs */
int inApin[2] = {7, 4}; // INA: Clockwise input
int inBpin[2] = {8, 9}; // INB: Counter-clockwise input
int pwmpin[2] = {5, 6}; // PWM input
int cspin[2] = {2, 3}; // CS: Current sense ANALOG input
int enpin[2] = {0, 1}; // EN: Status of switches output (Analog pin)

int statpin = 13;

void setup()
{
Serial.begin(9600);

pinMode(statpin, OUTPUT);

// Initialize digital pins as outputs
for (int i=0; i<2; i++)
{
pinMode(inApin*, OUTPUT);*
_ pinMode(inBpin*, OUTPUT);_
_ pinMode(pwmpin, OUTPUT);
}
// Initialize braked*
* for (int i=0; i<2; i++)
{
digitalWrite(inApin, LOW);
digitalWrite(inBpin, LOW);
}
// motorGo(0, CW, 1023);
// motorGo(1, CCW, 1023);
}
void loop()
{
motorGo(0, CW, 1023);
motorGo(1, CCW, 1023);
delay(500);
motorGo(0, CCW, 1023);
motorGo(1, CW, 1023);
delay(500);
Serial.println((cspin[0]);
Serial.println((cspin[1]);_

if ((analogRead(cspin[0]) < CS_THRESHOLD) && (analogRead(cspin[1]) < CS_THRESHOLD))
_ digitalWrite(statpin, HIGH);*_

}
void motorOff(int motor)
{
* // Initialize braked*
* for (int i=0; i<2; i++)*
* {*
_ digitalWrite(inApin*, LOW);
digitalWrite(inBpin, LOW);
}
analogWrite(pwmpin[motor], 0);
}
/ motorGo() will set a motor going in a specific direction_

the motor will continue going in that direction, at that speed
until told to do otherwise.

motor: this should be either 0 or 1, will selet which of the two
motors to be controlled

direct: Should be between 0 and 3, with the following result
0: Brake to VCC
1: Clockwise
2: CounterClockwise
3: Brake to GND

pwm: should be a value between ? and 1023, higher the number, the faster
it’ll go
*/
void motorGo(uint8_t motor, uint8_t direct, uint8_t pwm)
{
* if (motor <= 1)*
* {*
* if (direct <=4)*
* {*
* // Set inA[motor]*
* if (direct <=1)*
* digitalWrite(inApin[motor], HIGH);*
* else*
* digitalWrite(inApin[motor], LOW);*
* // Set inB[motor]*
* if ((direct==0)||(direct==2))*
* digitalWrite(inBpin[motor], HIGH);*
* else*
* digitalWrite(inBpin[motor], LOW);*
* analogWrite(pwmpin[motor], pwm);*
* }*
* }*
}
The Serial monitor is showing simple 0.00.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

You have to READ the analog inputs before you can display them.

 Serial.println(analogRead(cspin[0]));
Serial.println(analogRead(cspin[1]));

Also analogWrite only goes to 255 max.

You also need to add extra capacitance to the CS pins. The capacitor chosen by Sparkfun is too low, so you will get erroneous readings depending on where in the PWM cycle you read the current. 1uF works pretty well to average out the PWM pulses.

Hey there.
I have the same problem, the voltage on the cs pins is constantly zero. Ive checked it with an oszilloskope. So adding the capacitor doesnt change anything.
The motor runs fine and also reading the pwm for motorspeed with my oszilloskope is correct.

The voltage on the chip's CS output can't be zero if the motor is running. Is there a broken wire somewhere? A component missing off the circuit board? A short circuit?

I measured the resistance between cs, ground and the pinout. The values match with the shematics.
I found an thread on a german forum, where the author guesses that the ic is labeled wrong. :o
Since i have 2 monster moto shields with this problem and i found more posts of people having this problem, i think the guy might be right.
Is a wrong labeled ic possible?
(Never say never or something...)

I got good current feedback on all copies of the motor shield that I tested. (2 or 3) I also have the same chip soldered directly to a couple of designs and they work fine too.