Crazy motor test

Dear All,
I use Mc33296 dual motor on wheels.
When I start the serial console, the motor connected to M2 channel of MC33296 start immediately to rotate untill ADC calibration is anded.

Also the motor on channel M2 fails the motor test, it can rotate to forward for 1/2 speed, but it can't rotate reverse for full speed. When the test asks to reverse the motor stop, and restart when I stop the test!!!

To understand could be usefull the console results here below:
resultsconsole.jpg


Could someone tell me which steps I have to do for troubleshooting the problem?

Thank you
 
Hi

First of all, please update to the last SVN version of the code.
Update code will not fix your problem in this case but it would be easier for each others to help you.

Something could be wrong with your wiring. Please double check your wiring.
I had the same result with a broken wire between arduino and IN2 for example. Brand new Chinese wires are sometimes bad..
Check also the D1 and D2 jumper.

Console output is useless with testmotor() since the test is running with STATE OFF and it does not use the speed setpoint.
This is a direct PWM driving without feedback. It must be run when the state is OFF.

Hope this helps you. I am waiting for your feedback.
 
Dear Max,
thank you for your help.
I' using PCB for arduino mega, with SVN software...

I will check the wiring, but I tested motor driver pololu on arduino uno, with test software and a 5V little motor.
I had more or less same problems, I mean difficult to control the direction and speed even the 5V motor.
I would like to check again on arduino uno and test it again!

If the problem will persist I have also another motor driver (spare) at home...I will switch with it.

I will let you know...

Thank you
bye
 
Hi

I remember that first version of the PCB have some problems. Please take a look at this post:
http://ardumower.de/index.php/en/forum/hardware-area/296-ardumower-arduino-mega-shield?start=120#3766
 
I have also encountered a problem of cold joint on the driver pcb. Re-heating the joint with a hot iron until the solder flows fixes the problem. Do the same thing on the ardumower pcb.

Reload factory settings should not fix the problem since the olny parameter used in testmotor() is motorSpeedMaxPwm and this is the same parameter for both motor wheel. Fabio has the problem only for one motor.
 
Dear All,
as I told..I make a test program for Mc33296 Pololu.
Simple forward @55pwm, stop, reverse@55pwm, stop.

and
//void setMC33926(int IN2, int pinPWM, int speed){
// if (speed < 0){
// digitalWrite(IN2, HIGH) ;
// analogWrite(pinPWM, 255-((byte)abs(speed)));
// } else {
// digitalWrite(IN2, LOW) ;
// analogWrite(pinPWM, ((byte)speed));
// }
//}

The results of both channel are ok...here following:

"Connect using
""PLX-DAQ Simple Test""" CHANNEL M2
09:12:20 forward LED 1 IN1[PWM] 50 IN2[DIR] 0 sense[mA] 55,86 fault [1=ok] 1
09:12:22 stop LED 0 IN1[PWM] 1 IN2[DIR] 0 sense[mA] 0,00 fault [1=ok] 1
09:12:24 reverse LED 1 IN1[PWM] 50 IN2[DIR] 1 sense[mA] 83,79 fault [1=ok] 1
09:12:26 stop LED 0 IN1[PWM] 1 IN2[DIR] 1 sense[mA] 0,00 fault [1=ok] 1
09:12:28 forward LED 1 IN1[PWM] 50 IN2[DIR] 0 sense[mA] 93,10 fault [1=ok] 1
09:12:30 stop LED 0 IN1[PWM] 1 IN2[DIR] 0 sense[mA] 0,00 fault [1=ok] 1
09:12:32 reverse LED 1 IN1[PWM] 50 IN2[DIR] 1 sense[mA] 83,79 fault [1=ok] 1

"Connect using
""PLX-DAQ Simple Test""" CHANNEL M1
08:53:32 forward LED 1 IN1[PWM] 50 IN2[DIR] 0 sense[mA] 121,03 fault [1=ok] 1
08:53:34 stop LED 0 IN1[PWM] 1 IN2[DIR] 0 sense[mA] 0,00 fault [1=ok] 1
08:53:36 reverse LED 1 IN1[PWM] 50 IN2[DIR] 1 sense[mA] 65,17 fault [1=ok] 1
08:53:38 stop LED 0 IN1[PWM] 1 IN2[DIR] 1 sense[mA] 0,00 fault [1=ok] 1
08:53:41 forward LED 1 IN1[PWM] 50 IN2[DIR] 0 sense[mA] 37,24 fault [1=ok] 1
08:53:43 stop LED 0 IN1[PWM] 1 IN2[DIR] 0 sense[mA] 0,00 fault [1=ok] 1
08:53:45 reverse LED 1 IN1[PWM] 50 IN2[DIR] 1 sense[mA] 27,93 fault [1=ok] 1

So...it seams Mc33296 works on both channels...It reamin to check wiring again and load factory setup..what else??




Here is the code, if someone need it
I tested it on arduino uno and 5V littlte motor (like the one in start kit of arduino)
WP_20150215_001.jpg


Code:
// this is a pololu motor test

// ----->  SOFTWARE PER MC33296 da SVN versione  <--------
// MC33926 motor driver  //--->QUI 5/01/2015
// Check [URL]http://forum.pololu.com/viewtopic.php?f=15&t=5272#p25031[/URL] for explanations.
//(8-bit PWM=255, 10-bit PWM=1023)
// IN1 PinPWM         IN2 IN2
// PWM                L     Forward
// nPWM               H     Reverse

//void setMC33926(int IN2, int pinPWM, int speed){
//  if (speed < 0){
 //   digitalWrite(IN2, HIGH) ;
 //   analogWrite(pinPWM, 255-((byte)abs(speed)));
 // } else {
 //   digitalWrite(IN2, LOW) ;
 //   analogWrite(pinPWM, ((byte)speed));
 // }
//}

//MC33926: PER motorsense
//resolution 525mV / A
//with 0 A is output also 0V and on AD pin I will read 0
//with 5 A is output 2,625 V and on the AD pin I will read 538
//Esempio:
//5A x 0.525V/A = 2.625V
// il pin leggeraà 2.625V x 1023 / 5V = 538
//NB: gli analog pin leggono 0-1023 0-5V

int pwm;
int ledPin = 13;
int statuspin;
int row=0;   //per il seriale

int IN1 = 11;  //----> IN1   (Pin Input PWM, PWM or -PWM)
int IN2= 7;    //----> IN2   (Pin DIR, L o H)
int pinmotorfault= A4;    //----> M2SF    (fault)
int pinmotorsense= A2;    //----> M2FB    (sense) 525mV/A
int motorPinEn= 8;   //----> EN      (abilita motori)

//letture
int ledStat;
int motorStat;
float senseStat;
float senseAmp;
int faultStat;


void setup()
{
// definizioni 
pinMode(ledPin,OUTPUT);
pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(pinmotorfault,INPUT);
pinMode(pinmotorsense,INPUT);
pinMode(motorPinEn,OUTPUT);


// settaggi iniziali
digitalWrite(ledPin,LOW);   // setto il led spento
digitalWrite(motorPinEn,HIGH);   // non abilito i motori perchè sono su 5V

analogWrite(IN1,0); // setto la velocità nulla iniziale

//contatto con la seriale
  Serial.begin(9600);
}



void loop()
{
// STAMPA TUTTI I VALORI   
row++;  

   if (row>15)
{
row=0;
Serial.println("ROW,SET,2");
Serial.println("CLEARDATA");
}


//FORWARD
pwm=50;
digitalWrite(ledPin,HIGH); //led acceso
digitalWrite(IN2,LOW); //Forward
analogWrite(IN1,pwm);

delay(5);
ledStat=digitalRead(ledPin);
motorStat=digitalRead(IN2);

do {//continua a leggere il valore di corrente fino a che è diverso da 0
senseStat=analogRead(pinmotorsense);
delay(5);
senseAmp = 5*senseStat/1023/0.525*1000; // trasformo in milliAmpere (attenzione: prima divido e poi moltiplico, altrimenti vado fuori con la dimensione della variabile)
} while(senseAmp==0);

faultStat=digitalRead(pinmotorfault);
delay(5);
Serial.print("DATA,TIME,"); Serial.print("AVANTI"); Serial.print(",LED,"); Serial.print(ledStat); Serial.print(",IN1[PWM],"); Serial.print(pwm);Serial.print(",IN2[DIR],"); Serial.print(motorStat);Serial.print(",sense[mA],"); Serial.print(senseAmp);Serial.print(",fault [1=ok],"); Serial.println(faultStat);
faultStat=0;
delay(2000);


//ZERO
pwm=1;
digitalWrite(ledPin,LOW); //led spento
analogWrite(IN1,pwm);

delay(5);
ledStat=digitalRead(ledPin);
motorStat=digitalRead(IN2);

senseStat=analogRead(pinmotorsense);
delay(5);
senseAmp = 5*senseStat/1023/0.525*1000; // trasformo in milliAmpere (attenzione: prima divido e poi moltiplico, altrimenti vado fuori con la dimensione della variabile)

faultStat=digitalRead(pinmotorfault);
delay(5);
Serial.print("DATA,TIME,"); Serial.print("FERMO"); Serial.print(",LED,"); Serial.print(ledStat); Serial.print(",IN1[PWM],"); Serial.print(pwm);Serial.print(",IN2[DIR],"); Serial.print(motorStat);Serial.print(",sense[mA],"); Serial.print(senseAmp);Serial.print(",fault [1=ok],"); Serial.println(faultStat);
faultStat=0;
delay(2000);



//REVERSE
pwm=50;
digitalWrite(ledPin,HIGH); //led acceso
digitalWrite(IN2,HIGH); //Reverse
analogWrite(IN1,255-pwm);

delay(5);
ledStat=digitalRead(ledPin);
motorStat=digitalRead(IN2);

do {//continua a leggere il valore di corrente fino a che è diverso da 0
senseStat=analogRead(pinmotorsense);
delay(5);
senseAmp = 5*senseStat/1023/0.525*1000; // trasformo in milliAmpere (attenzione: prima divido e poi moltiplico, altrimenti vado fuori con la dimensione della variabile)
} while(senseAmp==0);

faultStat=digitalRead(pinmotorfault);
delay(5);
Serial.print("DATA,TIME,"); Serial.print("INDIETRO"); Serial.print(",LED,"); Serial.print(ledStat); Serial.print(",IN1[PWM],"); Serial.print(pwm);Serial.print(",IN2[DIR],"); Serial.print(motorStat);Serial.print(",sense[mA],"); Serial.print(senseAmp);Serial.print(",fault [1=ok],"); Serial.println(faultStat);
faultStat=0;
delay(2000);




//ZERO
pwm=1;
digitalWrite(ledPin,LOW); //led spento
analogWrite(IN1,255-pwm);

delay(5);
ledStat=digitalRead(ledPin);
motorStat=digitalRead(IN2);

senseStat=analogRead(pinmotorsense);
delay(5);
senseAmp = 5*senseStat/1023/0.525*1000; // trasformo in milliAmpere (attenzione: prima divido e poi moltiplico, altrimenti vado fuori con la dimensione della variabile)

faultStat=digitalRead(pinmotorfault);
delay(5);
Serial.print("DATA,TIME,"); Serial.print("FERMO"); Serial.print(",LED,"); Serial.print(ledStat); Serial.print(",IN1[PWM],"); Serial.print(pwm);Serial.print(",IN2[DIR],"); Serial.print(motorStat);Serial.print(",sense[mA],"); Serial.print(senseAmp);Serial.print(",fault [1=ok],"); Serial.println(faultStat);
faultStat=0;
delay(2000);



}

Attachment: https://forum.ardumower.de/data/media/kunena/attachments/1672/WP_20150215_001.jpg/
 
Zuletzt bearbeitet von einem Moderator:
Dear All,
I discovered a cold joint on channel M2...GND was not connected....
I will assemble everything and we will see...

thank you everybody for the helps
 
Oben