Pages: [1]   Go Down
Author Topic: joystick using servo motor  (Read 1261 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

M using an arduino diecimila to control two servo motors m currently writing a code for the PID to control the motors, but i ran into a problem as the motor is supplied will power m unable to move the motor manually. i need for one motor to be running freely as the other one sits in the centre with a PID applied for the joystick to move forward. is a way of having a servo motor move freely in code but being able to track its position
Logged

New Jersey
Offline Offline
Full Member
***
Karma: 0
Posts: 193
Ard at work
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Unfortunately, with a regular servo, the position sensor is built-in and not accessible from the outside. You might be able to get that information with special digital servos that offer other interfaces (such as I2C) than the normal pulse duration control interface, but not with a regular servo, and not with most digital servos.

 smiley-sad
Logged

----------
Mathieu

New Jersey
Offline Offline
Full Member
***
Karma: 0
Posts: 193
Ard at work
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a cool example of what you can do if you DO go thru the trouble of accessing that pot's signal, tho:

http://www.cibomahto.com/2008/02/thing-a-day-day-9-servo-as-input-device/
Logged

----------
Mathieu

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

do you know how to control the servo motor position using a PID. can you send a sample code please
« Last Edit: October 26, 2008, 07:58:52 am by pkm360 » Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 323
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can show you how to read a POT to determine a servo position, or at least know it's position. But, you would only have two options for using it:

1: get rid of the servo's controller.  use it as a standard DC motor, and run the POT leads from the case off to your arduino.  You can use the pot to determine it's position (you'll now have 1024 positions instead of 180).  My code shows how to prevent damaging the pot by stopping well before its rotational end.  This is what my code covers.

2: use a gear-train.  Use a pot as the shaft of a driven gear.  You can now use your servo as it is w/ the normal servo libraries.  Drawbacks = depending on your gearing, you'll get reduced resolution.  For example, your servo is driving a gear, such that the driven gear is 2x larger (2:1 ratio).  This reduces your resolution by half (it takes 2 turns of the servo to make one turn of the driven gear) - you could do 1:2 (half size of servo gear), and increase resolution, but you'll lose torque.

Here's the how-to on it: http://roamingdrone.wordpress.com/2008/07/24/diy-servo-with-arduino-dc-motor-and-potentiometer/

For the proportional, integrative, derivative function - you'll have to come up w/ that yourself.  But, if you know what you intend to achieve, it's not hard at all. Well, assuming you can get your head around the integral part - time to brush up on the ol' calculus =) Start here: http://en.wikipedia.org/wiki/PID_controller

!c
Logged

Pages: [1]   Go Up
Jump to: