Monster Motor Sheild + RC Receiver Control problems

Hi there. I'm working at using a Monster Motor sheild + R/C receiver to get my son's old RC car to move again. It's a pretty big car with a big brushed motor.

I changed the steering servo to a regular R/C steering servo and have that directly plugged into the Receiver. I'm using a 3S lipo battery wired to the single Monster Motor driver and through a 5V buck converter to the Arduino.

I used the code from here for an example on how to do this and changed some stuff around to make it work for a my motor driver and a single motor instead of two.

My code currently looks like this.

/**
 * One Channel Receiver
 * Author: Shawn Hymel (SparkFun Electronics)
 * Date: Aug 17, 2017
 * 
 * Connect a TB6612FNG and RC (PWM) receiver to the Arduino.
 * Only works 1 channel for forward and back drive.
 * 
 * This code is beerware; if you see me (or any other SparkFun 
 * employee) at the local, and you've found our code helpful, 
 * please buy us a round! 
 * Distributed as-is; no warranty is given.
 */

// This sketch was modded by Jonathan 2021 January to work for Black Hummer.


// Controller pins
const int CH_2_PIN = 2;

// Motor driver pins
const int STBY_PIN = A0;
const int AIN1_PIN = 7;
const int AIN2_PIN = 8;
const int APWM_PIN = 5;

#define CURRENT_SEN_1 A2
#define CS_THRESHOLD 200   // Definition of safety current (Check: "1.3 Monster Shield Example")


// Parameters
const int deadzone = 20;  // Anything between -20 and 20 is stop

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

  // Configure pins
  pinMode(STBY_PIN, OUTPUT);
  pinMode(AIN1_PIN, OUTPUT);
  pinMode(AIN2_PIN, OUTPUT);
  pinMode(APWM_PIN, OUTPUT);
  pinMode(CURRENT_SEN_1, INPUT);

  

  // Enable motor driver
  digitalWrite(STBY_PIN, HIGH);

}

void loop() {

  // Read pulse width from receiver
  int ch_2 = pulseIn(CH_2_PIN, HIGH, 25000);
 

  // Convert to PWM value (-255 to 255)
  ch_2 = pulseToPWM(ch_2);

  // Drive motor
  drive(ch_2, ch_2);

  delay(5);
}

// Positive for forward, negative for reverse
void drive(int speed_a, int speed_b) {

  // Limit speed between -255 and 255
  speed_a = constrain(speed_a, -255, 255);
  speed_b = constrain(speed_b, -255, 255);

  // Set direction for motor A
  if ( speed_a == 0 ) {
    digitalWrite(AIN1_PIN, LOW);
    digitalWrite(AIN2_PIN, LOW);
  } else if ( speed_a > 0 ) {
    digitalWrite(AIN1_PIN, HIGH);
    digitalWrite(AIN2_PIN, LOW);
  } else {
    digitalWrite(AIN1_PIN, LOW);
    digitalWrite(AIN2_PIN, HIGH);
  }


  // Set speed
  analogWrite(APWM_PIN, abs(speed_a));
}

// Convert RC pulse value to motor PWM value
int pulseToPWM(int pulse) {
  
  // If we're receiving numbers, convert them to motor PWM
  if ( pulse > 995 ) {
    pulse = map(pulse, 996, 2000, -500, 500);
    pulse = constrain(pulse, -255, 255);
  } else {
    pulse = 0;
  }

  // Anything in deadzone should stop the motor
  if ( abs(pulse) <= deadzone ) {
    pulse = 0;
  }

  return pulse;

}

Everything seems to work perfectly on the bench with tires off the ground. Speed control works perfectly forward and backwards. The problem is when I put it on the ground it seems to choke. When I move everything slowly things work well, but as soon as I punch it a bit to make it accelerate fast it stops and stutters. Sometimes when this happens, I can't revers motor until I gently go forward for a second then everything works normally as long as I don't make it work too hard. This is only one or two second bursts so I don't suspect overheating.

My guess is that it has something to do with current sense, but I've increased that by a lot to see if it makes a difference, I have not seen anything. Is there something missing from my code?

there is a very simple solution to make the RC-car drive again.
Hobbywing quicrun 40a waterproof brushed esc controller for 1/8/10 rc car parts Sale - Banggood.com sold out-arrival notice-arrival notice?

As you already use a standard rc-receiver why don't you use a standard RC brushed-ESC?

best regards Stefan

Well, what's the fun in that? I have the motor driver and arduinos sitting in a drawer here there is 0 cost for me to use it. There is also a learning opportunity for me in this too. After I made that post, I drove around with that hummer for a few minutes with gradual increases in speed. After a while I checked the driver for heat. I noticed that it was very hot. Could not touch for more than a second or so with my finger. I'll add a heat sink to it to see if that clears up some problems. I still think there's something with current sense or code that could be improved.

If you do it for fun. Yes then it is different.
best regards Stefan

The Monster Motor Shield I found says it will deliver 6 amps and just get warm.

Do you know what your motor might draw at more than slow speeds? You may get a surprise when you measure it.

Also the specs on this kind of thing tend to the optimistic. It may well be that 6 amps continuous load would indeed require better heat management.

Do you have any low ohm power resistors you could use to test the board’s real world performance?

Curious also if you lipo voltage sags, what capacity and C rating are they?

I’ll assume you are using wire of an adequate AWG, this does not sound like where you are going wrong.

a7

Wiring is fine. i have 14 AWG from battery plug to my on/Off switch. From the switch to the Driver i went with three copper 16 AWG. That is 3 Black and 3 white. This is a short jumper wire.

The battery is 11.1V 2200mAh 35C.

I'll do some tests on it to see what voltage drop I get with wheels off the ground. I did test with a 2S lipo. I get much better results but still some stuttering and it does not want to switch from forward to backward easily. range is good. Weird stuff.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.