# Phototransistor with digital potentiometer

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)

• 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. – Transistor Dec 17 '17 at 23:54
• 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! – CircularRecursion Dec 17 '17 at 23:58
• 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. – Spehro Pefhany Dec 18 '17 at 0:36
• The Resistor is linear and definitely monotonic (all the switches are is series), but you need to use GND and W and ignore H. – Jack Creasey Dec 18 '17 at 1:10
• 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. – 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.

• 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. – Curd Jul 19 '18 at 13:30
• @Curd I meant an LDR, removed the circuit since I couldn't find an LDR. – Michel Keijzers Jul 19 '18 at 14:18