Elegoo Smart Car Issues

I am new to the arduino universe, so please be patient.
I am trying to get Elegoo Smart Car v4.0 to work with the code as shown in the "Elegoo Smart Car Issues" post from Apr 20.

When I upload the 'factory sketch', I can controll the car using the provided remote without issues. Therefore I assume, that the hardware assembly is correct. My own sketch runs without errors and the tutorial I am following suggests, that it is working with Smart Car V3. However, it does not do anything with the V4 Car. My basic assumption is, that some pins have changed, but I am unable to find a mapping by looking at the SmartCar Shield and I couldnt find any data sheet. Did anyone get this to work?

For reference I added the code again, but be aware that it has already been veryfied by the thread I referred to above. I only added some print statements for debugging.

int ENA=5;
int ENB=6;
int IN1=7;
int IN2=8;
int IN3=9;
int IN4=11;

void setup() {
    // setup code
    pinMode(ENA,OUTPUT);
    pinMode(ENB,OUTPUT);
    pinMode(IN1,OUTPUT);
    pinMode(IN2,OUTPUT);
    pinMode(IN3,OUTPUT);
    pinMode(IN4,OUTPUT);
    // enable motors
    digitalWrite(ENA,HIGH);
    digitalWrite(ENB,HIGH);
}
 
void loop() {
    Serial.begin(9600);
    Serial.println("Running Actions");
      // Right Turn
    digitalWrite(IN1,HIGH);
    digitalWrite(IN2,LOW);
    digitalWrite(IN3,HIGH);
    digitalWrite(IN4,LOW);
    Serial.println("right");
    delay(1000);
    //Left Turn
    digitalWrite(IN1,LOW);
    digitalWrite(IN2,HIGH);
    digitalWrite(IN3,LOW);
    digitalWrite(IN4,HIGH);
    Serial.println("left");
    delay(1000);
    //forward
    digitalWrite(IN1,HIGH);
    digitalWrite(IN2,LOW);
    digitalWrite(IN3,LOW);
    digitalWrite(IN4,HIGH);
    Serial.println("back");
    delay(1000);
    //backwards
    digitalWrite(IN1,LOW);
    digitalWrite(IN2,HIGH);
    digitalWrite(IN3,HIGH);
    digitalWrite(IN4,LOW);
    Serial.println("Forward");
    delay(1000);
    Serial.println("Done");

    while (true) {
        // stop here
    }
}

If your V4 does not do anything (not even print "Running Actions") then the physical wiring needs to be checked and corrected... all components, wires and the power supply.

Draw an annotated Schematic as you have wired it, I think you will find the problem before it is finished. If not post that schematic with links to the hardware items.

Ok, I stand corrected. By 'does not do anything' I was referring to the fact that it does not move. It however prints all the print statements.

The wiring is correct. Using the factory sketch it is doing all expeced moves like forward, backward, left, right.

You should post factory sketch and your sketch for comparison.

Since it is wired correctly and the code works there is nothing more I can do to help you.

are you able to show both factory and your own sketch?

Thanks to anyone looking at this. However, I believe this question can only be answered by someone who actually did build this car and got the code to work. The answer I am looking for is one of either

  1. here is the new pin mapping,
  2. here is the Schematic for the elegoo car shield or
  3. can´t be done with V4

The reason I opened this thread was to find out if anyone has found a solution to the original problem as it was stated under the "Elegoo Smart Car Issues" post from Apr 20. In this post, the coding was already discussed. However the actual question was never answered. I was told not to 'hijack' that original thread, so I opened this one.

I can not show you the wiring, since this is done through a shield from ELEGOO and posting the 'factory sketch' would not help, since it only contains an entrypoint for elegoos library code. I searched the library code, but couldn't find anything there either.

?

Your user manual shows a dozen connections ("pages" 17, 18 and 20).

You should post the sketches, and a photo showing the connections. The greatest common factor in all failures is human interaction. One missing or extra "anything" will be the difference of works/non-works.

I will deduce from this thread and the other that you were not cooperative to allow assistance to flow both ways (to you, from you). Let's get your projects working, here, now.

Take your Elegoo Smart Car and visit a local Makers Workshop with it to get better help.

solution

1 Like

First, apologies to everyone who lost time trying to help me on this. I should have spent more time investigating all aspects before asking the question. If my comments sounded rude I apologise again. It was not my intention to upset anyone.

So,it turns out that ELEGOO changed the motor driver between V3.0 and V4.0 from a L298N to a TB6612FNG, which behaves very similarly but shows some minor differences and therefore requires some updates to the sketch. For any other arduino beginner who stumbles upon this, here is my working update based on some sample code I found within the ELEGOO lib files. It moves forward, right, left, backward with 3s duration each. Although this sketch works well with the V4.0 car, please note that it just reflects my current understanding of that driver. There might be things missing.

// Test to move forward, right, left, backward with 3s duration each. 
// Although this sketch works well with the V4.0 car, please note that it just reflects 
// my current understanding of that driver. There might be things missing.
// 2023-08-17

//enable (I guess)
#define PIN_Motor_STBY 3

// motorA
#define PIN_Motor_PWMA 5
#define PIN_Motor_AIN_1 7

// motorB
#define PIN_Motor_PWMB 6
#define PIN_Motor_BIN_1 8


void pin_setup(void)
{

  pinMode(PIN_Motor_PWMA, OUTPUT);
  pinMode(PIN_Motor_PWMB, OUTPUT);
  pinMode(PIN_Motor_AIN_1, OUTPUT);
  pinMode(PIN_Motor_BIN_1, OUTPUT);
}

void test_forward_right_left_backward(uint8_t speed_A, uint8_t speed_B)
{
  //enable
  digitalWrite(PIN_Motor_STBY, HIGH);
  // forward
  digitalWrite(PIN_Motor_AIN_1, HIGH);
  analogWrite(PIN_Motor_PWMA, speed_A);
  digitalWrite(PIN_Motor_BIN_1, HIGH);
  analogWrite(PIN_Motor_PWMB, speed_B);
  delay(3000);
  // right
  digitalWrite(PIN_Motor_AIN_1, LOW);
  analogWrite(PIN_Motor_PWMA, speed_A);
  digitalWrite(PIN_Motor_BIN_1, HIGH);
  analogWrite(PIN_Motor_PWMB, speed_B);
  delay(3000);
  // left
  digitalWrite(PIN_Motor_AIN_1, HIGH);
  analogWrite(PIN_Motor_PWMA, speed_A);
  digitalWrite(PIN_Motor_BIN_1, LOW);
  analogWrite(PIN_Motor_PWMB, speed_B);
  delay(3000);
  // backward
  digitalWrite(PIN_Motor_AIN_1, LOW);
  analogWrite(PIN_Motor_PWMA, speed_A);
  digitalWrite(PIN_Motor_BIN_1, LOW);
  analogWrite(PIN_Motor_PWMB, speed_B);
  delay(3000);
  //disable
  digitalWrite(PIN_Motor_STBY, LOW);
}

void setup() {
    // setup code
    Serial.begin(9600);
    pin_setup();
}
 
void loop() {
    test_forward_right_left_backward(50, 50);
    Serial.println(".");

    while (true) {
        // stop here
    }
}

Thank you!
I am also new here & have been struggling with the very same problem.
Very helpful.

Hello @wiltonkirk - It is good to read similar topics to help yourself... I learn (often) when I have problems, the more I read, the closer I get to solving my own issues (but I still need help).

Side note: If you want help on your project, please, start your own topic so you get all the help you need. (posting a request for help on someone else's topic is not allowed). Comments are always allowed.

Hi xfpd,
I mostly figure this stuff out by myself.
In this case, you definitely saved me some time.
But mostly, I am just amazed how much flack you took for a simple question .
Just uncalled for, imo.
But thank you again.
Cheers

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