Posted on

Arduino – Spare Parts Robot Car Prototype

Arduino Robot Car

Last night I was pretty bored, so I decided to build a simple robot car. I’ve only put a few hours of work into it so far, but it drives and steers! Sort of.

This slideshow requires JavaScript.

 

 

Parts used:

1x Arduino Nano

1x LiPo Battery

2x TIP120 Transistor

1x Servo Motor

1x DC Motor Gearbox

2x 2k Resistors

1x Breadboard

4x Wheels

 

The TIP120 transistor was only used because I had a bag of them within arms reach. The TIP120 works fine for this application, but it is inefficient and has lots of drawbacks. A FQP30n06l is much better for this application.

 

Schematic:

Schematic View of Car Circuit
Schematic View of Car Circuit

Code:

Literally all this code does is make the car accelerate gradually and wiggle the steering.

#include <Servo.h>
Servo steering;
int driveMotor = 3; //Digital 3 used for TIP120 on drive motor
int steerMotor = 6; //Digital 6 used for TIP120 on steering servo
void setup() {
    steering.attach(9); //Attach the Servo motor to digital PWM pin 9
}

void loop() {
    analogWrite(steerMotor, 255); //Turns the TIP120 on for the steering servo
    steering.write(90); //Sets the steering to 90 deg
    delay(250); //Waits a bit, for the servo to get to place
    analogWrite(steerMotor, 0); //Turns off the TIP120 to the servo
    analogWrite(driveMotor, 255); //Turns on the drive motor

    for (int i=80; i<=255; i++){  
        delay(25);
        analogWrite(driveMotor, i); //Gradually accelerates by switching TIP120, starting at 80/255
    }
    
    delay(250);
    analogWrite(driveMotor, 0); //Turns off the drive motor
    analogWrite(steerMotor, 255); //Turns the TIP120 on for the steering servo
    steering.write(45); //Sets the steering to 45 deg
    delay(250); //Waits a bit, for the servo to get to place
    steering.write(135); //Sets the steering to 135 deg
    delay(500); //Waits a bit, for the servo to get to place
    analogWrite(steerMotor, 0); //Turns off the TIP120 for the steering servo
}

Design:

The body of the vehicle is a 94:1 gearbox and the DC motor that drive the rear wheels. I attached a breadboard to the top of the gearbox to hold the circuitry. The servo motor responsible for steering is mounted on the front of the gearbox, and a 3D printed bracket holds the front wheels to the servo horn. It’s a pretty poor steering system, to be honest. I used zip ties and double-sided tape to keep everything stuck together.

Frame Design
Frame Design

The front wheels are some old attempts at Emmets Bearings that I found in my failed print bin. They spin well, but are awfully ugly. I designed the rear wheels myself using 3DS Max.

Rear Wheel Design
Rear Wheel Design

The obvious next step is to add a dedicated supply for the Arduino, so that the car is completely independent. It also needs basic wireless control; I’ll likely use IR. It also needs an actual frame and some proper wiring… and a lot more. It’s a work in progress.

 

 

 

 

Leave a Reply