1

I have a physical three wire potentiometer on a hardware that I did not create. I want to replace the potentiometer with a Raspberry Pi based control. How could I replace the 3 wire potentiometer of separate electronic device to be controlled by the Raspberry Pi? I'm thinking possibly an optocoupler, but I'm not quite sure what parts specifically. I'm just a hobbiest so I apologize for my lack of knowledge in terminology.

How could I accomplish this, simply?

JRE
  • 67,678
  • 8
  • 104
  • 179

3 Answers3

3

In general, other than using a motor-operated potentiometer (which is expensive and power-hungry when moving), it's not predictable how easy or difficult this is to do without detailed engineering (or at least service manual) level information about the device you are trying to modify- schematic, parts values, and maybe more than that. It may not be intuitive to you whether it will be difficult or easy.

For example, replacing the potentiometer on a cheap wall-mounted mains dimmer is very difficult- too much voltage across it, and it must be isolated from the mains for safety. Replacing the potentiometer on a device with documented connections to 0V/5V/wiper is easy or very easy depending on grounding and such like. A simple inexpensive digital pot would likely work. But if the voltage is higher than 5V or lower than 0V then the digital pot solution becomes more expensive or not available, depending. If galvanic isolation is required for some reason then the solution becomes more complex and expensive. Accuracy is another variable- if you are trying to replace a wirewound 10-turn precision Helipot (tm) without compromising accuracy, it will be more difficult than replacing single turn pot with 10%-ish accuracy. Also, not all pots have linear tapers. Replacing a log or reverse-log taper pot can be more involved than replacing a linear pot.

Spehro Pefhany
  • 376,485
  • 21
  • 320
  • 842
2

Your idea of using an optocoupler might work if you used an "analog" optocoupler. This method often requires a feed back system to keep the control linear. You would first need to determine if the working range of the optocoupler would be compatible with the existing circuit being controlled by the potentiometer (for e.g.: the voltage, current, and power range). An analog optocoupler would not be suited for a circuit requiring a high power adjustment. This type of analog optocoupler (LED/Photo Diode) is best suited for adjusting a simple DC voltage and keeping it isolated from the controlling circuit. If you are trying to directly adjust a varying audio signal this type of optocoupler may not work well at all, (the LDR type optocoupler referenced below may work better with a limited range audio signal).

To make up for the 3 wire connection of the original potentiometer you might add one or more fixed resistors above and/or below the analog optocoupler to give a voltage divider arrangement with a center connection. Just note that with a fixed resistor and the analog optocoupler you may not be able to achieve the absolute full range of the original potentiometer.

schematic

simulate this circuit – Schematic created using CircuitLab

.

A few examples of analog optocouplers:
HCNR200/201
L300

For an analog optocoupler that acts more like a real resistor there are some that use a light dependent resistor (LDR). e.g.: NSL-32SR2

Here's an older Stackexchange question related to why an analog optocoupler was used: What is the purpose of using an analog optocoupler? .

A digital potentiometer (chip) may also be suitable in some situations. Here is an application note from Analog Devices describing their use and limitations. https://www.analog.com/media/en/technical-documentation/application-notes/an-1121.pdf

If you ultimately needed to retain the physical potentiometer there are still methods such as driving a servo to mechanically adjust a potentiometer shaft. Look up servo control using a raspberry pie.

Nedd
  • 7,939
  • 15
  • 19
  • For a constant control input, how linear will V_Controlled be as a function of V_High? Ie. does the photodiode have some form of linear region whose effective resistance can be modulated by the light? – Oskar Skog Oct 22 '22 at 08:50
  • That is what the feed back is for. The control input is adjusted until the feed back results in the required output. Since the two internal photo diodes are matched the feed back mimics the other diode. – Nedd Oct 22 '22 at 08:55
  • Well that's good for making the output entirely dependent on the control input, but how will it work if V_High is a variable signal that needs to be variably attenuated? – Oskar Skog Oct 22 '22 at 08:58
  • Note that V_High is not the variable here. I only used that tag to show that it is the high side of the original potentiometer circuit. Since a photo diode is used for the output control it needs to be connected so that the diode is always forward biased. (Also note that the diagram has been edited.) – Nedd Oct 22 '22 at 09:11
0

Do a web search for "digital potentiometer". Several manufacturers.

user107063
  • 2,507
  • 1
  • 13
  • 4
    Good idea, but dependig on the circuit, it may not be a good idea, if a digital pot can't handle the current or voltage or potential difference of the circuit. You don't know if it is e.g. a mains referenced trimmer, devices can burn or the circuit becomes lethal to touch. – Justme Oct 22 '22 at 01:47