As per the circuit diagram below, I'm trying to use a phototransistor with a digital potentiometer so that the sensitivity can be adjusted. PH_TR connects to an analog pin on a SAMD21 chip.

Is there any reason why this won't work. I'm not entirely sure how the digital potentiometer works. Will having W connected to GND as well as the low part of the resistor cause any problems?

What I'm trying to achieve is a resistance that can be adjusted between 0\$\Omega\$ and 10k\$\Omega\$.

TPL0401 Datasheet (digital potentiometer)

TEPT5700 Datasheet (phototransistor)

Circuit Diagram

  • \$\begingroup\$ I am not familiar with those chips but the fact that it's a potentiometer means that the output 'W' will be some fraction of the input 'H'. You have 'W' grounded so you are trying to use it as a rheostat rather than potentiometer. You should provide a link (in your question) to the datasheet. \$\endgroup\$ – Transistor Dec 17 '17 at 23:54
  • \$\begingroup\$ Added datasheets @Transistor. Also, you're correct, I'm trying to use it as a rheostat, so actually in this case, what I need is a digital rheostat (or a digital potentiometer that can act as one). I should have known that! \$\endgroup\$ – CircularRecursion Dec 17 '17 at 23:58
  • \$\begingroup\$ In general it will work but you'll have to work out how the "wiper resistance" varies with "wiper position". It's possible it won't be monotonic, if that matters to you. \$\endgroup\$ – Spehro Pefhany Dec 18 '17 at 0:36
  • \$\begingroup\$ The Resistor is linear and definitely monotonic (all the switches are is series), but you need to use GND and W and ignore H. \$\endgroup\$ – Jack Creasey Dec 18 '17 at 1:10
  • \$\begingroup\$ This is a bad circuit because if resistance between H and W is set to a low value (<150 Ohm) and there is enough light hitting the phototransistor (both are external conditions; not inherently excluded by the circuit) both components might get damaged. \$\endgroup\$ – Curd Jul 19 '18 at 13:22

This chip is 100 to 10k but using a PV current source may be a much higher or lower impedance so your operating range is limited by the low 3.3V limit and the output is a scaler product of the current *10k and rheostat ratio.

I would suggest an alternative design if you can define the specs.


Another way to make a 'programmable' potentiometer is to take a simple LED, and connect an LDR to it by using (black) isolation tape. Make sure no light except from the LED reaches the LDR.

The resistor of the LED should be chosen so that the maximum brightness can be reached (depending on the type/forward voltage of the LED). The type of LDR is in your case is 10K ohm.

Also this way the two 'subcircuits' can be decoupled (like a kind of analog optocoupler).

Than by lighting the LED, the LDR will change resistance. It doesn't look professional, but for about 5 cents you have a programmable resistor.

See comment of user253751: The above is calla a vactrol.

Also called a resistive opto isolator, see: https://en.wikipedia.org/wiki/Resistive_opto-isolator

  • 1
    \$\begingroup\$ Why are you talking about a LDR but are drawing a photodiode? Using a photodiode will not work as described because it acts as a variable current source not as a variable resistor. \$\endgroup\$ – Curd Jul 19 '18 at 13:30
  • \$\begingroup\$ @Curd I meant an LDR, removed the circuit since I couldn't find an LDR. \$\endgroup\$ – Michel Keijzers Jul 19 '18 at 14:18
  • 1
    \$\begingroup\$ Keyword: that assembly is a vactrol \$\endgroup\$ – user253751 Feb 3 at 18:45
  • \$\begingroup\$ @user253751 ... thanks I didn't know that, I added it to the answer. \$\endgroup\$ – Michel Keijzers Feb 3 at 18:57
  • 1
    \$\begingroup\$ @MichelKeijzers Yes, analog synths. Some day I'll build one to play around with. Then reimplement the whole thing on a tiny microcontroller :P - this is very tangential, but I think one reason people like analog synths is that you can get effects you didn't plan for by varying random bits of the circuit, whereas with a digital one you have to think up equations. \$\endgroup\$ – user253751 Feb 3 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.