Introduction: Arduino Autonomous Vehicle

Picture of Arduino Autonomous Vehicle

This is a car. More coming soon!

Step 1: Cut Out Body.

Cut out a piece of 8th inch (or 16th) plywood. Make sure it has a slit in the middle to accommodate the gears and wheels and that it is large enough to fit everything.

Step 2: Glue on Motor.

Glue on the motor with hot glue.

Step 3: Add Gears and Axles.

Use ring screws that are small enough to be snug on the axle. Screw the ring screws into the wood first, put the gear in between them, and slide in the axle. Make sure the gears are snug enough that they mesh but not too snug that they don't turn. Secure the gears on the axles with hot glue.

Step 4: Attach Wheels to the Axle.

We found 3D printed wheels about the right size. You can 3D print your own or salvage them from a toy car etc.

Drill through the hole in the center of the wheel so that it is snug on the axle. Then, bend part of the axle that remains outside the wheel with two wrenches in a 90 degree bend. The now vertical part of the axle should be parallel with the outside face of the wheel. Glue the vertical part of the axle to the outside face of the wheel with hot glue.

Step 5: Wire Up Relays.

Picture of Wire Up Relays.

Wire up two relays on perfboard (or a breadboard) in the configuration shown.

This configuration allows the motor to spin both directions. When only one green wire is high (connected to the arduino's 5V), one relay switches from ground to high while the other stays at ground. One motor terminal is now connected to 12v while the other is connected to ground. When we connect 5V to the other green wire and connect the first one to ground, the reverse happens. The other relay output is now at 12V while the first one is now connected to ground. This causes the motor to turn the other way. When both green wires are high or both are low, the motor will not spin because both of its terminals are connected to the same voltage.

Step 6: Make Steering System.

Attach any wheel to the front axle (it doesn't have to be firmly secured on the axle this time, but it shouldn't fall off), feed it through the straw, and attach the other wheel to the side of the axle outside of the straw in the same way. After this, hot glue the straw to the servo rotor.

Step 7: Attach Steering System to Body.

Screw the back of the servo to the front of the body with wood screws.

Step 8: Connect Everything Together

Connect the arduino to the two relay wires and to the servo.

Step 9: Make the Case.

Make the case out of cardboard, foam core, wood, whatever! Make sure the on/off switch is screwed on to the case securely and is accessible.

Step 10: Code.

Here's my code.

//////////////////////////////////////////////////////

#include
Servo servo;

int servoPin = 5;

const int RELAY1 = 10;

const int RELAY2 = 11;

const int STRAIGHT = 30, LEFT = 55, RIGHT = 5;

const int FORWARD = 1, BRAKE = 0, BACKWARD = -1;

void setup() {

servo.attach(servoPin);

servo.write(30);

pinMode(RELAY2,OUTPUT);

pinMode(RELAY1,OUTPUT); }

void loop() {

go(1,RIGHT, 500);

go(0,STRAIGHT, 500);

go(-1, LEFT, 500);

go(0, STRAIGHT, 500);

}

void go(int n, int direction, int duration){

servo.write(direction);

if(n == FORWARD){

digitalWrite(RELAY2,HIGH);

digitalWrite(RELAY1,LOW);

}

if(n == BACKWARD){

digitalWrite(RELAY2,LOW);

digitalWrite(RELAY1,HIGH);

} if(n == BREAK){

digitalWrite(RELAY2,LOW);

digitalWrite(RELAY1,LOW);

}

delay(duration);

}

Comments

seamster (author)2016-06-06

Looks good! :)

About This Instructable

330views

2favorites

License:

More by NoahT11:Arduino Autonomous Vehicle
Add instructable to: