Teacher Notes

Teachers! Did you use this instructable in your classroom? Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Sending Arduino: Wiring and Building.

Pick one of your Arduinos to be the sending one and the other to be the receiver. The layout for the sending Arduino is simple. We are using a breadboard to connect the RF Transmitter to the Arduino. The four pins on the transmitter are as follows: Ground, Data in, 5V in, Antenna. Place the transmitter in the breadboard and wire the Ground and 5V pins to the corresponding Ground and 5V on the Ardunio. The data in pin should be connected to pin 12 on the Arduino. The antenna is optional but to gain more range, you can simply attach a long wire and leave it hanging.

Step 3: Receiving Arduino: Wiring and Building.

Wiring the receiving Arduino is a little more complicated. It requires both the RF receiver and the L293D chip.

The RF receiver: The pins on the RF receiver labelled GND are ground. DATA OUT is where the received signal will be sent out. VDD is power for the chip and ANT is for the optional antenna.-Wiring: The RF receiver is connected separately from the L293D chip. The ground goes to one of the ground ports on the Arduino. The power in goes to the Arduino's 5V output and the DATA OUT should be connected to pin 13 on the Arduino. The antenna can be left loose and later connected to the RC car's antenna.

The L293D chip: The pins on the L293D chip are shown on the diagram above. EN1 and EN2 are the motor enable pins. They act as a master on/off switch for each motor. IN1,IN2,IN3 and IN4 are the inputs that control the directions of each motor. If IN1 is powered and IN2 is not, the motor on OUT1 and OUT2 will turn one way. Likewise if the inputs are flipped, so too are the outputs and the motor will turn the other way. 0V is ground and +V is power for the chip. +Vmotor is used as a separate power source for the motors.-Wiring: The wiring for the l293D chip is not as complicated as it may look. The +V and the +Vmotor pins should be connected to and external power supply. In this project we will end up connecting these to the battery pack from the RC car. The IN1, IN2, IN3 and IN4 pins will be connected to pins 3,4,5 and 6 on the Arduino. The two motor enable pins are connected to pins 9 and 10 on the Arduino. The OUT1 and 2 pins go to one motor and OUT3 and 4 go to the other. It doesn't matter which IN pins go to which pins on the Arduino or which OUT pins go to which leads on the motor as these will be defined in code.

Step 4: Receiving Arduino: the Code.

At the top of this sketch, also include the Virtual Wire library:

#include <VirtualWire.h> //Include required library

We will also define some constants that we will use to control our car:

Next comes the variables for the motor pins. The value of these variables will be whatever pin the wire is connected to on the Arduino. If you wired yours up differently make sure you update your code here:

Step 5: Receiving Arduino: Attaching the Car.

For this project you can use any remote control car that uses DC motors.First, remove the casing of the car. Mine had a bunch of screws which I undid and the casing came straight off.Next unscrew the circuit board already in the car, we wont be needing that. Cut all the wires connected as close to the circuit board as possible and remove the board. Now we are ready to wire up our car to our Arduino.Now connect the wires from the motors to the OUT pins of the L293D chip and the wires from the battery pack to the rails that power the chip. The ground of the Arduino should also connect to the negative terminal of the battery pack. Finally, connect the car antenna to the RF receiver antenna pin.

Step 6: Computer Program: Creating the GUI.

For the computer program, create a new Java application in whatever application you are using. I recommend Eclipse. First create a class that extends JPanel which will be used as our GUI. It will also need to implement ActionListener and KeyListener.

In the constructor of our class we will be setting up the GUI layout. In order to achieve the layout above, we will be using a 3 by 4 grid. Note that this does not need to be defined anywhere, we just tell the components what grid space to occupy and the grid is created accordingly. The code below is the constructor for the GUI class and contains the layout of our GUI.

Step 7: Computer Program: Coding the Serial Connection.

Finally we'll add the serial port functionality to our program.To do this we need to download the RXTX library from: http://rxtx.qbang.org/wiki/index.php/DownloadPlace the rxtxSerial.dll and the RXTXcomm.jar into the project folder and add it to the build path in Project>Properties>Java Build Path.Next we'll create a separate thread which we'll put at the bottom of the createAndShowGUI() function:

Did you copy my code exactly or modify it in any way? Try download and use my exact code. It might be an issue with your RF receiver or transmitter, have you used them before, did they work as expected?

Can you make one car for me please i want some addition in it i need a small projector which can rotate and a camera installed inside a car which also can rotate 360 degree to see all four sides of a car and a distance meter to see how much distance did a car moved and if possible make the car 4 wheel drive please replay me as urgent you can please…

hey,friend it's look like u have a great knowlage on arduino i need ur help,i m new to arduino..i want to run arduino programme which i'hv (made for leonardo board only) and check whether there is any error in programme or not..and than i want to upload this programme in programme board and acorrding to programme it'll run 2 gear motor,so how can i check it and load it..can u please tell me step wise instruction or put instructable type vedio..i'll be thankfull,thank you

You can find many good tutorials already on the internet. Try look here: http://learn.adafruit.com/lesson-0-getting-started/the-lessons This will teach you the basics of programming for the Arduino. It works on the Leonardo!

To upload the program to the Arduino use the Arduino IDE here: http://www.arduino.cc/en/Main/Software