Converting Lever Motion into 0-5V signal.

Hello everyone, my name is Lodi, 20, and I live in the Netherlands.

I need some help; I need to convert the motion of the lever (see pics) in to a 0-5V signal. My plan was to use a sliding potentiometer on the end of the metal rod, will this be durable enough if I make the platform moveable(because the motion is not precisely horizontal)?

The problem with this is that I will need a potentiometer with the exact travel of the rod, else the signal will not be 0-5V. I know that I could use a scaling code using the Arduino, just have to figure out how.

I am using a 21v3 JRK controller in the output servo, so normally I could scale the input to 0-5v, But I am using 2 inputs(switched), one is an encoder that sends a 0-5V signal, and the other is this potentiometer. If I were to scale the signal in the jrk, the encoder would not work properly, and vice versa.

Could you guys help me with this problem? I mainly openend this topic to get some help with the lever motion to 0-5v signal.

Thank you,

Lodi

Hi

I know that I could use a scaling code using the Arduino, just have to figure out how.

Look up map function in arduino ide reference, it will do the scaling for you.

Tom..... :) I assume you want to use the arduino to control the motor on the arm with position feedback to put it in any position you want?

Hello and thank you for the reply.

I’ve read the map-page of the Arduino site, but from my understanding it seems that the Arduino (Uno) is only capable of converting a 0-5v signal to either a Digital (0 or 1 (?)) or PWM signal.

What I want to use the Arduino for is; converting a (for instance) 0-2,3v signal to a 0-5v signal. Both analog, so basically I am talking about an amplifier.

The reason I want to use the Arduino for this, is that we already use the board for another motor, and this would keep the complexity of the system to a minimum.

The servo that I am referring to in This topic, has the 21v3 JRK inside(+feedback), so that will actually control the servo. The o-5v signal that I am looking for is used as an input signal.

Thank you in advance.

Lodi,-

I don't really understand what you want to do. Can you post a link to the datasheet for the 21v3 JRK?

If you need to produce a genuine voltage then you need an external DAC chip.

...R

Lodi: What I want to use the Arduino for is; converting a (for instance) 0-2,3v signal to a 0-5v signal.

The arduino is capable of reading an analog value. It runs from 0 (0V) to 1023 (5V). So your 0-2.3V will run from 0 to 470. You can map this to an PWM output that will (effectively, because it'll stay PWM) become 0-5V.

Same as above but in Dutch: Een arduino kan je analoge waarde gewoon inlezen. Het gaat dan van 0 (0V) tot 1023 (5V). Dus jouw 0-2,3V zal lopen van 0 tot 470. Met de MAP functie kan je deze naar een PWM uitgang brengen naar (Effectief, omdat het PWM blijft) 0-5V

Hi,

The datasheet can be found here: http://www.pololu.com/docs/pdf/0J38/jrk_motor_controller.pdf

I understand that I could use the effective voltage that the PWM signal will 'produce' to receive the same voltage. But the controller can not receive voltages higher than 5v, and with the PWM signal (60% effective(?)) this could damage the (jrk)board.

Besides that, the controller is configured for an Analog voltage input, and not for a PWM input.

Robin2 probably answered my question, what I want is a constant voltage output (between 0-5V).

If I am wrong, please tell me ! :)

Thank you guys so far.

Lodi,-

(Bedankt voor de Nederlandse uitleg, maar Engels begrijp ik zowat beter dan Nederlands, dus het hoeft er voor mij niet per se bij :) )

But the controller can not receive voltages higher than 5v, and with the PWM signal (60% effective(?)) this could damage the (jrk)board.

No the output from the PWM pin is 5V maximum. What is this "60% effective" all about?

Besides that, the controller is configured for an Analog voltage input, and not for a PWM input.

A simple RC filter will turn PWM into an analogue voltage. See:- http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Right, now I get the picture.

You want to derive the feedback voltage for the servo motor controller.

This has (and it is funny how often we have to mention this here,) absolutely nothing to do with an Arduino - it cannot be used for this function, it would be entirely useless as it would delay the reporting of the feedback voltage.

Firstly, it becomes apparent that whilst the feedback voltage should be in the range 0 to 5V, it does not have to be the whole of that range. Since your input (to the controller) is digital, it will suffice that you restrict that input to values that correspond to the actual feedback voltages - perfectly easy to do.

Secondly, in answer to your original question "will this be durable enough", no it certainly will not. The potentiometer you illustrate is far too flimsy for the task. I cannot suggest a linear transducer particularly appropriate, but since you evidently have an engineering department on hand, I would suggest arranging a gear-driven rotary wire-wound potentiometer specified for durability. If you insist on obtaining a full 0 to 5V output corresponding to the actual range of arc (which should be limited as you do not want to ever have the potentiometer hit its end stops) then you need a ("rail-to-rail") op-amp circuit which you can research. No Arduino! :o

Is that sliding rod just for reading the position of the lever?

The lever pivots about a fixed center. Then why not just drive a rotary pot that has it’s center inline with the lever. A “U” bracket from the lever ( to bypass the pivot area) to the pot.

Thank you guys for responding, :

Grumpy_Mike:

But the controller can not receive voltages higher than 5v, and with the PWM signal (60% effective(?)) this could damage the (jrk)board.

No the output from the PWM pin is 5V maximum. What is this "60% effective" all about?

Besides that, the controller is configured for an Analog voltage input, and not for a PWM input.

A simple RC filter will turn PWM into an analogue voltage.

The 60% effective refers to the average ouput voltage of an alternating signal(with a constant pulse width), where only the Vmax changes in time. I used this incorrect here, because this is not the case with PWM. I actually thought the average of an AC signal was around 70% of Vmax, but my book said 60%, that's why. Sorry!

Thank you for the link.

Paul__B: You want to derive the feedback voltage for the servo motor controller.

...it does not have to be the whole of that range. Since your input (to the controller) is digital, it will suffice that you restrict that input to values that correspond to the actual feedback voltages - perfectly easy to do.

Secondly, in answer to your original question "will this be durable enough", no it certainly will not. The potentiometer you illustrate is far too flimsy for the task. I cannot suggest a linear transducer particularly appropriate, but since you evidently have an engineering department on hand, I would suggest arranging a gear-driven rotary wire-wound potentiometer specified for durability. If you insist on obtaining a full 0 to 5V output corresponding to the actual range of arc (which should be limited as you do not want to ever have the potentiometer hit its end stops) then you need a ("rail-to-rail") op-amp circuit which you can research. No Arduino! :o

Yes, and that is also exactly what my question was referring to (or atleast should have). So that answers it for me.

I understand that the feedback voltage does not have to be the full 0-5V to be able to control a full-motion movement. This option is also available in the JRK interface. You can either write a code for the Arduino or use the software for the JRK. This is not a problem and works like a charm!

BUT the problem with doing this is, is that I have 2(switched) input signals; 1 from the potentiometer, and 1 from the encoder with a fixed 0-5V output (actually 0-10v with a divider). I could scale the output from the potentiometer with the JRK, but then I would need to rescale it again whenever I want to use the encoder to control the servo. So this is not an option, hence the reason why I wanted to use a potentiometer that had exactly the range that I needed. I will research further into the Rail-to-Rail OpAmp, because that is probably what I need.

justone: Is that sliding rod just for reading the position of the lever?

The lever pivots about a fixed center. Then why not just drive a rotary pot that has it's center inline with the lever. A "U" bracket from the lever ( to bypass the pivot area) to the pot.

The original setup uses a hydraulic master cylinder that is connected to a slave cylinder. The rod connects to the master cylinder. My job is to make this action electrically controlled, without modifying the original equipment to much.

So: Yes the sliding rod is used to measure the position of the lever. I thought about using a rotary potmeter on the fixed axle, but that gives me the same problem of not having the full 0-5v out of the box(the motion is only around 40 degrees).

Since this is for an automotive application, I wanted to use an electric accelerator pedal and be done with it. But they insisted that I used the existing lever. :P

Thanks for the help and I hope this clears some stuff up.

Lodi,-

My idea right now is to use a rotary potmeter on the fixed axle. And use a non-inverting OpAmp circuit (5V) to amplify the signal to 0-5V.

To make the system adjustable, both resistors in the circuit will be variable.

Do you guys still want me to update this thread as I am progressing? I am no longer using an Arduino, hence the question.

Lodi,-

Hello again,

I went with the idea of an U-bracket to connect a rotary potentiometer to the lever. This is what I ended up with:(U-bracket is still a 'prototype')

Instead of using an OpAmp to amplify the signal, I will be changing the voltage divider to reduce the voltage of the encoder from 0-10v to 0-1,6v. (instead of 0-5v)

Regards,

Lodi

The very first answer you got holds the solution. You can choose a sliding potentiometer with more travel than required. Then your map function will use the min and max values you expect to get.

ie

//example max and min.
//find your actual by investigation
int maxV=973;
int minV=104;
const int potPin=3;//or whatever you use

void loop()
{
  int myReading=analogRead(potPin);

  //if you want your value in the range of 1 to 100 result
  myReading=map(myReading, minV, maxV, 1,100);

  //Now you just have to work out what to do with it
}

Thank you for the example, I'll try that out !