Finding remaining voltage from joystick potmeter and LM258 - Page 1
Forum section: electronics / projects

author: tru3533
author_rank: Regular Contributor
timestamp: September 04, 2019, 03:02:23 pm
content: 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.3VNow OUT2 will give the remaining voltage from the supply voltage = 5V - 1.3V = 3.7VAny idea how to do this? Any help is highly appreciatedBr, Tom

author: Zero999
author_rank: Super Contributor
timestamp: September 04, 2019, 03:18:06 pm
content: 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.

author: tru3533
author_rank: Regular Contributor
timestamp: September 04, 2019, 03:24:40 pm
content: Thank you so much Zero999, I will go ahead and try the differential amplifier.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 04, 2019, 03:36:38 pm
content: 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).

author: tru3533
author_rank: Regular Contributor
timestamp: September 04, 2019, 08:55:23 pm
content: OK, so far so good.I'm not sure how to select the differential amplifier. Any suggestions?

author: fourfathom
author_rank: Super Contributor
timestamp: September 04, 2019, 10:20:32 pm
content: 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.

author: tru3533
author_rank: Regular Contributor
timestamp: September 04, 2019, 11:30:49 pm
content: 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 eachWhen joystick is moved, the unit perform a calculation on the 2 analog inputs, the sum of the 2 analog channels must be 5VExample: If potmeter output is 1.5VOUT1 = 1.5VOUT2 = 3.5VIf the 2 values calculated together, is not 5V, the unit gives an fault.

author: fourfathom
author_rank: Super Contributor
timestamp: September 05, 2019, 07:35:28 am
content: Quote from: tru3533 on September 04, 2019, 11:30:49 pmWhat 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.

author: Zero999
author_rank: Super Contributor
timestamp: September 05, 2019, 08:11:25 am
content: Quote from: fourfathom on September 05, 2019, 07:35:28 amThat 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

author: tru3533
author_rank: Regular Contributor
timestamp: September 05, 2019, 11:12:30 am
content: Thank you Zero999, works perfectly now with your solution.