Introduction: Argus

Argus is my first attempt to take an RC car and turn it into a drone or an autonomous vehicle.

In this inscrutable I will be using the following parts: Old RC car

Leds $4.01

Arduino Uno

Ultra Sonic Sensor $6.65

Motor Drive 2 Channel $5.65

Solder & Soldering Iron $16.99

Proto Board $3.99

Wires $6.00

9v battery

6v 5500mah___ battery pack $20.00 made at local battery shop

small Phillips and Flathead screw driver

Step 1: Concept Behind Argus and Plan

Program Ardunio to drive Argus and new body.

Forward, Reverse, Left or Right to Avoid objects.

Work on 3d printing a new shell Concept planning using sketch up .

Step 2: Body Frame and Conponents

The front of the RC has a steering solenoid and the rear has a rear steering motor.

The ultra sonic sensor send out sonar sound that pings and it then determines the distance for the sound of the ping.

The drive motor steers the front and send voltage and amps to the rear to drive it.

The nine volt battery is the led so they can be powered separate for the RC.

Step 3: Programing

the coding that I used is one from

Jesper Birk

// autonomous car
// Created by Jesper Birk - 2014

int motorPin1 = 6; // motor wire connected to digital pin 5
int motorPin2 = 5; // motor wire connected to digital pin 6
int motorPin3 = 7; // steering motor wire connected to digital pin 7
int motorPin4 = 8; // steering motor wire connected to digital pin 8

int steeringMotorSpeed = 150; // Set default power to send to steering motor

int avoidDistance =25;
int endAvoidDistance = 30;

int goToReverseDistance =45;
int reverseTime = 2000;

int fullTrottleMinDistance =150;

int fullTrottleSpeed = 220;
int cruiseSpeed = 160;
int avoidSpeed = 120;
int reverseSpeed = 130;

int sensorDelay = 100; //

long randNumber;
int avoidDirection = 1;
int avoidCirclesBeforeDirectionChange = 10;
int countDown = 1;
int distanceCountDown = 1;

#include "Ultrasonic.h"
Ultrasonic ultrasonic(12,13);

int distance = (ultrasonic.Ranging(CM));

// The setup() method runs once, when the sketch starts

void setup() {

// initialize serial communication at 9600 bits per second:
Serial.begin(9600);

randomSeed(analogRead(0));

// initialize the digital pins as an output:
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
}

//////////// LOOP ////////////

void loop()
{
// Serial.println("start loop ");

// Serial.println(ultrasonic.Ranging(CM));

//choseMode();

distance = (ultrasonic.Ranging(CM));

//////////// REVERSE MODE ////////////
if(distance <= goToReverseDistance){
avoidDirection = avoidDirection * -1;

// while(distance < avoidDistance) {
// Serial.println("start reverse ");
if(avoidDirection == 1){ // turn one way
analogWrite(motorPin3, steeringMotorSpeed);
digitalWrite(motorPin4, LOW);
} else { // ... or the other way
analogWrite(motorPin4, steeringMotorSpeed);
digitalWrite(motorPin3, LOW);
}
analogWrite(motorPin2, reverseSpeed); //rotates motor - backwards
digitalWrite(motorPin1, LOW);
delay(reverseTime); // for time set in reverseTime
// delay(sensorDelay);
distance = (ultrasonic.Ranging(CM));
// }


digitalWrite(motorPin2, LOW); // stop motors
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);


avoidDirection = avoidDirection * -1; // switch steering direction

distance = (ultrasonic.Ranging(CM));
}
///////////////////////////////////////////////

/////////// AVOID MODE ////////////

distance = (ultrasonic.Ranging(CM));

if(distance < avoidDistance){
// Serial.println("start avoid ");

distance = (ultrasonic.Ranging(CM));
countDown = avoidCirclesBeforeDirectionChange;
distanceCountDown = distance;

while(distance <= endAvoidDistance && distance > goToReverseDistance){
if(avoidDirection == 1){
analogWrite(motorPin3, steeringMotorSpeed); // turn one way
digitalWrite(motorPin4, LOW);
} else {
analogWrite(motorPin4, steeringMotorSpeed); // or turn the other way
digitalWrite(motorPin3, LOW);
}

analogWrite(motorPin1, avoidSpeed); //rotates motor
digitalWrite(motorPin2, LOW); // set the Pin motorPin2 LOW
delay(sensorDelay);
distance = (ultrasonic.Ranging(CM));
if(distance < distanceCountDown) { countDown--; } // if obstacle is getting closer - count down to changing direction
if(countDown < 1) {
avoidDirection = avoidDirection * -1; // switch steering direction
countDown = avoidCirclesBeforeDirectionChange;
distanceCountDown = distance;
}
// Serial.println(distance);
// Serial.println(avoidDirection);
} // end while (avoid)
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
}
///////////////////////////////

/////////// CRUISE MODE ////////////
distance = (ultrasonic.Ranging(CM));
while(distance > avoidDistance && distance < fullTrottleMinDistance){
analogWrite(motorPin1, cruiseSpeed); //rotates motor
digitalWrite(motorPin2, LOW); // set the Pin motorPin2 LOW
delay(sensorDelay);
distance = (ultrasonic.Ranging(CM));
// Serial.println("cruise");
// Serial.println(distance);
} // end while
//////////// FULL SPEED MODE ////////////
distance = (ultrasonic.Ranging(CM));
while(distance > fullTrottleMinDistance){
analogWrite(motorPin1, fullTrottleSpeed); //rotates motor
digitalWrite(motorPin2, LOW); // set the Pin motorPin2 LOW
delay(sensorDelay);
distance = (ultrasonic.Ranging(CM));
// Serial.println("FULL");
// Serial.println(distance);
} // end while

// Serial.println("REstart loop ");
// Serial.println(distance);

}

Step 4: Issues and Solutions

At the very beginning I was using a Parallax ping sensor. I played around with the code and got it to where I didn't need to use any library. I would get it to reverse and go forward but when it got to full throttle mode it would get stuck. After several days I ended ordering the same sensor used by the other inventor.

I was not able to at first get the code to work so I had to make sure that I had all the need libraries attached to the file. You must make sure that you have the Ultra Sonic library added to the file so that it is able to draw the code correctly.

"Ultrasonic.h" library to search for.

I had to play around with code a little when I got it to work; changing the actual distance in which the sensor would ping.

After getting it moving smoothly. I noticed that I did not have enough amperage to move the car coming out of the 6volt to power all sensors, motors and solenoid, so I am still working on finding a solution for that.

Step 5: Finished Product