Position control of a servo or stepper motor.

Hi, I am looking to construct the following project:
I have an 82 Jaguar XJ6 and I am looking to retrofit it with the New Dial Gear Shifter from the 2010 Jaguar XF. I have acquired the Shifter, and took it apart. Due to a lack of space, I came to the conclusion that I will be using reflective photo interrupters around part of the rotating gear to send a signal when the Gear Knob is in a certain position.
i.e. ( in the PARK position, photo int. #1 will be on, in the REVERSE position photo int. #2 will be on and so on, up to 5 switches)
I would want to use these digital signals to tell the Arduino what gear the shifter knob is in ( not that the Arduino board cares, but I do)
The Arduino would than control either a stepper motor, or servo, which would be connected to the shifter linkage cable, and pull or push the cable into a desired position.
The Arduino would need to recognize what location the stepper/servo is in, so it knows what direction to rotate and how far to go, when the gear selector is changed.
ie. ( if you are in DRIVE, and Move to Park, the Arduino needs to know to rotate the stepper/servo and go to the Park Position, or if you go from REVERSE to NEUTRAL or DRIVE, it needs to know to travel the appropriate distance and direction.
I have seen several posts on the Forum using the search option, but none of them specifically address what I want to do, or the thread ends with no clear answer.

So here are the following questions:

  1. What would be better suited a Stepper Motor or a Servo?
  2. How can I read the shafts current position and have the Arduino decide, depending on which switch is activated, where to go?

From reading the forum posts, I had the following thoughts:

  1. Use a stepper motor with an encoder and beg someone to help me with the programming.
  2. Use a Servo, assign resistance values to photo int. switches, and turn the servo to match the resistance values, like the demonstrations of the servo that uses a pot. But instead of sweeping a pot, using the fixed values to get the servo to a fixed position.

I am a Mechanic by trade, and the mechanical work is nothing for me, however electronics is just a hobby of mine. Up until now my electronic experience is simple 555 timers, decade counters, LCD displays, and flip flops.Maybe an H-Bridge or two along the way.

Any help and advise is appreciated. I know with the complicated design of the new gear shift that it would be very difficult to control via, IC's and gates. So Now I am throwing myself into the land of micro controllers.

The electronics and actuators will all be mounted in the center console. You are correct the outside is a bad environment for electronics, heat, moisture, vibration all of these things plus more have an influence on the outside.
Also being mounted in the interior means, if the battery dies or some other malfunction happens, I will be able to remove the cup holders, and gain access to the linkage, and move the cable by hand.
As far as the torque required I had my eye on either the linear actuators, like you proposed or a Hi Tec HS-7980. It has an amazing 600+oz/in of torque for such a small box. In any case that will require more research. I'm not sure exactly how many inch pounds of torque it takes to move shifter linkage. However I am certain it is relatively low. I don't know of any little old ladies who can't get the shifter out of Park ( Barring the occasional parked on a hill, binding the parking paw scenario.)
As far as other shift by wire safety precautions I have worked out most of what I can think of, to include AND gates to cut power to the shifter photo int. switches unless the brake is applied and there is no speed signal from the speed transducer
Also more gates to prevent you from shifting from Drive to Reverse unless the car is not moving etc..
As far as speed of the shifting. I would think that if it can move from Park to Low 1 which is five positions in about 3-4 seconds give or take, that is reasonable. So the Servo will not need more than 180 Degree rotation ( most likely less).
I'm not too concerned about the Mechanical part, I know I can work it out.
The part I need help with , is the part you say is the easiest, Calculating the "delta". :o
Also for cable position, the actual gear select detents are in the transmission. Besides the Park/Shift interlock, which in most cars won't let you take the car out of park without your foot on the brake, The cable itself has no locking mechanisms. The Servo or stepper motor will not need to hold at any position as the holding power is in the detent of the transmission, which is internal to the valve body. So all the Servo needs to do is pull the cable to the required position ( which needs to be accurate, but not super accurate, because once the cable stops near the detent position,it will be close enough that the valve will drop into the detent position. ( if that makes sense to you)
So any help on whether to use a servo or stepper, and where to find code, or help with the coding to find the "delta" would be greatly appreciated.

I guess that was going to be my next question, do you think the Duemilanove has enough in and outputs or should i use the Mega one. I think the bigger one I saw at RobotShop had twice the inputs and outputs.
The Jag XF is shift by wire as well, SO I am going to get the specs of the servo Jag uses to move the shift linkage and get either a used Jag one, or get a comparable one from online.
I thought cutting the power or ground to the switches would be a good lock out, since that would prevent any vibration or malfunctions from sending a false signals to the controller telling it to go into park while I'm at highway speed.
The other thing I was going to do, was use a relay to switch off the power to the servo once I was in motion, that way even if the Arduino did send a false signal for whatever reason, the servo would not move until the car was stopped.
But we can brainstorm more on this when I get to that point.

" Servos tend to pull the output shaft back to the neutral/default position when the power is restored, and before the controller has a chance to tell it where it should be."

I didn't know that. I figured without a signal they would just stay where they were, until told to do something else. I guess I will have to figure out a way to remove the power from the motor windings of the servo, maybe with a timer, until the Arduino has time to boot and receive the position signal from the servo.

OK I ordered an experimenters kit from Robot shop it comes with a servo and some other useful parts. I am going to start playing and see what I can learn. In the mean time, if you or anyone else has any advise feel free to post, I'll be checking back periodically for input. As well as probably asking beginner questions as I burn up my first Arduino! :smiley:

Im listening too here. Any luck with the gear by wire project??
I need something similar to your project, but do not have any experience with arduino's or programming.
Though I'll be controlling a 722.6 gearbox shifter from a Mercedes in a W124.
Just to lose the shifter.

I've been working on the HVAC system currently because I'm taking out all of the vacuum diaphragms and Lucas Electronic Garbage and replacing it with newer model HVAC controls. Once that is complete I will be back to work on the shifter. It is mostly done as far as planning, I just haven't bought the actuators or photo interrupts to make a working model yet. I'll be posting my work as I get it completed.