Introduction: DIY Laptop Controlled Robot V1.0

It would be so good if would be able to control a robot or your rc car using a laptop just like you control a car in a game. Well, it can be made possible using the versatile arduino UNO. There are thousands of projects you can make with arduino. This one of those projects. It is basically a robot which can be controlled over a laptop or pc. It can be connected to your pc using bluetooth. It uses an HC-05 bluetooth module which is connected to arduino UNO. When you press a button on the keyboard, a string of data is sent to bluetooth module through the bluetooth of laptop. The module then transmitts the data to arduino which processes it. Arduino then sends a signal to motor driver ic which conducts current to the motors and the motor spins.

For making this robot you should need some basic knowledge about electronics and arduino. I have tried my best to make this instructable easy for even a beginner to understand but this is my first instructable so there can be some errors in this it. Correct me if i am wrong somewhere and feel free to comment and ask any questions. Being a 14 year old guy, I am not a professional in the field of electronics but I still have enough knowledge to work on arduino projects.

Check out the new version of this project: Laptop Controlled Robot v2.0

__________

Update:

It's not easy to reply to each and every comment on so many instructables, so you can ping me for any assistance/discussion/query. My email address is: agarwalsanyam946@gmail.com

For more such awesome DIYs, subscribe to my YouTube channel.

My Facebook page: Make w/ SA

Get the best of the parts at reasonable rates from GearBest.

Also, have a look at their ongoing sales:

The Fall 3D Printer and Electronic Tools Promotional Sale

Arduino Best Deals

Creality3D CR - 10 3D Printer (coupon: GBCR10J) $396.99

Step 1: Gather Parts



For making this robot you would need the parts and tools listed below. Most of them can be bought from ebay or radioshack.


PARTS-:

1x Arduino board (UNO)

1x HC-05 Bluetooth module

1x 12v Battery (according to your requirement,i'm using 1.3AH)

4x DC Geared motors (speed and torque according to your requirement)

4x Wheels for motors (i used two small ones and two big ones)

1x Adapter Jack (to power the arduino board)

1x L293d motor driver ic

8x Male jumper wires

1x Breadboard

Rainbow cable (for motor connections)

Jumper cable (for breadboard connections)

Alligator clips (for connecting battery)

LEDs- 2x red, 2x white (if you want to add front and rear lights)

Male headers


TOOLS-:


-Soldering Iron
-Soldering Wire
-Fume Extractor (if you don't like the bad smell of burning flux)
-Wire Cutter/Stripper -Double Sided Sticky Foam Tape

Step 2: Making the Chassis

So first we start by making the chassis. Fix all the four motors as shown in the fig. above. If you are not using a similar base, you can use clamps to mount the motors. It is recommended to use a metal base as it does not bend when lifting a huge weight.

Step 3: Making the Chassis (Part 2)

As we are making a 4 wheeled robot, we need to connect left and right motors in parallel because l293d can only drive two motors. So cut the required amount of rainbow cable and connect both the positive terminals of left side motors then connect both the negative terminals. Do the same for right side motors. Now solder two more wires to each pair of motors and finally solder male headers to the remaining free ends of wires.

Step 4: Attaching Wheels

Now we are all done with the wiring of chassis. The last step for completing the chassis is to attach wheels to all of the motors.

Step 5: Attaching Breadboard and Arduino to the Base

Attach the breadboard to the base using double sided tape. Now cut two equal lengths of jumper cable and connect it as shown in the breadboard layout above. Fix the arduino board just in the middle of the breadboard.

Step 6: Wiring and Connections (Bluetooth Module)

Here comes the most complicated part of the project and the most important one but no worries because it is not too difficult.

The first part of this step is to fix the bluetooth module and the motor driver IC to the breadboard. For all the connections refer to these steps-:

Step 1:- Connect the Tx pin of bluetooth module to arduino pin 0 (Rx).

Step 2:- Connect the Rx pin of bluetooth module to arduino pin 1 (Tx).

Step 3:- Connect vcc of bluetooth module to arduino +3.3v (if you are using HC-05 module). Connect vcc to +5v (if you are using ( HC-06, JY-MCU or any other module). You can see the voltage ratings given at the back of the module.

Step 4:- Connect gnd of bluetooth module to arduino gnd.

NOTE: I have not used a voltage divider for bluetooth module because i took the pictures first without knowing about that. However it still works without adding it but it is recommended use a voltage divider.I have added a breadboard layout above with the voltage divider. Use a 1.2k and 2.2k resistor for it.

Step 7: Wiring and Connections (L293d)

L293d is a dual h bridge motor driver integrated circuit. We are using it because arduino operates at a low voltage and requires a small amount of current to operate while the motors require a relatively high voltage and current to operate. The l293d ic takes input from arduino in the form of logic 0 and 1, and gives a high output which is enough to drive a motor. It has two voltage pins and two enable pins. Enable pins are connect to vcc to enable the motors. As we already want the motors enabled, we are connecting both the enable pins to the positive terminal of battery. All the four output pins are connected to motors and four input pins are connected to arduino. You can also use l298 for this purpose. however l298 is expensive but it can drive even higher power motors.

Fix the ic on the breadboard. Be sure to check whether you have placed it right or not. Look for a small semi-circle at the top of the ic, it should face in the front. For connections of the ic refer to the following steps-:


Step 1-: as you can see in the pin layout above, pin 4,5,12 and 13 are always connected to ground so first connect pins 4 and 5 using jumper cable then connect pins 12 and 13.

Step 2-: Connect pins 5 and 13 together and then connect pin 12 to the negative rail of breadboard.

Step 3-: Connect pins 1,8,9,16 together then connect pin 16 to the positive rail of breadboard.

Step 4-: Connect pin 2 of ic to arduino pin 2 then connect pin 7 of ic to arduino pin 4.

Step 5-: Connect pin 10 of ic to arduino pin 7 then connect pin 15 of ic to to arduino pin 5.

Step 6-: Connect left pair of motors to pin 3 and 6 in either way. don't worry about the polarity of the motors right now as we would see to that later.

Step 7-: Connect right pair of motors to pin 11 and 14 in either way.

Step 8: Wiring and Connections (LEDs)- Optional

You can skip this step if you don't want to add any lights to your robot. You can use LEDs of any colour, I used white for front lights and red for rear lights. For connections of led refer to the following steps-:

Step 1-: First connect two white LEDs in parallel then connect the positive terminal of led to arduino pin 9. connect negative of led to arduino gnd.

Step 2-: Similarly connect two red LEDs in parallel and connect the positive terminal of led to arduino pin 11. connect negative of led to arduino gnd.

Step 9: Upload the Code

So we are all done with the messy stuff. Now its the time to upload the code to arduino. Connect your arduino device to your pc and open the arduino IDE. Copy the following code and paste it on the arduino screen -:

*********************************

// DIY Laptop Controlled Robot

// made by - Saiyam Agrawal

int r_mtr_n = 2; // assign motor pins to arduino

int r_mtr_p = 4;

int l_mtr_p = 5;

int l_mtr_n = 7;

int b_light = 9; // assign light pins to arduino

int f_light = 11;

int incomingByte = 0; // assign pin for bluetooth module

void setup()

{

pinMode(r_mtr_n, OUTPUT);


pinMode(r_mtr_p, OUTPUT);

pinMode(l_mtr_p, OUTPUT);

pinMode(l_mtr_n, OUTPUT);

pinMode(b_light, OUTPUT);

pinMode(f_light, OUTPUT);

digitalWrite(r_mtr_n, LOW);

digitalWrite(r_mtr_p, LOW);

digitalWrite(l_mtr_p, LOW);

digitalWrite(l_mtr_n, LOW);

digitalWrite(b_light, LOW);

digitalWrite(f_light, LOW);

Serial.begin(9600);

Serial.println("start");

}

void loop()

{

if (Serial.available() > 0) {

incomingByte = Serial.read();

}

switch(incomingByte)

{

case 'S':

digitalWrite(r_mtr_n, LOW); // control for stop

digitalWrite(r_mtr_p, LOW);

digitalWrite(l_mtr_p, LOW);

digitalWrite(l_mtr_n, LOW);

Serial.println("Stop\n");

incomingByte='*';

break;

case 'R':

digitalWrite(r_mtr_n, HIGH); // control for right

digitalWrite(r_mtr_p, LOW);

digitalWrite(l_mtr_p, HIGH);

digitalWrite(l_mtr_n, LOW);

Serial.println("right\n");

incomingByte='*';

break;

case 'L':

digitalWrite(r_mtr_n, LOW); // control for left

digitalWrite(r_mtr_p, HIGH);

digitalWrite(l_mtr_p, LOW);

digitalWrite(l_mtr_n, HIGH);

Serial.println("left\n");

incomingByte='*';

break;

case 'F':

digitalWrite(r_mtr_n, HIGH); // control for forward

digitalWrite(r_mtr_p, LOW);

digitalWrite(l_mtr_p, LOW);

digitalWrite(l_mtr_n, HIGH);

Serial.println("forward\n");

incomingByte='*';

break;

case 'B':

digitalWrite(r_mtr_n, LOW); // control for backward

digitalWrite(r_mtr_p, HIGH);

digitalWrite(l_mtr_p, HIGH);

digitalWrite(l_mtr_n, LOW);

Serial.println("backwards\n");

incomingByte='*';

break;

case 'f':

digitalWrite(r_mtr_n, LOW); // control for stop

digitalWrite(r_mtr_p, LOW);

digitalWrite(l_mtr_p, LOW);

digitalWrite(l_mtr_n, LOW);

Serial.println("Stop\n");

incomingByte='*';

break;

case 'd':

digitalWrite(r_mtr_n, HIGH); // control for right

digitalWrite(r_mtr_p, LOW);

digitalWrite(l_mtr_p, HIGH);

digitalWrite(l_mtr_n, LOW);

Serial.println("right\n");

incomingByte='*';

break;

case 'a':

digitalWrite(r_mtr_n, LOW); // control for left

digitalWrite(r_mtr_p, HIGH);

digitalWrite(l_mtr_p, LOW);

digitalWrite(l_mtr_n, HIGH);

Serial.println("left\n");

incomingByte='*';

break;

case 'w':

digitalWrite(r_mtr_n, HIGH); // control for forward

digitalWrite(r_mtr_p, LOW);

digitalWrite(l_mtr_p, LOW);

digitalWrite(l_mtr_n, HIGH);

Serial.println("forward\n");

incomingByte='*';

break;

case 's':

digitalWrite(r_mtr_n, LOW); // control for backward

digitalWrite(r_mtr_p, HIGH);

digitalWrite(l_mtr_p, HIGH);

digitalWrite(l_mtr_n, LOW);

Serial.println("backwards\n");

incomingByte='*';

break;

case 'n':

digitalWrite(f_light, HIGH); // control for lights

Serial.println("front lights on");

incomingByte='*';

break;

case 'j':

digitalWrite(f_light, LOW);

Serial.println("front lights off");

incomingByte='*';

break;

case 'm':

digitalWrite(b_light, HIGH);

Serial.println("rear lights on");

incomingByte='*';

break;

case 'k':

digitalWrite(b_light, LOW);

Serial.println("rear lights off");

incomingByte='*';

break;

delay(5000);

}

}

*********************************

Step 10: Battery and Power

When you are done uploading the code, power the arduino board by connecting it to breadboard using adapter jack then connect the battery to the power rails of breadboard using alligator clips.

You can use any battery according to your requirement. Using a low voltage battery would lower the speed of motors. Recommended voltage to power the robot is 12v.

Now comes the type of battery to use, I would recommend lithium-ion as they are small, light-weight, have long battery-life and can fit anywhere easily but their disadvantage is that they are expensive and cannot be charged easily. I used lead-acid because they are cheap and can be charged easily.

Step 11: Software

I used tera term to control the robot using laptop. First download tera term then connect it to your robot. If you dont know how to connect, follow these steps-:

Step 1-: first switch on your robot by connecting the battery.

Step 2-: go to devices and printers on your pc then click on add a device. install the hc05 module. the pairing code is 1234.

Step 3-: now select your module, go to properties and check on which serial port is your device connected for eg- mine was COM 65.

Step 4-: open tera term, a screen will appear. now select serial and enter your module's serial port there and select OK.

Now your robot is connected to your laptop. following are the commands to control your robot-

Forward- w or F (upper case)
Backward- s or B (upper case)
Left- a or L (upper case)
Right- d or R (upper case)
Stop- f or S
Front lights on- n
Front lights off- j
Rear lights on- m
Rear lights off- k

Step 12: Checking

If your robot is working fine after checking it in step 11, you can skip this step. If your robot is turning left or right when pressing the forward button, you have a problem with the polarity of the motor. Reverse the polarity of any one of the motors, If it is moving backward then reverse the polarity of both the motors.

If your robot is not moving at all check all the connections of ic as well as bluetooth module. Touch the ic, if it is hot then you have done the wiring wrong. Maybe the connections are too loose if you are not using a good quality jumper wire as making anything on breadboard does not ensure good electrical contacts. If it still does not work then solder the whole circuit on perfboard or maybe an etched pcb. It is advised that double-check all the connections before connecting the battery.

Step 13: Enjoy!!

Ok so you are done with the making of this robot. Just connect it to your laptop and enjoy. Here are some tips and suggestions for making your robot event better-

1) - as you already know we have used only 8 digital pins of arduino so you still have 6 more pins. So let your imagination flow so you can add more features to your robot.

2) - you can add a buzzer as a horn for your robot.

3) - you can even add more leds to the robot.

4) - this robot can also be controlled over an android device. download an app named bluetooth rc controller from play store.

5) - you can modify the program to make the robot voice controlled using an android device.

6) - you can add a webcam and sensors as well.

Ok, so this is the end of this instructable. Thanks for watching it. If you have any questions related to this instructable, feel free to ask. THANK YOU :)

Switch to: Laptop Controlled Robot v2.0