Motor Spark Issue with Arduino and Turbo Racing TP-TX2 Transmitter

Hello everyone,
I’m experiencing an issue with my GoBuilda motors when using them with an Arduino. My transmitter is a Turbo Racing TP-TX2. The problem is that the motor starts producing sparks after running for about 30 to 40 seconds, even when the speed is constant. This issue also occurs at lower speeds.
I’ve tried calibrating the throttle and steering, but the problem persists. I would greatly appreciate any advice or suggestions from the community on how to resolve this, whether it’s through software adjustments or additional components.
Thank you so much in advance for any help or insights!
And this is my code:


// Motor 1 (Left) Pins
const int ENA = 5;  
const int IN1 = 6;  
const int IN2 = 7;  

// Motor 2 (Right) Pins
const int IN3 = 8;  
const int IN4 = 9;  
const int ENB = 10; 

// Receiver Pins
const int chThrottlePin = A2; // CH2 (Trigger)
const int chSteerPin =    A3; // CH1 (Wheel)

// --- CALIBRATION SETTINGS ---
const int centerThrottle = 1385; // Your calibrated center for Throttle
const int centerSteer    = 1500; // Standard center for Steering (Adjust if needed)
const int maxSpeed       = 20;   // Speed limit (20%)

void setup() {
  pinMode(ENA, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(ENB, OUTPUT);
  
  pinMode(chThrottlePin, INPUT);
  pinMode(chSteerPin, INPUT);
  
  Serial.begin(9600);
}

void loop() {
  // 1. Read Signals
  int rawThrottle = pulseIn(chThrottlePin, HIGH);
  int rawSteer    = pulseIn(chSteerPin, HIGH);

  // Safety: If receiver disconnected, stop
  if (rawThrottle < 500 || rawSteer < 500) {
    stopMotors();
    return;
  }

  // 2. Map Throttle (Using your 1385 Center)
  int throttle = 0;
  if (rawThrottle >= centerThrottle) {
    throttle = map(rawThrottle, centerThrottle, 2000, 0, maxSpeed);
  } else {
    throttle = map(rawThrottle, 1000, centerThrottle, -maxSpeed, 0);
  }

  // 3. Map Steering
  // We use standard 1000-2000 mapping. If steering is inverted, swap -50 and 50.
  int steering = map(rawSteer, 1000, 2000, -maxSpeed, maxSpeed);

  // 4. Deadzones (Ignore small jitters)
  if (abs(throttle) < 5) throttle = 0;
  if (abs(steering) < 5) steering = 0;

  // 5. MIXING (Arcade Drive)
  int leftMotor  = throttle + steering;
  int rightMotor = throttle - steering;

  // 6. Constrain (Keep speed within allowed limits)
  leftMotor  = constrain(leftMotor,  -maxSpeed, maxSpeed);
  rightMotor = constrain(rightMotor, -maxSpeed, maxSpeed);

  // 7. Drive Motors
  driveMotor(1, leftMotor);
  driveMotor(2, rightMotor);

  // Debugging
  Serial.print("RawStr: "); Serial.print(rawSteer);
  Serial.print(" | L: "); Serial.print(leftMotor);
  Serial.print(" | R: "); Serial.println(rightMotor);
}

// --- Helper to Drive Specific Motor ---
void driveMotor(int motorID, int speed) {
  int pinPWM, pinA, pinB;

  // Select Pins
  if (motorID == 1) { pinPWM = ENA; pinA = IN1; pinB = IN2; } // Left
  else              { pinPWM = ENB; pinA = IN3; pinB = IN4; } // Right

  if (speed > 0) {
    // Forward
    digitalWrite(pinA, (motorID == 1) ? HIGH : LOW); // Motor 1 High/Low
    digitalWrite(pinB, (motorID == 1) ? LOW : HIGH); // Motor 2 Low/High
    analogWrite(pinPWM, speed);
  } 
  else if (speed < 0) {
    // Reverse
    digitalWrite(pinA, (motorID == 1) ? LOW : HIGH);
    digitalWrite(pinB, (motorID == 1) ? HIGH : LOW);
    analogWrite(pinPWM, abs(speed));
  } 
  else {
    // Stop
    digitalWrite(pinA, LOW);
    digitalWrite(pinB, LOW);
    analogWrite(pinPWM, 0);
  }
}

void stopMotors() {
  driveMotor(1, 0);
  driveMotor(2, 0);
}

That sounds alarming but the commutator in DC motors often produces some rather small sparking.

You can wait and hope a helper knowing the devices You use. If You post links to datasheets and technical manuals a more helpers would pick up Your post. Posting schematics might be important too.

Please tell us EXACTLY where the sparks come from! Show us the data sheets for the motor. Does the motor have brushes and are the sparks from the brushes? If the motor is a 3-phase DC motor with internal electronics and produces sparks, then you need new motors.

Sounds like a product of a lot of volts and amps. What voltage are the motors (12vdc)? What voltage is the power supply? Are you using a GoBuilda motor controller?

The voltage i’m using is 24v 6s Lipo battery
No, I didn’t use the gobilda controller i’m using a h-bridge dual channel 100a and i want to control it using a arduino mega and the transmitter

The sparks from the brushes and it doesn’t the usual small spark its a big spark but not continuous its a pulse every 10 sec or 7sec
Its a 2 phase motor

I think the spark from the high current pulse but I don’t know the high current come from

Wow, that is very unusual. Your code however is apparently for two DC motors.

Hi, @samih317
Welcome to the forum.

Can you post a link to data/specs of the motor please?

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Have you go a fuse in the power line from the Lipo battery?

What H-Bridge are you using?

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

Do all the motors do the same? That appears to be caused by some stray conductive material on the motor armature that makes contact with a brush as the motor turns. Can you do a resistance measurement of the motor as you manually turn the armature?

After the motors sparks, the motor recovers, increases RPM, then at the right RPM, metal parts clash. Measure RPM of spark and stay below it.

Yes all the motors the same
I try the motor directly to the battery and it’s run normally without any problem

VIDEO-2026-01-09-14-15-01.zip (1.1 MB)

This is the video for the problem
Its a rar file

When did you decide to use the controller you are using with the motors?


Its a dual motor driver

How did you decide the motors and the controller will work together? This seems more like an RC car issue with motor/motor-controller compatibility than an Arduino control signals issue.

Maybe it can be solved in the code... What max/idle/min raw values are rawThrottle and rawSteering giving?

For throttle:
Max : 1988
Idle : 1410
Min : 1003

For steering:
Max : 1988
Idle : 1499
Min : 1003

I don’t the enough knowledge abut the motors and controllers but I think its compatible to each other

What are the Motor Controller INPUT pins (10 of them) labeled?
Where do you connect Arduino ENA, IN1, IN2, ENB, IN3, IN4 to Motor Controller pins?

What are the Motor Controller OUTPUT pins (6 of them) labeled?
Where do you connect the Motor Controller 6 terminal lugs to the two motor wires?

If you disconnect the motors from the motor controller and use the Arduino sketch (commanded by the remote device) to steer and accelerate the Motor Controller, what DC volt output do you measure (min/idle/max) of the motor controller?

Is the Motor Controller outputting PWM/PCM?

Hi, @samih317
Is this your motor driver?

Where are the following connections?

const int ENA = 5;  
const int IN1 = 6;  
const int IN2 = 7;  

// Motor 2 (Right) Pins
const int IN3 = 8;  
const int IN4 = 9;  
const int ENB = 10; 

// Receiver Pins
const int chThrottlePin = A2; // CH2 (Trigger)
const int chSteerPin =    A3; // CH1 (Wheel)

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Can you post some images of your project?
So we can see your component layout.

These bit of information are very important if you want proper answers to your problem.

Tom.... :smiley: :+1: :coffee: :australia: