I just started testing out my TReX Jr on my Arduino this evening. Everything was working fine until I increased the motor speed from 50 to 120. It ran fine for a few seconds, then just died. No lights come on and it’s definitely got a burnt smell coming from it. I’m sure it’s dead, but I’ll need one ASAP and want to know what I might have done wrong as to not repeat it.
Not sure where to begin describing my setup, so I’ll start with my Arduino code:
#include <SoftwareSerial.h>
#define txPin 4
#define rxPin 5
SoftwareSerial pololu(rxPin, txPin); // Setup TReX communication
const int Fwd = 217; // 0xDA Forward both motors
const int Rev = 214; // 0xD5 Reverse both motors
const int Brake = 208; // 0xD0 Brake both motors
const int rLeft = 218; // 0xD9 Motor1 reverse, Motor2 forward
const int rRight = 213; // 0xD6 Motor1 forward, Motor2 reverse
const int tLeft = 216; // 0xD8 Motor1 brake, Motor2 forward
const int tRight = 209; // 0xD2 Motor1 forward, Motor2 brake
void setup(){
Serial.begin(9600);
pololu.begin(19200);
}
void loop(){
Drive(Fwd,120,120);
Serial.println("Forward");
delay(5000);
Drive(Brake,0,0);
delay(1000);
Drive(Rev,120,120);
Serial.println("Reverse");
delay(5000);
Drive(Brake,0,0);
delay(1000);
}
void Drive(int dir, int motor1, int motor2){
pololu.write(dir);
pololu.write(motor1);
pololu.write(motor2);
Serial.print("Direction: ");
Serial.print(dir);
Serial.print(" Command: ");
Serial.println(dir);
Serial.print("Motor 1: ");
Serial.print(motor1);
Serial.print(" Motor 2: ");
Serial.println(motor2);
}
The motors I’m driving are the 50:1 Metal Gearmotor 37Dx54L mm with 64 CPR Encoder ([url]Pololu - 50:1 Metal Gearmotor 37Dx54L mm 12V with 64 CPR Encoder (No End Cap)).
- M1 A/B & M2 A/B connected to the red/black wires on the motors.
- Vin/Gnd to 11.1v Li-Ion battery pack.
- Arduino Pins 4/5 to the TReX Jr Rx/Tx, respectively
- Tx/Rx Gnd to Arudino and battery pack ground
- The motors were not connected to anything (no load)
As I said, initially I was running the motors at speed 50 very well for about 15-20 min while I was testing out the different motor commands.
Drive(Fwd,50,50);
Serial.println("Forward");
delay(5000);
Drive(Brake,0,0);
delay(1000);
Drive(Rev,50,50);
Serial.println("Reverse");
delay(5000);
Drive(Brake,0,0);
delay(1000);
But shortly after changing the speed to 120 (as in my original code) the TReX’s lights went out and began smelling burnt. I left it to cool for an hour or so (until it was room temp to the touch), then connected it back as described above with no luck. Instantly it started heating up again and the burning smell came back.
Per the TReX and motor’s specs, the TReX should handle 2.5A per channel and the motors only have a free-run current draw of 300 mA, so I don’t see how I could have overloaded it, even just increasing the speeds, but it seems that’s what happened.
Not sure what I did wrong here, any ideas/suggestions?