Smartphone Controlled Arduino Rover

228,888

427

202

Introduction: Smartphone Controlled Arduino Rover

About: I am an Electrical Engineer. I love to harvest Solar Energy and make things by recycling old stuff. I believe, IF YOU TRY YOU MIGHT, IF YOU DON'T YOU WON'T. www.opengreenenergy.com

[ Play Video ]

Most of my Instructables are based on renewable energy,battery or recycling used materials.In this Instructable, I have tried something new i.e making a simple Arduino based robot car.This is my first try to make a robot in my life. If you have never tried to make robot, you must be thinking its a difficult hobby to jump into, but the Arduino and the 2WD / 4WD Robot Chassis make it easy for you to build an awesome robot without any struggle.

I always love to share my knowledge learned from my experience.So writing this guide, it will make easy for you to learn the basics of robotics and applications of the Arduino.

You can find all of my projects on : https://www.opengreenenergy.com/

Update on 25th Oct 2016

Many people request me to make a tutorial on Obstacle Avoiding Rover.So I made it finally.

You can watch the video.

The code is attached below.

Step 1: Parts and Tools Required

Parts :

1. 4WD Robot Chassis kit ( GearBest)

2. Arduino Nano (GearBest )

3. LM298 H bridge Module (GearBest)

4. Bluetooth Module HC-06 ( Amazon )

5. 2 x 18650 Li Ion Battery ( Gear Best )

6. 2x 18650 Battery Holder ( Gear Best )

7. Mini Bread Board ( Gear Best )

8. 0.5 sqmm Wires

9. Male-Female Jumper Wires ( Amazon )

10. Male-Male Jumper Wires ( Amazon )

11. Duct Tape or any other tape ( Amazon )

For Obstacle Avoiding Robot :

HC - SR04 Ultrasonic Distance Measuring Module ( GearBest )

Tools Required :

1. Soldering Iron ( Amazon )

2. Wire Cutter ( Amazon )

3. Wire Stripper ( Gear Best )

4.Glue Gun ( GearBest )

Step 2: What Is a Robot ?

Robot is an electromechanical device which is capable of reacting in some way to its environment, and take autonomous decisions or actions in order to achieve a specific task.

A robot is consists of following components

1. Structure / Chassis

2. Actuator / Motor

3. Controller

4. Inputs / Sensors

5. Power Supply

In the next steps I will describe each of the above components, so that you can understand easily.

Step 3: Structure / Chassis

The structure consists of physical components. A robot has one or more physical components that move in some way to perform the task.In our case the Chassis and wheels are the structure of the robot.

Step 4: Actuator

An “actuator” can be defined as a device that converts energy (in robotics, that energy tends to be electrical) into physical motion. Most of the actuators produce either rotational or linear motion.

In our case the actuator is DC gear motor.It is basically a DC motor combined with a gearbox that works to decrease the motor’s speed and increase the torque.

Example : A DC motor having speed 3000 rpm and torque 0.002 N•m . Now we add a gear to it with gear ratio 1:48.The new speed is reduce by a factor 48 ( resulting 3000/44 = 68 rpm ) and the torque increased by a factor of 48.( resulting 0.002 x 48 = 0.096 N.m.

Step 5: Prepare the Motors Terminal

Cut 4 pieces of red and black wires with length approximately 5 to 6 inch.I was using 0.5 sqmm wires.

Strip out the insulation from the wires at each end

Solder the wires to the motor terminal.

You can check the motor polarity by connecting it to the battery pack.If it rotates in forward direction ( red wire with positive and black wire with negative terminal of the battery) then the connection is ok.

Step 6: Mount the Motor

[ Assembling Video ]

Attach the two acrylic fastener to each motor using two long bolts and two nuts.You can watch the assembling video to know the details.

Note that the wires on each motor are pointing toward the centre of the chassis.

Join the two red wires and black wires of the motor on each side of the chassis.

So after joining, you have two terminals on left side and two terminal on right side.

Step 7: Install the Top Roof

After mounting the 4 motors on the bottom floor , you have to mount trhe top roof.

Mount the 6 copper stand off by using the M3 nuts

Pull out the terminal wires towards the top roof.

Step 8: Controller

Now the robot chassis and actuator are added but controller is missing.Chassis without controller means nothing will happen. Your robot will sit in one place.Its just like a human without life.

So a controller ( brain ) is needed to move the robot from one place to another.It is a computing device capable of executing a program and is responsible for all computations, decision making, and communications.In our case, we are using an Arduino Nano microcontroller as a Controller.

The controller takes input ( sensors, Remote etc ) , process it and then gives a command to the actuator ( motor ) to do the desired task.

If you take a battery hook the positive side to one side of your DC motor. Then you connect the negative side of the battery to the other motor lead. The motor spins forward. If you swap the battery leads the motor spins in reverse. You can use your microcontroller to rotate the motor in one direction.But if you want to be able to control the motor in both forward and reverse with your microcontroller, you will need more circuitry. You will need an H-Bridge

In the next step I will explain what exactly H-bridge is.

Step 9: H Bridge ( LM 298 Module )

What is H- Bridge ?

The term H bridge is derived from the typical graphical representation of such a circuit .It is a circuit which can drive a DC motor in forward and reverse direction.

Working : See the above picture for understanding the working of the H bridge.It is consists of 4 electronics switches S1,S2,S3 and S4 ( Transistors / MOSFETs/ IGBTS ).

When the switches S1 and S4 are closed (and S2 and S3 are open) a positive voltage will be applied across the motor.So it rotates in the forward direction.Similarly when S2 and S3 are closed and S1 and S4 are opened a reverse voltage is applied across the motor, so rotates in revers direction.

Note : The switches in the same arm ( either S1,S2 or S3,S4) are never closed at a same time, it will make a dead short circuit.

H bridges are available as integrated circuits, or you can built your own by using 4transistors or MOSFETs.

In our case we are using LM298 H-bridge IC that can allows to control the speed and direction of the motors.

Pin Description :

Out 1: DC motor 1 "+" or stepper motor A+

Out 2: DC motor 1 "-" or stepper motor A-

Out 3: DC motor 2 "+" or stepper motor B+

Out 4: Motor B lead out

12v :12V input but you can use 7 to 35V

GND: Ground

5v: 5V output if 12V jumper in place, ideal for powering your Arduino (etc)

EnA: Enables PWM signal for Motor A (Please see the "Arduino Sketch Considerations" section)

IN1: Enable Motor A

IN2: Enable MotorA

IN3: Enable MotorB

IN4: Enable MotorB

BEnB: Enables PWM signal for Motor B (Please see the "Arduino Sketch Considerations" section)

Step 10: Input / Sensors

Unlike humans, robots are not limited to just sight, sound, touch, smell and taste. Robots use different sensors to

interact with the external world.

A sensor is a device that detects and responds to some type of input from the physical environment. The specific input could be light, heat, motion, moisture, pressure, or any one of a great number of other environmental phenomena.

The inputs may be from sensors,Remote or Smartphone.

In this basic tutorial I am using Smartphone as a input device to control the Rover.

Step 11: Power Source

A robot needs a power source to drive the actuators ( motors ) and the controller. Most of the robots are powered by a battery.When we talk about battery, there are lot of options

1. AA Alkaline Battery ( Non Rechargeable )

2. AA NiMh or NiCd Battery ( Rechargeable )

3. Li Ion Battery

4. LiPo Battery

So according to the requirement choose the suitable one.In my opinion, always choose a rechargeable and sufficient capacity battery.I used 2nos of 2600mAh LiIon Battery ( 18650 Samsung Brand ).If you need more power for autonomy you can choose a large battery pack like 5A turnigy.

Battery Holder :

The battery holder that I am using is ordered from china.It is not suitable for flat top battery like Samsung. So I attached two neodymium magnets on the positive terminal of the battery to fit perfectly.

Charging :

You need a good charger to charge the battery pack.As per my experience these are few good chargers

1.PowerEx AA Charger-Analyzer ( Amazon )

2. XTAR LiIon Battery Charger ( Amazon )

3. Turnigy LiPo Battery Charger ( Amazon )

Step 12: Mount the Components

On the top roof mount the entire circuit.

I used hot glue to mount the Battery Holder, Motor Driver (LM 298 ) and Mini Bread Board.You can also screw it.

Mount the Bluetooth module by using duct tape.

Insert the Arduino Nano on to the mini bread board.

Step 13: Electrical Wiring

For wiring you need some jumper wires.

Connect the red wires of two motors ( on each side )together and black wires together.So finally you have two terminals in each side.

MOTORA is in charge of two right side motors, correspondingly two left side motors are connected to MOTORB

Follow the instruction below to connect everything.

Motors Connection:

Out1 -> Left Side Motor Red Wire (+ )

Out2 -> Left Side Motor Black Wire ( - )

Out3 -> Right Side Motor Red Wire ( + )

Out4 -> Right Side Motor Black Wire ( - )

LM298 - > Arduino

IN1 -> D5

IN2-> D6

IN2 ->D9

IN2-> D10

Bluetooth Module -> Arduino

Rx-> Tx

Tx ->Rx

GND -> GND

Vcc -> 3.3V

Power

12V - > Connect Battery Red Wire

GND -> Connect Battery Black wire and Arduino GND pin

5V -> Connect to Arduino 5V pin

Step 14: Control Logic

To understand the working, I made this logic table.It is very useful during writing of the code.

Step 15: Software

The software part is very simple,it does not need any library.If you understand the logic table in the earlier steps then you can write you own code. I didn't spend much time on writing the code, so just using a code written by someone else.To control the Robot Car, I am using my smartphone.The smartphone is connected to the controller via a Bluetooth module ( HC -06)

Download the App

After installing the app, you have to pair it with the Bluetooth module.The password for pairing is " 1234 ".

Arduino code is attached below.

Step 16: Testing

To test the Robot Car, I placed it on a cardboard box.So that the wheels will rotate but not move.

Then check it by pressing the all keys.

If all the functions work perfectly, then its ready for actual operation.

Note : If the motors are rotate in wrong directions, just swap the wires.

Step 17: Future Plan

In this guide I have explained how to make a simple Rover .Now the next task is to add more features in it.

You can add different sensors according to the requirements. These are some ideas to be implemented in future

1. Adding Ultrasonic Ping Sensors for obstacle avoiding

2. Using WiFi Module like ESP8266 or Node MCU instead of Bluetooth for long range control.

3. Adding a solar panel for charging the battery pack

If you enjoyed this article, don’t forget to pass it along!

Follow me for more DIY projects and ideas. Thank you !!!

6 People Made This Project!

Recommendations

  • Fix It! Contest

    Fix It! Contest
  • Metalworking Contest

    Metalworking Contest
  • Creative Misuse Contest

    Creative Misuse Contest

202 Discussions

Thanks for this tutorial.

it works great.

I have one question. Is it possible to control the velocity with a slider? Can you help me to modify your App and the program?

Thanks

1 more answer

i am unable to compile the code its getting

{exit status 1

Error compiling for board Arduino Nano.}

this error while compaling the code .

pls help me to resolve this problem

145286.JPG

Need Constructive Solution

I assembled the obstacle avoiding robot and uploaded the code. But, when I power it up, all it just does is that it keeps on rotating the servo motor (and thereby the Ultrasonic sensor) to and fro at specific time intervals. The wheels haven't shown a single sign of movement till now. I even disassembled it and re-assembled it back again. It is still showing this problem.

SOMEBODY PLEASE HELP...!!

Hi, I'm doing the project, your video, Part lll.
The programming code is the same as the video part ll?
I wait your answer.
Thanks friend.

can i do it only with 2 motors ?

Please help me.
Power amplifier ekaka volume level arduino , saha phone eken(Wi fi) adu wedi karanne kohomada
Thanks

SIR I WAS UNABLE TO ACCESS THE REQUIRED APP. CAN YOU HELP ME OUT BY PROVIDING ME WITH THAT APP OR SOME OTHER RESOURCEFUL APP THAT PLAYS THE SAME ROLE WITHOUT MAKING ANY CHANGES IN THE CODE. REPLY ASAP .


THANK YOU

1 more answer

Hello. I have a problem. My arduino car is finished but I don't know which app to use because the app you have set in the procedures does't exsit. Is there any other application with which I can control arduino car? Please answer as soon as you can.Thank you.

1 reply