Robot Car Kit

Smart Car Smart Robot Car Chassis Kit Tracking Motor 2WD Ultrasonic

This is my second robot kit, bought from ebay via a local seller. It was bought after a robot arm kit when I looked at what was in the kit, added it up and realised that the camera tilt/pan kit included was worth half the cost of the whole kit, together with all the other components.

The picture shows what I got in the box, and while I fully appreciate what I've got, if someone was buying this as a complete all in one easy to make kit then they would be sending it back. 

Essentials missing are:

  • It needs soldering, wires with clip connectors, indeed, any wires, are not included. This needs to be provided by the constructor.
  • It needs a lot more hardware, nuts, bolts, spacers to fully mount all the components.
  • The chassis is a single laser cut acrylic sheet with mounting holes. 50% of the holes are useful, to mount all the components needs more holes, so being able to drill precision holes is essential.

There are kits costing 4-6 times the price with all the parts included and that provide the same function, but being capable, I'm happy to adapt and save money.

Building this kit had to be done in two stages, one assemble the kit as far as it would go, work out where all the extra mounting holes needed to go, what additional nuts bolts etc were needed and find all the correct wires, then dismantle, make the changes, and reassemble. 

I got the impression that perhaps this was one of a batch of incorrectly configured kits that was cheaper to offload at the cost of the components than to correct. Still, more fun for me, but I've bought another!!!

I did find instructions for assembling a kit using this chassis board here but it uses a different ultrasonic pan unit and a different motor driver board. I also found instruction using these parts but the correct chassis here. This second text is by Stephen A. Edwards who also includes some get you going Arduino code which I've included below.

What I did.

First there are two items that need soldering, motors and switch, one can be done in advance, and one can only be done when partly assembled. To be fair, if you have some push on connectors then you could add them to the wires for the switch and connect them, your choice, but the wires are very fine.

Soldering wires to the motors, supply your own wire. There's no documentation on polarity so both the same colour, I could of bought some other colours but I have a lot of yellow. The connections to the motor are very fine copper and probably wouldn't withstand clipping and unclipping. 

I half built the kit when I realised that the holes weren't going to fit the components. The picture shows the additional 12 holes I had to make to mount the ultrasonic pan/tilt fitting, the motor controller and the Arduino. When assembling, make sure you start with the board the right way round as the Arduino is not symmetrical and can only be mounted on one side once the holes have been drilled. 

Most of the wiring is on the top of the board with only six wires needing to pass through from underneath. A tip I found was to pass the motor wire closest to the board through the rear hole, minor thing but it just reduces strain on the wire. 

Only half of the hardware required was supplied. This picture shows the 8 stand-off posts which I already had and could add to the kit, and these need associated nuts and bolts to go with them. I found that putting these in place at the outset made for easier assembly, it's been together and apart at least three times!

This picture shows the completed underneath assembly and the second soldered joint, to the on/off switch. The basic instructions in the box show how to assemble this part of the kit.

Picture of the assembled upper side of the robot but wiring not completed. I didn't get any instructions on building the pan/tilt assembly, but found very good instructions on Adafruit's website who sell an identical model. Note that the ultrasonic unit is attached by short lengths of wire, not great but I'll get round to making a better attachment eventually. Important point about the pan/tilt, it requires you to modify the servo arms, Adafruit's website gives good instructions on this which are worth checking. I'm sure that eventually I'll add an extra servo to this and mount a camera.

The picture just show the completed robot car wired up. Following is the code initially used to get this working, and has been taken directly from Stephen A. Edwards pdf referenced earlier, with a few minor formatting changes. This code works first time and is a great starting point.



* Firmware for the ”2WD Ultrasonic Motor Robot Car Kit”


* Stephen A. Edwards


* Hardware configuration :

* A pair of DC motors driven by an L298N H bridge motor driver

* An HC􀀀SR04 ultrasonic range sensor mounted atop a small hobby servo


#include <Servo.h>

Servo servo ;

// Ultrasonic Module pins

const int trigPin = 13; // 10 microsecond high pulse causes chirp , wait 50 us

const int echoPin = 12; // Width of high pulse indicates distance

// Servo motor that aims ultrasonic sensor .

const int servoPin = 11; // PWM output for hobby servo

// Motor control pins : L298N H bridge

const int enAPin = 6; // Left motor PWM speed control

const int in1Pin = 7; // Left motor Direction 1

const int in2Pin = 5; // Left motor Direction 2

const int in3Pin = 4; // Right motor Direction 1

const int in4Pin = 2; // Right motor Direction 2

const int enBPin = 3; // Right motor PWM speed control


enum Motor { LEFT, RIGHT };

// Set motor speed: 255 full ahead, -255 full reverse , 0 stop

void go( enum Motor m, int speed)


digitalWrite (m == LEFT ? in1Pin : in3Pin , speed > 0 ? HIGH : LOW );

digitalWrite (m == LEFT ? in2Pin : in4Pin , speed <= 0 ? HIGH : LOW );

analogWrite(m == LEFT ? enAPin : enBPin, speed < 0 ? -speed : speed );


// Initial motor test :

// left motor forward then back

// right motor forward then back

void testMotors ()


static int speed[8] = { 128, 255, 128, 0 ,

-128, -255, -128, 0};

go(RIGHT, 0);

for (unsigned char i = 0 ; i < 8 ; i++)

go(LEFT, speed[i ]), delay (200);

for (unsigned char i = 0 ; i < 8 ; i++)

go(RIGHT, speed[i ]), delay (200);


// Read distance from the ultrasonic sensor , return distance in mm


// Speed of sound in dry air , 20C is 343 m/s

// pulseIn returns time in microseconds (10ˆ-6)

// 2d = p * 10ˆ-6 s * 343 m/s = p * 0.00343 m = p * 0.343 mm/us

unsigned int readDistance ()


digitalWrite ( trigPin , HIGH );


digitalWrite ( trigPin , LOW );

unsigned long period = pulseIn ( echoPin, HIGH );

return period * 343 / 2000;



#define NUM_ANGLES 7

unsigned char sensorAngle[NUM_ANGLES] = { 60, 70, 80, 90, 100, 110, 120 };

unsigned int distance [NUM_ANGLES];

// Scan the area ahead by sweeping the ultrasonic sensor left and right

// and recording the distance observed. This takes a reading , then

// sends the servo to the next angle . Call repeatedly once every 50 ms or so.

void readNextDistance ()


static unsigned char angleIndex = 0;

static signed char step = 1;

distance [angleIndex] = readDistance ();

angleIndex += step ;

if (angleIndex == NUM_ANGLES - 1) step = -1;

else if (angleIndex == 0) step = 1;

servo.write ( sensorAngle[angleIndex] );



// Initial configuration


// Configure the input and output pins

// Center the servo

// Turn off the motors

// Test the motors

// Scan the surroundings once


void setup () {

pinMode(trigPin , OUTPUT);

pinMode(echoPin, INPUT);

digitalWrite ( trigPin , LOW);

pinMode(enAPin, OUTPUT);

pinMode(in1Pin, OUTPUT);

pinMode(in2Pin, OUTPUT);

pinMode(in3Pin, OUTPUT);

pinMode(in4Pin, OUTPUT);

pinMode(enBPin, OUTPUT);

servo.attach ( servoPin );

servo.write (90);

go(LEFT, 0);

go(RIGHT, 0);

testMotors ();

// Scan the surroundings before starting

servo.write ( sensorAngle[0] );

delay (200);

for (unsigned char i = 0 ; i < NUM_ANGLES ; i ++)

readNextDistance (), delay (200);



// Main loop:


// Get the next sensor reading

// If anything appears to be too close , back up

// Otherwise, go forward


void loop () {

readNextDistance ();

// See if something is too close at any angle

unsigned char tooClose = 0;

for (unsigned char i = 0 ; i < NUM_ANGLES ; i++)

if ( distance [ i ] < 300)

tooClose = 1;

if (tooClose) {

// Something's nearby: back up left

go(LEFT, -180);

go(RIGHT, -180);

} else {

// Nothing in our way: go forward

go(LEFT, 255);

go(RIGHT, 255);


// Check the next direction in 50 ms

delay (50);