Wirelessly Control a Robot Using Arduino and RF Modules !

216,859

169

142

About: I break things so I can figure out how they're made when I put it back together.

/*

Edit 05/05/2016

Hey guys, I've been busy with college and couldn't reply to commments. Most of y'all wanted the code and schematics done a bit better so I've made the schematics on Eagle 7.2.0 and uploaded everything on Github.

Here's the link : https://github.com/r5sb/Wireless-Arduino-Robot.git

Cheers!

*/

In this Instructable you'll learn how to make an RF controlled Arduino Robot.....or in other words your very own Minion waiting to obey your commands..... :p

OVERVIEW

In this project I've used a 433Mhz Tx and Rx pair to allow the Arduinos to communicate wirelessly with each other.These modules are probably the easiest way to set up wireless simplex communincation between two arduinos and are much cheaper compared to other wireless modules like Xbee or bluetooth modules(reduced range though).

I have shown two alternatives for controlling the robot :- 1). Using your computer's keyboard to control the bot and 2).Using a separate controller made on a breadboard.
The robot uses differential drive in order to turn (wheels on either side move in opposite directions).

Refer to the pdf attached for getting started with these modules.

So lets get started..... :)

Step 1: Collect Your Parts

Here is the parts list and some links for buying them :-

The Controller Board :-

1. Any model/clone Arduino board.
2.The 433MHz OR the 315MHz module (both work the same way) Tx and Rx pair ( Link here)
3. A breadboard for the controller pad (Not needed if you're using a computer to control the bot).
4.Push button switches X 5 (Again not needed if you're using a computer to control the bot).
5. Connecting wires.
6. 9V battery to power the Arduino on the Tx end.
7.A 17cm long breadboard wire for the Antenna for the Tx and Rx.

The Receiver Board :-

1. Any Arduino model/clone board.
2. The Rx part of theTx/Rx pair (Link in Step 2 above).
3. Breadboard and connecting wires.
4.12V battery pack to power Motors.(In the video I have used a 12V AC to DC adapter)
5. 100uF Electrolytic Caps X 4.
6. L293D motor driver chip X 2 (Each chip controls 2 motors bi-directionally...So if you want to make a 2 wheeled bot you will require only 1 L293D chip).
7. 0.1uF ceramic caps X 12 (3 for each motor)....for eliminating noise between the controller and motors.
8. A 9V battery for powering the Arduino on the Rx end.

Note :- You can skip step 5 and 6 if you have a motor shield...though the code will need some tweaking then!

Robot Chassis and Drivetrain :-

1.DC Motors X 4
2.Robot chasis
3. Wheels X 4

Note :- I used this robot chassis....came with the motors and wheels 

Now on to the build......


Step 2: The Transmitter : Part 1 :- Controlling the Robot Using the Computer

The transmitter and receiver communicate across a  433MHz frequency ( or 315MHz...really depends on what module you use).

The transmitter is the smaller module having 4 pins :-

(1)Ant ---------> Antenna
(2)Vcc ---------> Power supply....in this case 5v from the Arduino at the Tx end.
(3)Data -------> Data pin.....transmits the data in bytes.
(4)Gnd-------->Ground pin....connected to Arduino ground.

First solder the 17 cm (about 13cm for the 315MHz module) solid core breadboard wire to the Ant pin on the Tx module....the added antenna increases the communication range and improves performance indoors.
If you do not want to solder the antenna directly you can  always connect it on the breadboard.

In this step you will learn how to control the bot using the computer.

You can have a look at Step 3 which shows how to control  the bot using a breadboard controller.

Connections :-

These are the connection between the Arduino and the Tx module.

                           Tx                                                Arduino


                        Vcc----------------------------------->  5v pin
                       Gnd-----------------------------------> Gnd pin
                      Data-----------------------------------> Digital Pin 3 

Code :-

First you need to download the VirtualWire Library...this library makes coding these modules for the  Arduino very easy.
Download and Installation instructions are provided here

Working of the code :-

The code accept inputs from the user (f,b,r,l,s)  through the serial monitor and then uses Switch-Case statements to determine which command is to be sent by the Tx .i.e. Front, Back, Left, Right, or Stop.

The code is attached below in a .txt file.....just paste it into a new window on the Arduino IDE.

Moving on......

Step 3: The Transmitter : Part 2 :- Breadboard Remote Controller

This is an alternative way of controlling the bot....by building your own remote on a breadboard.

This is where the push buttons come in use...connect the push-buttons in a way that you find comfortable to control the bot (see the pics for reference).

Make sure you identify the correct terminals of all the switches.

The Connections :-

Connect one terminal of each switch  to  a common ground that is connected to an Arduino ground pin (Again refer to the pics).

Connect the other terminal to a Digital pin on the Arduino.

The connections should be something like this :-

                                           Button                                                            Digital Pin

                                       Forward ------------------------------------------->     08
                                      Backward ------------------------------------------>    09
                                      Right        -------------------------------------------->   10
                                      Left            ------------------------------------------->   11
                                      Stop         -------------------------------------------->   12


You can change the digital pin connections....but make sure you change them in the RemoteTx code as well!!

The Code :-

(1) The Tx Code :-

The code reads whenever a button is pressed since the corresponding digital pin goes LOW.Based on which digital pin goes LOW the appropriate command is transmitted.

(2)The Rx Code :-

The code receives the transmitted byte and based on the command received move the bot in the desired direction.



Both codes are attached at the bottom.

Step 4: The Receiver

The Rx is the longer module having 8 pins :-

(1)Ant
(2)Gnd
(3)Gnd
(4)Vcc

(5)Vcc
(6)Data
(7)Data
(8)Gnd

Note :- we only use the first Data pin (pin 7).

Now take the second 17cm wire and solder it to the Ant pin of the Rx module.

Connections :- 

These are the connections between the Arduino and the Rx module.

                             Rx                                                Arduino


                        Vcc----------------------------------->  5v pin
                       Gnd-----------------------------------> Gnd pin
                      Data-----------------------------------> Digital Pin 2


You will also need to connect the two L293D motor driver chips to the Arduino at the receiver.( Pin diagram of L293D given in the pics) Make sure you connect the chip properly...the end with the notch is the front end.

                          First L293D                                           Arduino

                             Enable1 --------------------------------> Digital Pin 05
                             Enable2  -------------------------------->Digital Pin 06
                             Input 1     -------------------------------->Digital Pin 07
                             Input 2 ----------------------------------->Digital Pin 08
                             Input 3 ----------------------------------->Digital Pin 09
                             Input 4 ----------------------------------->Digital Pin 10



                              Second L293D                                           Arduino

                             Enable1 --------------------------------> Digital Pin 03
                             Enable2  -------------------------------->Digital Pin 11
                             Input 1     -------------------------------->Digital Pin 04
                             Input 2 ----------------------------------->Digital Pin 12
                             Input 3 ----------------------------------->Digital Pin 14(Analog 0)
                             Input 4 ----------------------------------->Digital Pin 15(Analog 1)


Additional connections :-

(1)For the L293D motor drivers :-
Pin 8 of both the L293D chip go to the poitive of the 12V supply....this pin gives the power to the motors.

Pins 4,5,12,13 of both chips go to ground.

Pins 3 and 6  are connected to the leads of first motor........and pins 11,14 go to the leads of the second motor.(Same for the second L293D as well but for third and fourth motor).

Pin 16 of both chips is connected to the Arduino 5v supply...............this pin powers the chip.

Very Important  :- Make sure Arduino and 12V  supply grounds are connected  TOGETHER!!!!


The Code :-
  

This code is receives the transmitted commands from the Tx and moves the robot in the desired direction.

Note :- This receiver code is used when the robot is controlled via the computer input. Another modified receiver code is used with the breadboard controller and can be downloaded in Step 3.




Step 5: The Chassis and Drivetrain

Now get your Motors and robot chassis ready....

First solder the 0.1uf ceramic caps on the motors in the following way :-

(1) connect one capacitor across the terminals of the motor.
(2)connect one lead each of the 2 other caps on the motor body and the other lead to each motor terminal.
These caps don't have polarity so don't get worried about connecting them wrong.

You can refer to the pics and also to the link for more help :-
http://www.pololu.com/docs/0J15/9

Now attach your motors to the chassis and connect the motor terminals to the correct pins on the L293D motor driver.

Don't forget to connect the 100uF electrolytic caps to the supply pins of the L293Ds (Pins 8 and 16).
Electrolytic caps are polarized and  need to be connected correctly.The shorter lead (the side of the casing with the strip ) is the negative terminal and the longer lead is the positive one.These caps smooth out voltage spikes from the supply.

Now for the main assembly........




Step 6: Main Assembly

First make sure all the circuit connections are correct, caps  on the motors are soldered well and check for any loose connections.

Be Careful While adding the batteries and make sure ALL connections are correct before connecting the batteries and powering up.

For mounting the the receiver breadboard on to the robot I used bits of velcro. I secured the Arduino on to the robot by  using a zip tie.

Use small bits of solid core wires or rubber bands to tie the different bunches of wires to make it a bit neater.

Now on to Testing!!!!!!!!!!!


Step 7: Test It!!

With everything assembled and all the wires connected properly the only step left is Testing!

Before you put the wheels on and power the bot  up.....test  it  without the wheels attached first...this way you can make sure all the motors have been connected correctly with the motor driver and their direction of rotation is correct.
Once you're satisfied with the speed and rotation of the motors put the wheels on!
Be careful when using the 12v supply and double check all your connections before powering anything up again!
I have attached links to  videos of the robot testing when  controlled by both the computer and the separate breadboard controller.

Now that your robot is made add some more features to it (I'm planning on tank tracks!)...now your bot is ready to do your bidding! :p

Initial Test Video :-


PS :- I have entered this Instructable in the Microcontroller Contest...so please vote if you liked it...Thanks!


Update (28-10-13) :- Here is a short  video of the robot in action with batteries.....sorry for the bad shooting, had the controller in my other hand!





2 People Made This Project!

Recommendations

  • Optics Contest

    Optics Contest
  • Plastics Contest

    Plastics Contest
  • Make it Glow Contest 2018

    Make it Glow Contest 2018

142 Discussions

0
None
unknown1111

1 year ago

amazing project !!!

Can I use an arduino nano in this project?

0
None
ravindrascout

1 year ago

Hi there,

I was requested to make a remote control car with a mounted camera. it should work for longer ranges so it was opted that we go for radio transmitter over blue tooth. it should be arduino controlled. the remote control consist of a joystick. in addition there is a requirement that the camera should send images / videos to our display. (well that can wait) but it'll be great if you can give me a tutorial from the basic lvl since i'm quite new to the field. Thanks

0
None
IrwanF

2 years ago

I like this project,,,,,
I have aq question....
how long distance we can control this robot...???

1 reply
0
None
RonitB5IrwanF

Reply 1 year ago

depends on the module u use.

0
None
YatharthA1

1 year ago

amazing job done man!!!!!!!!!!!!

0
None
jjack10Blazingnite

Reply 1 year ago

Its a for loop in c lenguage its mean the loop work agaim and again 12 tims when i=o to i=12

0
None
Blazingnite

2 years ago

also if im using an l298n dual h bridge will i need to change the program a bit?

0
None
laith mohamed

2 years ago

Attracted me this experiment , go on ...

0
None
devanshr1221

2 years ago

I have a problem..

My transmitter is sending signals properly as i can see through my serial port, but my receiver is not receiving it.

Please someone help me..

0
None
Soulofhoror

2 years ago

Hi, nice work. I'm new to Arduino so this may sound dum. Sorry about that in advance.

In the reseiver code I saw that you put the controls(forward, backward etc) on different methods referring to the void loop(which i think might be the main method). so when the program loops does the code holds the previous set command until a new one is reserved? If so why? If not why?

Plz answer a nubie here.....

1 reply
0
None
r5sbSoulofhoror

Reply 2 years ago

Hey we all started somewhere right? :D

The receiver responds according to the button pressed at the Tx. Since I didn't want to keep on pressing the Forward button in order to make the robot go forward, I made it move continuously in the direction pressed and also added a Stop button.

0
None
RajdeepR3

2 years ago

hey man, i have a prob i am making a rc car using arduino and l293d motor driver and i want to use rf but i am facing prob in connections and writing codes so if u could help me regarding this i would be really thankful

0
None
Sujeet Pa

2 years ago

Could you use Diagrammatic Representations because in most of the pictures given, i could only see some wires

0
None
Vinayak Tyagi

2 years ago

Hi RoboDude, I like your tutorial! I added the remote part on my robot using your code and it works perfectly. I've also written and instructable on a wireless RF robot, but its a bit different than urs. Thanks for the remote code. Definitely, I'm adding this to my favorites.

Here's my instructable :

https://www.instructables.com/id/Make-a-Simple-Wireless-RF-Robot-Using-Arduino/

0
None
ArpitPatel

2 years ago

Hello Author... I am working on this project and only want to ask you about sequence of motor. In this project there are total 2(two) L293D interfaced so total 4(four) motors will be connected to two L293D right. Now you have clearly mentioned the number of ICs i.e. First L293D and Second L293D, but which motors are connected to first IC and which motors are connected to second IC. Sir, Now my question is in the bot there are total four motors connected, two motors at the front and two motors at the rear. Now Out of these all four motors which are connected to which ICs...?? Kind Request to clearly mention the motor sequence i.e. motor no. 1,2,3,4... and front left...? front right...? rear left...? rear right...?

0
None
NavinD3

2 years ago

i am planning to use bluetooth instead of rf and to make my android device as transmitter.is it possible ?

1 reply
0
None
Sudhansu BarikNavinD3

Reply 2 years ago

Yes, you can use HC-05 Bluetooth Host for Arduino. And then you can control it using your android device.

0
None
abinay777

3 years ago

hi,i have tried uploading the programme before buying the products to make sure it works or its a waste of money.

on trying to upload it ,it showed an error saying there is no directory saying

''sketch_oct24a.ino:5:25: fatal error: VirtualWire.h: No such file or directory"

what should i do pls anyone can help me

i would be gratefull

1 reply
0
None
vasu0712abinay777

Reply 2 years ago

Have u extracted the virtual wire pdf to the library folder in arduino??