Here is a video of the machine in action.
Video -
Emma after some practice-
Controls -
Pick up and drop -
Overview -
I like to document my work as I go along, so this instructable contains multiple versions with varying components. I think that this is useful because it seems unlickkly that you would happen to have all the same scrap peices as I do. I have also tried to show how to build a moderatly complex system by bulding one peice at a time and then combining them. By keeping things modular you are able to swap out large peices without having to rebuild the whole thing.
Here is a rough outline:
- Get each motor working by itself, I used a joystick with potentiameters to control the motors, one POT per motor
- Get all the motors working at once - by wiring all the motor drivers to the Arduino at once and combing the control codes, we are able to run everything at once. This same setup will be used l to control the whole machine.
- Build a small test rig with just one axis - It is easier to work on something that you can put on a bench top then it is to work with something mounted the ceiling. So I will show you how to cobble together a test set-up that will let us work out some of the details without having to build a large rig.
- Build a large rig - once everything is working on the test rig, we can go ahead and make it bigger. This required some different materials, but the wiring, code, and motor setup don't nned to change.
- Test and improve - Once the system is working it is easy to see things that can be improved. I wound up replacing the original joysticks with a larger controller from a kids game. The whole thing is pretty flexible so there is alot of room for modification and impruovemnt.
Parts -
Most of the project is built with salvaged computer parts. Here is a list of parts that you could salvage or buy.
Power supply - I used a power supply salvaged from a server. There are good instructions for hacking one of these here http://reprap.org/bin/view/Main/PCPowerSupply I also pulled a 12volt power supply out of a printer that would have worked well.
Motors - At least 3 motors are needed. I used 2 DC motors and a pretty big stepper. The DC motors are both pulled from an Epson Printer/Scanner. The stepper is a NEM23 from Keling Technology. A smaller one would be fine. You can get one here http://www.sparkfun.com/commerce/product_info.php?products_id=9238.
Drivers - You can build, buy, or salvage drivers for the motors. Buying is the easiest and they are not two expensive. I used a steppper driver and the DC motor driver from the RepRap Gen2 electornics. The DC motor driver is here - DC Motor Driver v1.1 Kit http://store.makerbot.com/electronics/electronics-kits.html. Sparkfun as a good stepper driver here - http://www.sparkfun.com/commerce/product_info.php?products_id=9402
This motor sheild from Adafruit would work well - http://www.adafruit.com/index.php?main_page=product_info&cPath=34&products_id=81
Microcontroller - The Arduino platform is fun and easy to use. http://www.arduino.cc/ I used the
Arduino Duemilonove with a hefty screw sheild http://store.makerbot.com/electronics/electronics-kits/arduino-breakout-shield-v1-4-kit.html
Controller - I started with thumb joystick controllers like on a PS2 - but I found that a controller from Leap Frog Baby worked out better. http://www.amazon.com/LeapFrog-10210-LITTLE-LEAPS-PLATFORM/dp/B000EIV1OM
Claw - The claw is made from mouse shells and strips of plastics cut from a printer housing.
Wiring - Most of the wiring is discarded cat-5 network cable
Track - For the test rig I used wooden tracks, for the larger set up I used metal J-trim 1/2" x 10' - this was in the drywall section of home depot - it is the only thing I bought specifically for this project.
Remove these ads by
Signing UpStep 1: Control a DC motor with variable resistor
The first thing we will do is to get each motor working with a controller.
Use a joystick with potentiameter to controll the speed and direction of a DC motor.
This will be used to:
- raise and lower the claw
- open and close the clow
Hardware chain:
Joystick (potentiameter) -> Arduino with code -> DC motor driver V1.1 (make.rrf.org\dcmd-1.1) - > motor
Relies on: http://www.reprap.org/bin/view/Main/DC_Motor_Driver_1_1#Wire_up_test_devices
Here is the arduino code:
note: this only runs one DC motor
********************ARDUINO*****************
//******* POT to control a DC motor speed and direction ******//
// define pins and variables
int potPin = 2; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor
int j = 0;
int Dir_A = 4;
int Speed_A = 5;
void setup() {
pinMode(Dir_A, OUTPUT);
pinMode(Speed_A, OUTPUT);
Serial.begin(9600);
}
void loop() {
// Read location of joystick and calculate the distance and from center
val = analogRead(potPin); // read the value from the sensor
j = val - 517; // 517 is center positions - how far from center
j = abs(j); //absolute value
// put some bounds on j to keep PWM values useful
// below 100 the motor won't move and PWM max is 255
if (j >= 510){
j = 510; //the most the PWM pin can do is 255
}
if (j <=200 && j>=10){
j=200; //below 100 PWM the motor makes a high pich sound and does not move
}
if (j <=10){
j=0; // below 10 the joystick is very close to center
}
//Run DC motor A based on analog input from joystick
if (val >= 520){
digitalWrite(Dir_A, HIGH); // other direction
analogWrite(Speed_A, j/2); // PWM out (divide by 2 because max is 255)
}
if (val <= 510){
digitalWrite(Dir_A, LOW); //
analogWrite(Speed_A, j/2); //
}
if (val <=520 && val >= 510) {
analogWrite(Speed_A, 0); // turn off if the joystick is in the center
}
// print values for debugging
Serial.print(val); // send numbers to PC so you can see what it going on
Serial.print(",");
Serial.println(j);
}

































































Visit Our Store »
Go Pro Today »




can you send me the code for two stepper; Stepper X, Stepper Y for pan and tilt http://www.youtube.com/watch?v=ZulNF2enrd0
i have 2 stepper motors, 2 EasyDriver, Arduino uno and Joistick
black_daysro@yahoo.com
thanks in advance ;)
i heve this type of motor shield.
Try looking at steps, 3, 15, 16
Step 3 shows the code for a stepper (which you probably dont need).
Step 15 shows code for a second dc motor.
Step 16 shows these three peices of code combined.
Good luck!
I use youre sketch and it works fine, i don't know how to modify for 2 motors.
what i need to change, add to drive two dc motors (speed and direction)?
please help.
thanks.
the motors are installed in a 4 wheeler cart.
i made a code to control the cart forward and backward using the motors+drivers+Arduino uno+potentiometer
and then i made another code without the potentiometer
using 3 Arduinos ( 1 master and two slaves) each slave is connected to a motor
the code is to apply speed to one of the motors for ex 10 rpm and the other motor
5 rpm .. just to make the cart turns left or right ...
THE QUESTION NOW WHAT IS THE CODE FOR THE STEERING USING THE POTENTIOMETER ??
there will be 2 POTs one for steering and the other for moving.
PLEASE HELP !!!
I need your help, I'm doing a project similar to yours, a pan tilt head and I need to control two stepper motors with a joystick.
Can you help me with the code? How would two stepper motors?
I'd appreciate if you can send photos or a wiring diagram.
Thank you very much.
There are alot of examples of pan-and-tilt using hobby servo motors.
Here is an example of pan/tilt using servos and joystick: http://www.practicalarduino.com/news/id/411
the code is here: https://github.com/practicalarduino/PanTiltControl/blob/master/PanTiltControl.pde
spark fun has parts: http://www.sparkfun.com/products/10335
Good luck!
I like to use stepper motors because they have strength and are accurate. Project where you use your joystick, you use a stepper motor, could you help me with the code to use 2 stepper motors?
I know nothing about programming, so I ask for help.
Thanks for everything,
Greetings.
I was thinking about making a crane game kit.
Do you think anyone would be intersted?
-Marc
And I sincerely hope the mouse you used didn't cost that much.
Spark fun has a 2 finger metal claw for 10$ !
http://www.sparkfun.com/products/10332
the kids are so adorable!!!
It would be an Arduino sheild with a Joystick, Buttons, and Motor Drivers.
I started using BatchPCB.com last night and boy is it fun!
You could certainly try this - but it sounds a bit tricky. I've had better luck with very short drive trains. In this project I've avoid gears and belts as much as possible.
-Marc
Gotcha - that is an intersting idea.
Awsome!
It is fun to cheat - so I would leave out the glass.