Boredom Killer - Arduino Robot Arm Project
Boredom Killer - Arduino Robot Arm Project
So,
I got bored and wanted to find something interesting to do with my spare arduino.. after some research, I found that you can buy a usb host shield for the arduino, and plug in a microsoft xbox controller usb receiver into it, then code it up to control anything... ideas galore arrived.. including my mate begging me to make his ride on mower radio controlled
so I started looking into how to make an easy robot arm. after a while I stumbled across an R/C servo driven robot arm kit! cheap enough that I figured bugger making one... ill just build the kit! Link
so while it was in the post, Holden202 gave me some spare servos to play with and I began coding up the controls. I took the xbox controller library, and the r/c servo library and basically loaded them both into my project and started mapping controls to servo position. its tricker than you think, because an r/c servo wants to be given an absolute position, so if you map it directly it acts like a steering servo, let go of stick and it drives back to the center position. NOT what we want for a robot arm, so I coded up a few loops to slowly tick the servo position value back and forward, to make the controls more like an excavator. it even has speed, the further you push the stick, the shorter the loop and the quicker the servo ticks forward.
anyways, here is the result after I built the robot arm and hooked it all up! I needed some 5v power for the high torque servos, so I ran some speaker wire out of a hard drive connector 5v line in my pc lol...
The kids love it, a big toy.
[youtube]https://www.youtube.com/watch?v=sjsuNJmUKfo[/youtube]
I got bored and wanted to find something interesting to do with my spare arduino.. after some research, I found that you can buy a usb host shield for the arduino, and plug in a microsoft xbox controller usb receiver into it, then code it up to control anything... ideas galore arrived.. including my mate begging me to make his ride on mower radio controlled
so I started looking into how to make an easy robot arm. after a while I stumbled across an R/C servo driven robot arm kit! cheap enough that I figured bugger making one... ill just build the kit! Link
so while it was in the post, Holden202 gave me some spare servos to play with and I began coding up the controls. I took the xbox controller library, and the r/c servo library and basically loaded them both into my project and started mapping controls to servo position. its tricker than you think, because an r/c servo wants to be given an absolute position, so if you map it directly it acts like a steering servo, let go of stick and it drives back to the center position. NOT what we want for a robot arm, so I coded up a few loops to slowly tick the servo position value back and forward, to make the controls more like an excavator. it even has speed, the further you push the stick, the shorter the loop and the quicker the servo ticks forward.
anyways, here is the result after I built the robot arm and hooked it all up! I needed some 5v power for the high torque servos, so I ran some speaker wire out of a hard drive connector 5v line in my pc lol...
The kids love it, a big toy.
[youtube]https://www.youtube.com/watch?v=sjsuNJmUKfo[/youtube]
Re: Boredom Killer - Arduino Robot Arm Project
That's cool as well done
- antus
- Site Admin
- Posts: 8250
- Joined: Sat Feb 28, 2009 8:34 pm
- cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B - Contact:
Re: Boredom Killer - Arduino Robot Arm Project
Real nice work getting the controller to work so smoothly!
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
Re: Boredom Killer - Arduino Robot Arm Project
I remembered seeing a neat idea somewhere for the speed code, where instead of locking up the code with a wait command, you just take a timestamp, then save the current system clock in a variable eg: 'timer' and the speed variable is a millisecond value. so you just have an IF system clock > timer1 + speed value then re enter the code to increment servo position. the speed variable is then mapped to the analog stick axis value. it worked really well, but having to reverse the axis values from the xbox controller (speed value is smaller = faster, but controller is a larger value the further the stick moves) so it took me a little while of brain pain in excel to get the speed formulas right. We used to tell the maths teacher at school, we would never ever use this shit. well the teacher was proven correct tonight.
on a side note... the arduino does struggle a bit, trying to keep up with the PWM control of 6 servos at once. when its still, you can see it twitching a bit lol.
Code: Select all
if ((Xbox.getAnalogHat(LeftHatX, i) < -7500)&& servo1pos < 180) {
servo1speed = (32768+Xbox.getAnalogHat(LeftHatX, i))/400+5 ;
if (millis()>=(servo1timer+servo1speed)){
servo1pos=servo1pos+1;
myservo1.write(servo1pos);
servo1timer = millis();
Serial.print("Servo1 Position:");
Serial.println(servo1pos);
}
}
- antus
- Site Admin
- Posts: 8250
- Joined: Sat Feb 28, 2009 8:34 pm
- cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B - Contact:
Re: Boredom Killer - Arduino Robot Arm Project
Hardware or software pwm generation?
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
Re: Boredom Killer - Arduino Robot Arm Project
its all software PWM... it can use any digital pin, not just the PWM ones (there wouldnt be enough for 6 servos anyway), so its not unexpected for the PWM signal to be a bit less than perfect.
you can buy a servo control sheild that will give accurate control... maybe ill look into that later on.
you can buy a servo control sheild that will give accurate control... maybe ill look into that later on.
- Holden202T
- Posts: 10311
- Joined: Sat Feb 28, 2009 9:05 pm
- Location: Tenambit, NSW
- Contact:
Re: Boredom Killer - Arduino Robot Arm Project
Definitely a good project!
reminds me of that movie Malcolm
reminds me of that movie Malcolm
No matter what the question is, the answer is always more horsepower!
Just starting out? Have a read of the getting started guide
Basic tuning of a delco ECM with $12P thread
Advanced tuning of a delco ECM with $12P thread
Just starting out? Have a read of the getting started guide
Basic tuning of a delco ECM with $12P thread
Advanced tuning of a delco ECM with $12P thread
- VL400
- Posts: 4991
- Joined: Sun Mar 01, 2009 2:54 pm
- cars: VL Calais and Toyota Landcruiser. Plus some toys :)
- Location: Perth, WA
- Contact:
Re: Boredom Killer - Arduino Robot Arm Project
Very cool indeed. Teach it to write your forum posts?
Its not just arduinos that do that Too many shed fumes.Jayme wrote:when its still, you can see it twitching a bit lol.
- Holden202T
- Posts: 10311
- Joined: Sat Feb 28, 2009 9:05 pm
- Location: Tenambit, NSW
- Contact:
Re: Boredom Killer - Arduino Robot Arm Project
lol
No matter what the question is, the answer is always more horsepower!
Just starting out? Have a read of the getting started guide
Basic tuning of a delco ECM with $12P thread
Advanced tuning of a delco ECM with $12P thread
Just starting out? Have a read of the getting started guide
Basic tuning of a delco ECM with $12P thread
Advanced tuning of a delco ECM with $12P thread
Re: Boredom Killer - Arduino Robot Arm Project
I wish I had a bordom problem instead of lack of time problem. Lol feel free to code enhanced lol, well done on the project, were doing this with highschool kids now where they have to design a arm, 3d print it then assemble and code it to solve a problem, tea dunker it is lol