loading

/*

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!





<p>I like this project,,,,,<br>I have aq question....<br>how long distance we can control this robot...???</p>
<p>it all depends on the capactiy of your transmitter/receiver module</p>
<p>hey man u said that we have to use 2 motor shields saying that 1 can only suppot 2 motors. but on my motorshield i see that it has ports for 4 motors. my question is that do i need to change the code for it or get another motor shield?</p>
<p>amazing job done man!!!!!!!!!!!!</p>
<p>What does int i = 0; i &lt; 12; i++) mean?</p>
Its a for loop in c lenguage its mean the loop work agaim and again 12 tims when i=o to i=12
<p>also if im using an l298n dual h bridge will i need to change the program a bit?</p>
<p>Attracted me this experiment , go on ...</p>
<p>I have a problem..</p><p>My transmitter is sending signals properly as i can see through my serial port, but my receiver is not receiving it.</p><p>Please someone help me..</p>
<p>Hi, nice work. I'm new to Arduino so this may sound dum. Sorry about that in advance. </p><p>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? </p><p>Plz answer a nubie here.....</p>
<p>Hey we all started somewhere right? :D</p><p>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.</p>
<p>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 </p>
<p>Could you use Diagrammatic Representations because in most of the pictures given, i could only see some wires</p>
<p>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.</p><p>Here's my instructable :</p><p>https://www.instructables.com/id/Make-a-Simple-Wireless-RF-Robot-Using-Arduino/</p>
<p><strong>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...? </strong></p>
<p>i am planning to use bluetooth instead of rf and to make my android device as transmitter.is it possible ?</p>
<p>Yes, you can use HC-05 Bluetooth Host for Arduino. And then you can control it using your android device.</p>
<p>hi,i have tried uploading the programme before buying the products to make sure it works or its a waste of money. </p><p>on trying to upload it ,it showed an error saying there is no directory saying </p><p>''sketch_oct24a.ino:5:25: fatal error: VirtualWire.h: No such file or directory&quot;</p><p>what should i do pls anyone can help me </p><p>i would be gratefull</p>
Have u extracted the virtual wire pdf to the library folder in arduino??
<p>check if you have the virtual wire library in tools on the arduino sketch page.</p><p>if not you can download it from google</p>
Thanks ,but I couldn't find any libraries relating to virtualwire on the internet<br>Can u send a link to the library if possible
https://www.pjrc.com/teensy/arduino_libraries/VirtualWire.zip
Bro guide me the steps to control it using computer...i have uploaded the reciever program in arduino board and tx program in tx part...but i dont know what to do next.<br>
<p>Nice presentation,but pls give a proper circuit diagram.All i can see is a couple of wires in your photo.</p>
<p>how do i do it if using l293d motor driver shield????</p>
<p>will this rf315 MHz work </p><p><a href="http://store.fut-electronics.com/products/wireless-rf-kit-315-mhz-transmitter-receiver?variant=1016435067" rel="nofollow">http://store.fut-electronics.com/products/wireless-rf-kit-315-mhz-transmitter-receiver?variant=1016435067</a></p>
<p>Yes I think that will work very well with no changes in the Arduino sketch. But as I am writing this two months after your question was asked you already know the answer.</p>
<p>I have made a few changes. Only two motors on robot so i will add motors for interesting options. Just ready to test i think maybe sleep a little before i add electricity if you know what i mean. thanks for the good work on your Instructable.</p>
<p>Very nice work. Thank you so much for sharing this with all of us.</p>
<p>Sometimes when I press the buttons on the transmitter does not reach the order to the receiver. Will be a noise problem and insulation? Or maybe poor quality RF modules? Has already happened to anyone?</p>
<p>What is the distance between your Tx and Rx module?</p>
<p>Hey sorry for the late reply, I didn't have access to my laptop for a few days. This problem has happened to me too. These modules have a range of about 100m line of sight in an open field. In indoor environments this range is reduced because of walls, furniture, etc. However the modules I got were pretty decent and sometimes even when I was in a separate room from the robot.</p>
Hey i need ur suggestion in connecting 8 motors at the receiver end.<br>Like how to connect 4 l293d chips to one arduino.?<br>Or<br>Should i use two arduinos for 8 motors (4 motors and 2 l293d for each arduino) to connect to Rx module.?<br>If so explain me with the connections with clear diagrams.<br>Please help me with this.<br>Reply me<br>surendra.nagarjun@gmail.com
<p>Multiply this x4. http://feikebrouwer.macuser.nl/L293d.PNG you will need a power source suitable to the needs of your motors. You only need 2 Arduino digital pins to control each motor. Arduino UNO leaves you 12 free digital pins so you will not have problems to control 8 motor with Arduino UNO and L293D.</p>
http://feikebrouwer.macuser.nl/L293d.PNG<br>In the picture u didnt connected the enable pins.<br>Can i connect all enable pins (i.e all 8 enable pins of 4 l293d's) to one or two digital pins.?<br>If so, can u show it diagramatically.?<br>Reply here<br>surendra.nagarjun@gmail.com
<p>You can connect all enable pins to positive pole of the font you use to power the motors. </p>
http://feikebrouwer.macuser.nl/L293d.PNG<br>What about enable pins.?<br>Pic doesnt show any connection for enable pins.<br>Can i connect all enable pins (8 pins for 4 l293d chips) to a single or two digital pins.?
<p>can this project work with nrf24l01 instead of rf433 module</p>
<p>yes, why not? you have to simply change the code :-)</p>
<p>are the motors pwm controlled</p>
<p>motor are control using the L293D motor driver, with digitalWrite commands.</p>
<p>Hi,</p><p>I have a seed motorshield 2.0 and cant get it to run using the transmitter. I can get it to transmit with no problem but as soon as I add the motor.h file it stops working. I know you said it needed some tweeking if using the shield. Can any you help me out? I am not sure where to start. I am kinda new to this.</p>
<p>Hey, I'm not too familiar with the seed motorshield 2.0 but sounds like you may have a conflict of timers in the Arduino. Are you using a servo in your project? Also make sure you've installed the libraries in the correct folder. Check <a href="https://www.instructables.com/id/The-WirelessObstacle-DetectingBeeping-Robot-using-/" rel="nofollow">this</a> instructable. I've used a motor shield and wirleless modules in this case. Hope this helps!</p>
<p>also i think that shield uses pin 13 as well for PWM. Would that conflict with the virtual wire library?</p>
<p>Hi,</p><p>thanks for your reply. The libraries work fine as i have tried them independently. I am using dc motors just like yours. I tried using the other code but nothing.I read somewhere that the virtual wire library uses timer1 and may be incompatible with other libraries that use timer1. Would you happen to know anything about this?</p>
<p>I want to make a wirelessly controlled <strong>TWO WHEELED ROBOT (NOT 4 WHEELED)</strong> Using Arduino and RF Modules .........CAN SOMEONE PLEASE HELP ????</p>
http://feikebrouwer.macuser.nl/L293d.PNG<br>In the picture u didnt connected the enable pins.<br>Can i connect all enable pins (i.e all 8 enable pins of 4 l293d's) to one or two digital pins.?<br>If so, can u show it diagramatically.?<br>Reply here<br>surendra.nagarjun@gmail.com
http://feikebrouwer.macuser.nl/L293d.PNG<br>In the picture u didnt connected the enable pins.<br>Can i connect all enable pins (i.e all 8 enable pins of 4 l293d's) to one or two digital pins.?<br>If so, can u show it diagramatically.?<br>Reply here<br>surendra.nagarjun@gmail.com
http://feikebrouwer.macuser.nl/L293d.PNG<br>In the picture u didnt connected the enable pins.<br>Can i connect all enable pins (i.e all 8 enable pins of 4 l293d's) to one or two digital pins.?<br>If so, can u show it diagramatically.?<br>Reply here<br>surendra.nagarjun@gmail.com
Hey i need ur suggestion in connecting 8 motors at the receiver end.<br>Like how to connect 4 l293d chips to one arduino.?<br>Or<br>Should i use two arduinos for 8 motors (4 motors and 2 l293d for each arduino) to connect to Rx module.?<br>If so explain me with the connections with clear diagrams.<br>Please help me with this.<br>Reply me here<br>surendra.nagarjun@gmail.com

About This Instructable

188,740views

156favorites

License:

Bio: I break things so I can figure out how they're made when I put it back together.
More by r5sb:Raspberry Pi Document Scanner With Automatic Upload to Dropbox. Arduino Hexapod (With A Personality) DIY Line Follower Sensor Array 
Add instructable to: