RC_2.pde (1597Bytes)
Hello guys, this is my second tutorial. After a painstaking 2 days of work, finally got this working and I would like to share this with you guys. Okay I want to make this as short and understandable as possible.
Here are the things you need:
- A RC toy(car) with the RC controller (any cheap one will do as long as it is working fine)
- An Arduino (I used UNO but any other Arduino would work)
- Few LEDs
- A Breadboard(optional)
- A multimeter
NOTE:
Imust tell you one thing though, the RC reciever of that used by me and you will obviously be different, do not worry, a little bit of trial and error will get it working.
First unscrew your RC toy (ya say goodbye to him).
You should get something that looks like this, it is the reciever (yous may/will look different than this)
:
The first this you should do after seeing your little board is Google in that top line of the chip like in this one it is SM6135W, and after a quick search you will find its datasheet.
Like for mine, birdmun helped me find this http://pdf1.alldatasheet.com/datasheet-pdf/view/152941/ETC1/SM6135W.html , I know it is in Chinese but what do you expect, China is the nation that manufactures all these toys.
But this is what we are looking for:
It tells us a lot about the chip and what goes where.
You remember the board you pulled out of your RC car just some time back, here is what its underside should look like:
The first thing is you should connect the VCC of the receiver board to 5V of Arduino and GND of the receiver to the GND of Arduino.
Usually GND and VCC will be labelled on the receiver board.
Once you know what the GND and VCC are , it won't be difficult to find out where the forward, backward , left , right etc. pins are.
Here is what I did to find out:
As you can see the yellow wire has one free end, you can simply use a female header wire for this job.
Okay now open Arduino program, File>Examples>2.Digital>Button.
If you have used other pins for the LED or the yellow wire then no problem, just modify it in the program, load the program to the Arduino and let the Arduino be connected to your PC via USB. The receiver module will use power from the USB via the Arduino board.
Once the program has been uploaded successfully, just check if the LED is glowing or not, if it is glowing then go back to your program and change the "if (buttonState == HIGH)" to "if (buttonState == LOW)". You need not do that but I prefer it this way :P.
Okay now you may need some assistance from your little brother or sister, tell him/her to push "FORWARD" the analog on the RC controller and tell him/her to not leave it.
Now its your part, using the free end of the yellow wire touch different solderpoints of the receiver module (If you are good at circuits then by now you should have figured out where the FORWARD of the chip as shown in the datasheet will be soldered, but I prefered the trial and error method, its way more exciting :D).
Where ever you get a change in LED (example, if the LED did not glow before and now when the yellow wire touched some solderpoint the LED started glowing) you have found your FORWARD pin.
Similarly tell you little brother/sister to pull "BACKWARD", "RIGHT", "LEFT" etc. and do the same yellow wire trial and error method to find all the respective pins.
Once you have found all these pins, just solder some wires carefully to them and now you can control 4 different commands (or 4 LEDs , sorry but I really love those Light Emitting Diodes).
Now you just need to modify your program like this:
(check attachment or the below program, don't worry about the bullets, just copy paste)
- const int frontpin = 7; //pins of the RC
- const int backpin = 8;
- const int leftpin = 6;
- const int rightpin = 5;
- const int ledPin1 = 12; //pins of LEDs
- const int ledPin2 = 11;
- const int ledPin3 = 10;
- const int ledPin4 = 9;
- int frontstate = 0; //inital states of the pins
- int backstate = 0;
- int rightstate = 0;
- int leftstate = 0;
- void setup()
- {
- pinMode(ledPin1, OUTPUT); //declaring ledpins as outputs
- pinMode(ledPin2, OUTPUT);
- pinMode(ledPin3, OUTPUT);
- pinMode(ledPin4, OUTPUT);
- pinMode(frontpin, INPUT); //declaring RC pins as inputs
- pinMode(backpin, INPUT);
- pinMode(rightpin, INPUT);
- pinMode(leftpin, INPUT);
- }
- void loop()
- {
- frontstate = digitalRead(frontpin); //reading changes in RC pins
- backstate = digitalRead(backpin);
- rightstate = digitalRead(rightpin);
- leftstate = digitalRead(leftpin);
- if (frontstate == LOW)
- {
- // turn LED on:
- digitalWrite(ledPin1, HIGH);
- }
- else
- {
- // turn LED off:
- digitalWrite(ledPin1, LOW);
- }
- if(backstate == LOW)
- {
- // turn LED on:
- digitalWrite(ledPin2, HIGH);
- }
- else
- {
- // turn LED off:
- digitalWrite(ledPin2, LOW);
- }
- if(rightstate == LOW)
- {
- // turn LED on:
- digitalWrite(ledPin3, HIGH);
- }
- else
- {
- // turn LED off:
- digitalWrite(ledPin3, LOW);
- }
- if(leftstate == LOW)
- {
- // turn LED on:
- digitalWrite(ledPin4, HIGH);
- }
- else
- {
- // turn LED off:
- digitalWrite(ledPin4, LOW);
- }
- }
If you want to perform different actions via RC commands, you have to just change what is included inside the 'if' statement. I had used this to control SPYRO, worked perfectly.
I hope I kept my words of keeping this tutorial short :P.
Hope you got it working using this tutorial.If you have any questions, don't(and never) hesitate to ask :) .
All the best!