Author Topic: Finding remaining voltage from joystick potmeter and LM258  (Read 1023 times)

0 Members and 1 Guest are viewing this topic.

Offline tru3533Topic starter

  • Regular Contributor
  • *
  • Posts: 130
  • Country: no
Finding remaining voltage from joystick potmeter and LM258
« on: September 04, 2019, 03:02:23 pm »
HI,
I have a joystick potmeter that I need to measure the actual voltage and the remaining voltage from.

U1A is connected as an voltage follower.

So when potmeter gives example 1.3V the OUT1 will give 1.3V
Now OUT2 will give the remaining voltage from the supply voltage = 5V - 1.3V = 3.7V

Any idea how to do this? Any help is highly appreciated  :)

Br, Tom
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #1 on: September 04, 2019, 03:18:06 pm »
A differential amplifier with a gain of 1, with the - input going to +5V and the + input to OUT1.

The LM258 can only work to within 1.5V of the positive supply rail, so will need to be powered from a higher voltage than 5V, or use an op-amp with rail-to-rail inputs and outputs.
 
The following users thanked this post: tru3533

Offline tru3533Topic starter

  • Regular Contributor
  • *
  • Posts: 130
  • Country: no
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #2 on: September 04, 2019, 03:24:40 pm »
Thank you so much Zero999, I will go ahead and try the differential amplifier.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #3 on: September 04, 2019, 03:36:38 pm »
Note that even for OUT1, you will need an RRIO opamp (or give it a wider supply) if you want to get the whole range (0/+5V).
 
The following users thanked this post: tru3533

Offline tru3533Topic starter

  • Regular Contributor
  • *
  • Posts: 130
  • Country: no
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #4 on: September 04, 2019, 08:55:23 pm »
OK, so far so good.
I'm not sure how to select the differential amplifier. Any suggestions?
 

Offline fourfathom

  • Super Contributor
  • ***
  • Posts: 2004
  • Country: us
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #5 on: September 04, 2019, 10:20:32 pm »
If you are only looking for relative potentiometer position and don't want to use positive-rail input opamps, you can put a resistor between +5V and the top of the potentiometer.  You can still measure the pot wiper voltage, and the top of the potentiometer to get your voltages.  If you are feeding A-D converters it might be easier to do the "remaining voltage" calculation in software rather than with an analog differential amp.

For that matter, if you are feeding A-D converter inputs, you may not need the opamps at all.
We'll search out every place a sick, twisted, solitary misfit might run to! -- I'll start with Radio Shack.
 
The following users thanked this post: tru3533

Offline tru3533Topic starter

  • Regular Contributor
  • *
  • Posts: 130
  • Country: no
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #6 on: September 04, 2019, 11:30:49 pm »
The circuit will be used in a test console.
The unit under test have 2 analog inputs and supply 5v to the joystick.
By trying to keep it simple I went for an game console joystick, a single spring loaded potmeter .

In center position the 2 analog inputs to the unit needs 2.5V each
When joystick is moved, the unit perform a calculation on the 2 analog inputs, the sum of the 2 analog channels must be 5V

Example: If potmeter output is 1.5V
OUT1 = 1.5V
OUT2 = 3.5V

If the 2 values calculated together, is not 5V, the unit gives an fault.
 

Offline fourfathom

  • Super Contributor
  • ***
  • Posts: 2004
  • Country: us
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #7 on: September 05, 2019, 07:35:28 am »
If the 2 values calculated together, is not 5V, the unit gives an fault.

What precision do you need here?

I'm not recommending this (since rail-to-rail input/output opamps are common), but you could still use my "resistors above and below the pot" scheme, and change the gain on the amplifiers to give you 0-5V range at the outputs.
We'll search out every place a sick, twisted, solitary misfit might run to! -- I'll start with Radio Shack.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #8 on: September 05, 2019, 08:11:25 am »
If the 2 values calculated together, is not 5V, the unit gives an fault.

What precision do you need here?

I'm not recommending this (since rail-to-rail input/output opamps are common), but you could still use my "resistors above and below the pot" scheme, and change the gain on the amplifiers to give you 0-5V range at the outputs.
That will only solve the lack of a rail-to-rail input. It will not solve the issue with the LM358 not having a rail-to-rail output, which will saturate at about 3.5V.

The easiest solution is to use an op-amp with rail-to-rail inputs and outputs. The MCP6002 springs to mind, simply because the part number is easy to remember.
https://ww1.microchip.com/downloads/en/DeviceDoc/21733j.pdf
« Last Edit: September 05, 2019, 08:22:54 am by Zero999 »
 
The following users thanked this post: tru3533

Offline tru3533Topic starter

  • Regular Contributor
  • *
  • Posts: 130
  • Country: no
Re: Finding remaining voltage from joystick potmeter and LM258
« Reply #9 on: September 05, 2019, 11:12:30 am »
Thank you Zero999, works perfectly now with your solution.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf