Introduction: MARS-- Autonomous Multi-functional Rover (FPV)

About: I love working with electronics and robotics. I am going to eventually major in mechanical engineering, and I love trying new things everyday. Check out my youtube channel for in depth explanations and experim…

Arduino is a very versatile microcontroller, and I've seen many differing applications. But I wanted to see how much I could do with one by myself. I had a very basic idea of how to use arduino when I started this project. I started the basics and built upon it until before I knew it, I was able to do so much with arduino. This robot I've built has different functions controlled by a blue-tooth app. It can be controlled manually, has an autonomous avoid or follow function, has LED's and a piezo speaker to be controlled, and a FPV camera. It was a very fun and a great learning experience and I plan to continue adding to it. The video below is the follow mode. It has the manual mode, and avoid mode as well.

edit:check out my next instructable for the MARS V.2 rover

Video:

Step 1: Materials

Here is a list of all the materials I used with the prices and total:

--Arduino Mega--http://www.amazon.com/Donop%C2%AE-Atmega2560-16au-... =$14

--Track--http://www.amazon.com/Tamiya-Track-Wheel-Set-70100...= $10

--Platform--http://www.amazon.com/Tamiya-70157-Universal-Plate... = $11

--Double Gearbox--http://www.amazon.com/Tamiya-Double-Gearbox-Indepe... = $11

--Motor Driver--http://www.amazon.com/DROK-Controller-H-Bridge-Meg... = $5

--Lipo 7.4v battery--http://www.amazon.com/Turnigy-1000mAh-Lipo-HobbyKi... = $11

--Balance Charger--http://www.amazon.com/TOMTOP-Battery-Balancer-Char... = $9

--Ultrasonic Range Finder x4--http://www.amazon.com/SunFounder-Ultrasonic-Distan... = $18

--PIR sensor--http://www.amazon.com/Great-Deal-HC-SR501-Infrared... = $3

--Motors--http://www.amazon.com/130-16140-12500RPM-Motor-Var... = $5

--Accelerometer--http://www.amazon.com/ADXL335-Module-3-axis-Digita... = $6

--RGB LED-- =?

--Perfboard-- = $5

--Switch-- =?

--Bluetooth Module--http://www.amazon.com/JBtek-Wireless-Bluetooth-Tra... = $9

--FPV wireless camera + monitor--http://www.amazon.com/HDE-Pinhole-Wireless-Securit... = $40

--Ribbon/Jumper wire--http://www.amazon.com/Kalevel%C2%AE-120pcs-Multico... =$10

Total ~= $175

I know its a bit much, but it was worth it to learn and create things. I ended up spending around $300 throughout the year and I worked on it...started small and just grew I guess...

Step 2: Track/Platform

The first step is setting up the base. I used, from the track kit from tamiya, one long track and the two medium tracks for each side. For the platform, I used two universal plates from tamiya and some standoffs to make a double decker for extra room for electronics and sensors.

Step 3: Gearbox

The gearbox from tamiya comes with instructions to build different ratios for speed and torque. I chose the B ratio of 32:1 and replaced the stock motors (which worked fine, but one gave out after a while) with 6v motors. With the program running on it, the 0-255 of pwm that you can put into the motors is changed to 0-100. With the stock 3v motors I safely was able to run them at 30% of a 7.4v 1000mah lipo battery, and with 6v I ran them at 60% of the battery, but could go up to 81% of 7.4v (which would provide 5.994v out of 7.4v). I went with 60% because the camera used draws 1 amp out of the battery and 1000mah mean it can provide 1 amp for an hour, but with the camera and the motors running off of it, it was providing more amps for less time. So less draw on the motors means longer run time and still a good speed. With 60% and the camera on and one 7.4v 1000mah lipo battery it runs for about 45 minutes.

Step 4: Motor Driver

The L298N motor driver requires 6 pins (Enable A, Enable B, Input 1, IN 2, IN 3, IN4) and can handle from 6-12v dc. It has a 5v enable pin that you can run the micro-controller off of. Here is a good explanation I found of hoe it works and how to use it:

The video goes into depth on the board and the code needed to use it. Basically it has to void function: motorA and motorB. Each, as I said before, creates a 0-100% range to provide the motors as well as commands 0, 1, 2, and 3. The 0 means off, 1 is clockwise and 2 is counterclockwise, and 3 is brake.

Basically when you want to have motorA move you do: motorA( choose 0, 1, 2, or 3, and choose a percent. It would look like this: motorA(1, 30); //run motorA clockwise at 30% of the motor.

The wiring goes like this:

EnableA: pin 5 (needs to be a pwm pin)

EnableB: pin 3 (needs to be a pwm pin)

Input 1: pin 2

Input 2: pin 4

Input 3: pin 6

Input 4: pin 7

Step 5: Ultrasonic Sensors

These inexpensive sensors are easy to use and setup and can be used for lots. The programming for these is very simple and it can be used to avoid, follow, measure, etc.

There are 4 pins on each sensor: GND(ground), Vcc(5v), Trig(Trigger, Can be any digital pin),Echo(Echo, can be any digital pin).

The code it runs on is very easy.

pinMode(Bout, OUTPUT);
delayMicroseconds(7);

digitalWrite(Bout, LOW);

delayMicroseconds(2);

digitalWrite(Bout, HIGH);

delayMicroseconds(5);

digitalWrite(Bout, LOW);

Bduration = pulseIn(Bin, HIGH);

Ldistance = (Lduration/2) / 29.1;

Step 6: RGB LED

The LED is used for lighting and for telling which sensor is activated. It is fairly easy to use. Their are 4 pins, the longest being common cround, and the 3 others being red, green, or blue. These last three connect with a 220 ohm resistor to any of the arduino pins.

void setup()

{

pinMode(1, OUTPUT); //each color connected to pins and gnd to arduino gnd

pinMode(2, OUTPUT);

pinMode(3, OUTPUT);

}

void loop()

{

digitalWrite(1, HIGH); // turns on LED for 1 second

delay(1000);

digitalWrite(1, LOW); //turns off for one second

delay(1000);

digitalWrite(2, HIGH);// turns on LED for 1 second

delay(1000);

digitalWrite(2, LOW);//turns off for one second

delay(1000);

digitalWrite(3, HIGH);// turns on LED for 1 second

delay(1000);

digitalWrite(3, LOW);//turns off for one second

delay(1000);

} // repeats

Step 7: Bluetooth

The bluetooth module HC-05 has 4 pins we will use; GND, 3v3, Tx, and Rx. GND to arduino GND, 3v3 to arduino 3v3, Tx to Rx pin on arduino, and Rx to Tx pin on arduino. Yes, they are supposed to go like that. And the two end pins we don't use.

byte serialA; // setup to read serial communication

void setup()

{

Serial.begin(9600); // serial baud rate

pinMode(1, OUTPUT);

}

void loop() {
if(Serial.available() > 0) // if it is receiving serial communication, read it

{

serialA = Serial.read();

Serial.println(serialA); // serial print serial communication

}

if(serialA == 'o') // if serial command is o turn pin 1 on HIGH

{

digitalWrite(1, HIGH);

}

else // if serial command is not o, pin 1 is LOW

{

digitalWrite(1, LOW);

}

}

Step 8: Power

For my power, I used a turningy 7.4v 1000mah lipo 2 cell battery. 1000mah means it can provide 1 miliamp of power for 1 hour. You can draw more out, bu it will last for less than an hour. I connected ground directly to the motor driver, but ran the positive wire through a switch before connecting it to +12v on the motor driver. Also, I needed more power and ground pins for sensors, so using headers, I broke the singe pins into 5 pin power and ground and glued them to the sides as seen in the picture. This created more power and gnd pins for sensors to connect to. The lipo needs a special charger found in the list of materials.

Step 9: Arduino Mega

The mega was quite useful in this with so many pins. As I mentioned before, I brokeout the power and gnd pins, but I had plenty of room for I/O. You could simplify the project for an arduino uno if you don't want to buy a mega, but you can't fit all the sensors onto the uno. The mega 2560 is the best for these projects and is excellent.

Step 10: FPV Camera

The camera I used connects directly to the 7.4v battery. I used a 9v battery clip and soldered it to the switch along with the motor driver. As long as you use a battery within specs of the camera module(included with camera), you should be fine. The screen I used is for a backup camera in a car and requires 12v dc. I used a wall plug that converts 110v ac to 12v dc at 1 amp and it worked great. The receiver for the camera has a 9v input which I used a wall plug for as well. It connects to the screen with av connectors and is easily tuned with the knob. just power it all up and twist the knob until the cameras view appears. It has pretty good signal even through walls, but if anyone knows how to improve the 2.4 GHz signal and could suggest improvements it would be much appreciated. This is a great and inexpensive way to have fpv without spending upwards of $50.

Step 11: Code

The arduino now must be programmed. Connect with the cable and open up the IDE. Make sure to go int tools and select arduino mega 2560 and the correct port. Upload the code, and if you've done everything correct it should startup quite nicely:) Also I connected a small piezo speaker to pin 11 and it should beep every time it is powered on.

The code is sort of simple, but please give credit. It shouldn't be too hard to read:

Step 12: Application

The bluetooth application I used can be found on android, but I'm not sure about apple. If you use a different app, you'll have to change the commands in the code.

The app is called ArduinoRC. Once you have downloaded it, open it and click "proceed". Click on the HC-05 it list of available devices, and it should connect no problem. Once connected you can choose which mode you want to control it by. The one in the picture is vehicle mode and you controls the vehicle by tilting the device. The last picture is where you can set the commands to match your code.

Step 13: Final Thoughts

So, this has been quite the project. If you have any questions, comments or concerns, comment below and I will help you out.

Future plans:

-accelerometer

-PIR sensor

-longer range

-own app to control it

Thanks for looking, don't forget to vote, comment, like, or even follow. Many good things to come!:)
Edit: visit my next instructable for the MARS V.2 rover

Robotics Contest

Second Prize in the
Robotics Contest

Tech Contest

Participated in the
Tech Contest