Introduction: Changing an Old RC Car to an Autonomous Car
Well this is just a part of my complete project, but anyway I thought it will be useful as well its just cool! This project is for the kind of RC cars that have a group of wires ,or a group of joint wires, connected to the receiver that is present in the car. My RC Car had totally three wires, each one consisting of 2 wires joint together.
Step 1: Components Required
So the components required are pretty basic and the total cost isn't more than $15 (or 1000 INR as i am from India) -
1) Arduino Uno (even Nano or Mega are fine)
2) An 8 channel relay- it depends on the number of wires your car has mine had 3 (*2 because it was a bundle) and as 6 channel relays weren't available so I used this for people from India and this for others but as the second one is unavailable even this is a good replacement.
3) Jumper Wires
You can also use an HC-SR04 distance sensor as an additional no crashing function but it isn't actually required.
Step 2: Explaination and Logic
My car has, as I said before (twice), 3 wires. Now I will explain what are they for and how to identify and differenciate them. There are 3 of them as my car needs two for Forward/Backward for the front tyres and the back tyres, and one for Left/Right in the front tyre. As I am going to mention them frequently, lets name the front tyre's wire as F, back tyre's as B and the turning wire as T.
So, easily enough, you can identify the one that comes from back as B but when we try identifying F from T, things get a little tricky. If you are lucky and your receiver module has it all labelled then I envy you. But there is a (comparatively) easy and safe way out. The theory is that the motor that turns the vehicle consumes lesser power than that of the actual forward moving motor. Simply connect one wire of the wires to the 5V on the Arduino and other to GND. If you see the vehicle tyre going left of right, BINGO! else try in the other wire, you'll get it
My car uses a 4.8V lithium battery for power (pic attached above). Like all other batteries, it has a GND (black wire) and a VCC (red wire)
I have also attached an image of a rough diagram of one channel of the relay. I dunno if it explains everything but that is the main concept.
Briefing on the relay- its NC or Normally Closed is permanently connected to the COM or Common (unless the relay is given LOW) when it connects to the NO or Normally Open.
So the connections are-
Step 3: The Connections Accordingly
The 8 channel relay has a common GND and VCC for all the relays (Not to be confused with the COM or the GND or VCC of the Lithium Battery). Connect the VCC to 5V (as it requires) and GND to GND. Connect the IN1...IN6 to any 6 digital pins of your choice (except 13, which is for the LED and 0 or 1 which are RX and TX).
Coming to the relay, simply connect the NC of Relay 1 to the NC of Relay 2 and that to the one of Relay 3 and same till Relay 6. Repeat procedure for NO.
Now connect the NC wire to the black wire or GND of the li-on battery and the NO to the red wire or VCC of the same.
We are left with the 6 COMs. Connect the COM of Relay 1 to one connector of the F, if you remember the abbreviations and the COM of Relay 2 to the other. Repeat procedure with Relay 3,4 and 5,6 with B and T respectively.
Step 4: Understanding the Code
Abbreviations used in the code-
FF- Front - Forward
FB- Front - Backward
BF- Back - Forward
BB- Back - Backward
For function (movethecar)
Some important points in the code
1) change the pin numbers according to your setup
2) Change the movethecar parameters from (false,false,false,false,1) to the way you want it to move. Remember that the last condition is duration, not delay so the car will go back to stopping after those number of seconds.
3) Enter the duration in seconds, not the usual milliseconds
Most of it is done- now just the last step is required
Step 5: Fixing Everything to the Car
Now fix the relay & the arduino on top of the car using a Glue Gun (actually anything is fine).
Charge the Lithium Battery for 4-5 hrs and then just keep it firmly on to the vehicle.
Now POWER UP your Arduino using a powerbank of 7-12 V and watch your car moving AUTONOMOUSLY
Step 6: For the People Who Want to Use a Distance Sensor
Stick the HC-SR04 to the bumper of the car so that its view is uninterrupted
Use the distance sensor code from the file i have attached
You can always ask for help BELOW IN THE QUESTION SECTION.
Participated in the
Make it Move Contest