SainSmart Car Kit Instructions

Introduction: SainSmart Car Kit Instructions

These instructions are for the wiring for the SainSmart C98 on the inside of the car.  This product could be found on Amazon for around $90.  The SainSmart Kit did not come with sufficient instructions, so I decided to post some.  Follow the Wire Diagram above when following each of the steps for wiring.

The materials in the kit include:
     - Arduino Mega
     - Distance Sensor
     - L298N Module (Driver Module)
     - SainSmart Sensor Shieldv5.0
     - Various wires
     - Toggle Switch
     - Charging Interface
     - Four Motors and Wheels
     - Power Supply Box
     - Metal Pieces and various nuts and bolts
Other materials needed are:
     - Electrical tape
     - Screw Driver

Step 1: Wiring the Charge Switch

     Follow the wiring diagram shown.  When wiring the charge switch strip the wires and wrap the stripped ends around the hole in the metal prong. After looping the wire in the hole wrap electrical tape around the wire and prong (as seen in the second picture down).  If any of these wires make contact with each other it could start an electrical fire (it made a small one with me).
     Also, when connecting the wires from the battery pack to the Switch and Charging Socket make sure to use the wires that are coming out of the battery pack, so you do not have to do any extra taping with the electrical tape.

Step 2: Connecting the Switch to the L298N Module

     When, connecting the switch to the L298N Module start by unscrewing the screw and slide the stripped wire into the slot underneath where the screw was and then tighten the screw again.

Step 3: Connecting the L298N to the Shield

     Start by Snapping the Sensor Shield into the Arduino Uno or Mega (seen in the first picture).  Then use the Female-Female wires to connect the IN1 to IN4 to the pins shown in the top wire diagram.  Connect IN1 to D7, IN2 to D5, IN3 to D4, and IN4 to D2.  Then connect the VCC and GND on the Sensor Shield to the 5V and GND on the L298N.

Step 4: Connecting the Motors to the L298N

     To connect each motor to the L298N Module take a red wire and connect it from OUT1 to a prong on the motor.  Then connect a black wire from OUT2 to the other prong on the motor.  Do this for the other motor by connecting the red and black wires to the OUT3 and OUT4.

Step 5: Coding for the Motors

To get the code to work you must first go through these steps:
     1. Go to
     2. Click on "First, grab the library from github" and download the "" file
     3. Go to Libraries --> Documents --> Arduino --> libraries and then drag the zip file in
     4. Unzip the file and rename the new unzipped file "AFMotor" (or something you will remember)
     5. Close and reopen the Arduino Software (if already open)
     6. Go to Scetch --> Import Library --> AFMotor

Then copy this code to test if the wheels work :

//declaring the pins for the IN pins on the L298N
const int rightForwardPin = 4;
const int rightBackwardPin = 2;
const int leftBackwardPin = 7;
const int leftForwardPin = 5;

int runTime = 5000;

void setup() {
  //Stating that the pins are OUTPUT
  pinMode(rightForwardPin, OUTPUT);
  pinMode(rightBackwardPin, OUTPUT);
  pinMode(leftForwardPin, OUTPUT);
  pinMode(leftBackwardPin, OUTPUT);

//Looping to test the wheels of the car
void loop() {


//Setting the wheels to go forward by setting the forward pins to HIGH
void forward(){
  digitalWrite(rightForwardPin, HIGH);
  digitalWrite(rightBackwardPin, LOW);
  digitalWrite(leftForwardPin, HIGH);
  digitalWrite(leftBackwardPin, LOW);

//Setting the wheels to go backward by setting the backward pins to HIGH
void backward(){
  digitalWrite(rightForwardPin, LOW);
  digitalWrite(rightBackwardPin, HIGH);
  digitalWrite(leftForwardPin, LOW);
  digitalWrite(leftBackwardPin, HIGH);

//Setting the wheels to go right by setting the rightBackwardPin and leftForwardPin to HIGH
void right(){
  digitalWrite(rightForwardPin, LOW);
  digitalWrite(rightBackwardPin, HIGH);
  digitalWrite(leftForwardPin, HIGH);
  digitalWrite(leftBackwardPin, LOW);

//Setting the wheels to go left by setting the rightForwardPin and leftBackwardPin to HIGH
void left(){
  digitalWrite(rightForwardPin, HIGH);
  digitalWrite(rightBackwardPin, LOW);
  digitalWrite(leftForwardPin, LOW);
  digitalWrite(leftBackwardPin, HIGH);

//Setting the wheels to go stop by setting all the pins to LOW
void stopCar(){
  digitalWrite(rightForwardPin, LOW);
  digitalWrite(rightBackwardPin, LOW);
  digitalWrite(leftForwardPin, LOW);
  digitalWrite(leftBackwardPin, LOW);

Then modify the code to make your robot work with distance sensors or other sensors.

Step 6: If the Motor Is Not Working

If the motor is not moving after connecting everything do the following:
     - Check to see if the button next to the VCC, GND, and  5V side f the L298N is pushed down because if it is not the circuit will not             be on
     - Recheck the circuit with the Wire Diagram at the top of this page
     - Check to see if you,re batteries have enough power 
     - Check that the code is correct
     - Make sure you were on the right COM when downloading the code

Some References:
     - At the following site I found the code that worked for the car,+MOTOR34_1KHZ);



    • Water Contest

      Water Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Tiny Home Contest

      Tiny Home Contest

    9 Discussions

    how to place the obstacle sensor on the car?

    thank you

    If it works for you without the adafruit library feel free to not call it, but this is just how it worked for me.

    I'm pointing out that you aren't using the adafruit library. You call it, but then don't use it. Was wondering why you bothered to include it.

    The wiring is really tricky for the car, but I know that it is correct because I made a working car. So, you should recheck all the wire diagrams with the circuits you have. Also, make sure that the charging socket is correct (if you do that backwards it does not work). Good luck.

    3 replies

    The Sainsmart Car Kit comes with 4 motors. The instructions show wiring to the L298N Module for 2 motors only. The L298N Module only has outputs for 2 motors. How did you make it work? Where do you hook up the remaining 2 motors? If you truly made a working car please tell us how you did it.

    You feed the other two motors into the same outputs as the first two (so the two motors on the right go into the closer output on the L298N and the ones on the left go into the same one closest to them). Sorry I did not have this in the diagram. Let me know if you have any other questions.

    Ok, that makes sense. Thanks for the clarification. I had thought of that but didn't know if the L298N outputs could handle the extra current.