Affordable TV Remote Controlled Clawbot
by DesiKid in Circuits > Robots
3216 Views, 25 Favorites, 0 Comments
Affordable TV Remote Controlled Clawbot
This robot can be controlled by a TV remote, and can be programmed to do various tasks. It uses an Arduino and can be built for under $125. This robot was made for a competition for Science Olympiad. It was used to pick up objects of various sizes and weights. It is a fun project to experience the Arduino language and programming. This robot can be used as a base platform for more advanced projects such as adding sensors, and building it bigger for larger projects.
Parts
Arduino Uno (http://www.radioshack.com/product/index.jsp?productId=12268262)
Mini Breadboard
2 Continuous Rotation Servos (http://www.parallax.com/product/900-00025)
Any chassis and some kind of wheels, or tank base (I used a Parallax chassis and LEGO Tank Treads)
IR Receiver (http://www.radioshack.com/product/index.jsp?productId=2049727)
TV Remote (I used a Sony Bravia TV remote)
4 AA Battery Pack (http://www.radioshack.com/product/index.jsp?productId=2062244)
6V Camera Battery
2 Servos (https://www.sparkfun.com/products/10333)
5 Red Wires
6 Black Wires
5 White Wires
2 Blue Wires
1 Yellow Wire
Some Arm+Claw Assembly (I used a wooden arm and a LEGO claw)
Build the Chassis
1. Put tape on the back of the 4 AA Battery Pack
2. Put the battery pack on the chassis
3. Put tape on the back of the Arduino Uno
4. Put the Arduino Uno on the battery pack
The finished chassis should look like this
Add More to the Chassis
1. Tape the normal (non continuous rotation) servo on the front left of the robot
2. Tape the 6V battery next to the servo
3. Tape the mini breadboard next to the 6V battery so that the mini breadboard is between the 2 battery packs
Add the Drivetrain
2. Screw in the servo using screws and nuts (don't screw in the bottom right if you are using my tank treads)
3. Repeat steps 1-2 on the other side (don't screw in the bottom left if you are using my tank treads
4. Reroute the servo wires as shown in the picture
Add the Wheels/Tankbase
If you are using your own wheels, screw them on now
1. Take the LEGO wheel and screw it onto the servo horn (do the same for the other side)
2. Build the front tank base for both the sides
3. Screw in the front tank base on both sides
4. Stretch the rubber tank treads over the 3 wheels
Arm
For the arm, I cut a wooden ruler that I found at Home Depot to about 8 inches long. I screwed the wood into the servo arm so that the servo arm would have a fixed attachment to the robot. I then wired it as shown in the image above.
Claw
I custom built my claw using a Hitec servo, but any servo should work. My claw was built primarily of LEGOs and had a nice glove like feel so that it could pick up balls. At the front, I had a rubber grip so that it had precision. On the bottom of the rubber, we put scotch tape so that it slid smoothly on the ground. The servo cable was just twisted around the wooden arm.
Wiring
The wiring looks complicated, but it is actually very simple.
The 4AA battery pack gets connected to all the servo's positive and ground. The ground of the battery pack also gets grounded to the Arduino board.
The arm servo signal connects to pin 5
The claw servo signal connects to pin 6
The right drive servo signal connects to pin 9
The left drive servo signal connects to pin 10
The IR receiver signal connects to pin 11
The IR receiver positive connects to the 3.3V pin on the Arduino
The IR receiver ground pin connects to ground on the Arduino
DO NOT CONNECT THE IR RECEIVER TO THE 4AA BATTERY PACK!
The 6V battery positive connects to the Arduino Vin pin
The 6V battery ground connects to the Arduino ground pin
The Code
Before uploading the code, you have to download the IRremote library.
#include <Servo.h>
#include <IRremote.h>
Servo servoLeft; // Define Left servo
Servo servoRight; // Define Right servo
Servo servoArm; // Define Arm servo
Servo servoClaw; // Define Claw servo
int RECV_PIN = 11; // IR Receiving Pin
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
servoLeft.attach(10); // Set Left servo to digital pin 10
servoRight.attach(9); // Set Right servo to digital pin 9
servoArm.attach(5); // Set Arm servo to digital pin 5
servoClaw.attach(6); // Set Claw servo to digital pin 6
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver }
void loop() { // Loop through motion tests
if (irrecv.decode(&results)) {
long int decCode = results.value;
Serial.println(decCode);
switch (results.value) {
case 0x2F0:
Serial.println("Forward");
servoLeft.writeMicroseconds(1700);
servoRight.writeMicroseconds(1300);
break;
case 0x810:
Serial.println("SlowForward");
servoLeft.writeMicroseconds(1520);
servoRight.writeMicroseconds(1480);
break;
case 0xAF0:
Serial.println("Reverse");
servoLeft.writeMicroseconds(1300);
servoRight.writeMicroseconds(1700);
break;
case 0x910:
Serial.println("SlowReverse");
servoLeft.writeMicroseconds(1480);
servoRight.writeMicroseconds(1520);
break;
case 0xCD0:
Serial.println("Right");
servoLeft.writeMicroseconds(1600);
servoRight.writeMicroseconds(1600);
break;
case 0xA50:
Serial.println("SlowRight");
servoLeft.writeMicroseconds(1520);
servoRight.writeMicroseconds(1525);
break;
case 0x2D0:
Serial.println("Left");
servoLeft.writeMicroseconds(1400);
servoRight.writeMicroseconds(1400);
break;
case 0x710:
Serial.println("SlowLeft");
servoLeft.writeMicroseconds(1480);
servoRight.writeMicroseconds(1475);
break;
case 0xA70:
Serial.println("Stop");
servoLeft.writeMicroseconds(1500);
servoRight.writeMicroseconds(1500);
break;
case 0x290:
Serial.println("Pos4");
servoArm.writeMicroseconds(1700);
break;
case 0xC90:
Serial.println("Pos3");
servoArm.writeMicroseconds(1500);
break;
case 0x490:
Serial.println("Pos 2");
servoArm.writeMicroseconds(1300);
break;
case 0x5CE9:
Serial.println("Pos1");
servoArm.writeMicroseconds(900);
break;
case 0x70:
Serial.println("Pos0");
servoArm.writeMicroseconds(2000);
break;
case 0x890:
Serial.println("Open");
servoClaw.writeMicroseconds(1700);
break;
case 0x90:
Serial.println("Close");
servoClaw.writeMicroseconds(1000);
break;
break;
default: Serial.println("Waiting ..."); }
irrecv.resume(); // Receive the next value
}
}
This code is very simple to understand because it is a lot of repetition.
The start #includes are just directing the board to use the two libraries (Servo.h comes downloaded with Arduino IDE)
After that, Servos are being defined so that the board knows how many servos there are, and what to call them.
Then, the IR receiving pin is defined as pin 11 and being asked to decode the results of what it receives.
In void_setup, the servo pin numbers are defined, and the serial and IR receiver are started.
In the void_loop, the program decodes the IR codes, and does things in a case statement. A case statement is similar to an if statement, but it uses less lines of code. It checks whether the case is met, and if so, it executes the code under it, until the break statement.
To get the IR codes of your TV Remote, run the IRrecv_demo example in the IR Remote library. Press buttons and note the codes that you are receiving per button. Replace my TV Remote codes (after the case statement following 0x) in the program based on the buttons you want to use. You do not have to use all the features. The servo.writeMicroseconds(xxxx) simply tells the servos what to do, such as to spin in one direction, or what position to go to. These values can also be played with.
Upload the program to your Arduino and you should be good to go!
If there are any questions, feel free to comment and I will answer promptly.