Intro: Joystick Controlled Remote Car
We always are interested in remote controlled cars. Here I'll show a way to use the Joystick module with Arduino and build a remote controlled car using Infra-Red as the transmitting medium.This will be an interesting project for a wireless car and will be interactive too since it uses joystick that we use in our XBOX or Play-Station. And another thing is that it will be the cheapest way of communication.
Step 1: Components Required
1. IR LED 1pc
2. TSOP 1738 IR receiver 1pc
3. 2 Arduino UNO/nano/mega/micro
4. Jumper wires
5. L298/L293 motor driver 1pc
6. Castor wheel 1pc
7. DC toy geared motor and wheels 2pc
8. Chassis for car
9. Joystick module 1pc
10. Tapes,Screws,Screw driver,Double sided tapes
11. 1 powerbank
12. 1 9V battery with battery clip
Step 2: Working Principle
The car is based on IR transmission method, that means that the IR LED at transmitter remote(TX) will send HEX codes and the receiver at the car will get those values and car will move likewise. The arduino at TX side will read the analog values from joystick and will likewise send the required HEX code via the IR LED. The TSOP receiver at the car can read those HEX values and car will move likewise.
The joystick is just a analog device that uses 2 potentiometer to give analog values, one for each direction. The two direction is just the X and Y direction, and one potentiometer is meant to be for one direction. Hence for one position of joystick shaft, we have two analog values of joystick, one for x and another for y. So for any position of joystick we always have 2 values, and I have written the code to read those values and used different conditions( like, joy-shaft at up position, down position, right,left) to send HEX values using IR LED.
I have used two Arduino UNO, one for transmitter(remote) and other at receiver(car). Basically any microcontroller is able to do the job, but people are more familiar to arduino environment, so I used arduino as easiest solution.
The TSOP1738 is an infra red receiver and can detect 38KHz IR data, which our remotes send. Actually these devices are being used inside TV to get signals from remote.Our TV remotes operate at 38KHz.
There is an excellent library for using this IR LED as well as TSOP receiver, the IRremote.h library. Download it here, extract it and paste in arduino libraries folder. https://github.com/z3t0/Arduino-IRremote
I've used L298 motor driver at receiver(car). You can use L293 too. I've used powerbank to power up both the receiver's arduino as well as the motor driver.
The transmitter side is being powered by using a 9V battery.
Actually you can use any transmission method, but here I'm interested with IR since is the cheapest transmission medium. IR is prone to light disturbances so you might not get 100% satisfactory results, but in 90% cases it works just fine.The TSOP is a very powerful receiver and can detect IR data even 3-5 meters.
See the circuit diagram and I've also given the Fritzing file here. You can download fritzing here
see also the TSOP datasheet if you are interested http://www.micropik.com/PDF/tsop17xx.pdf
Step 3: Building the Circuit
See the circuit diagram in the previous step, and construct both the TX and RX(receiver-car) circuits. You may require double sided tapes and insulation tapes. Construct the chassis and attach motors too using screws.
Now if you are using motor driver for first time then first just program your arduino to move the two motors forward( it is just a matter of digitalWrite to the 4 IN pins), then move backward ,then right then left. You may have to reverse the motor's polarity during your first test with motor driver. You can use YouTube too, your best friend.
I have used a barrel jack to connect my 9V battery to the TX arduino, you can directly insert to Vin pin too.
The L298 at RX is powered up using powerbank and it works fine if you are using toy geared motors
Step 4: Upload Code
Now upload the two codes to the two arduino. the files are attached here. power up the receiver powerbank and the 9V battery of the TX side. Now you can add a driver transistor at the TX side to further increase the range of the remote, without the transistor it will work at less than 1 meter range,beyond it can create some problems. You can also use your own HEX and DEC values in the code. See the videos embedded here to see the final working.This is the cheapest remote car you will ever see, no use of WiFi,Bluetooth,433MHz,etc
So now drive around, give it to your kids and let them enjoy, for any problem comment down here, or mail me at firstname.lastname@example.org