Last week I did a blog where I looked at the response of an LED to light: Experimenting With Using an LED as a Light Sensor . I thought it might be interesting to extend that a little bit further.
As before, the input is a reverse-biased LED acting as a photodetector. Again, I'm going to use an op
amp as a transresistance amplifier (this time a Microchip device that can operate on 5V) but, for a bit
of added interest, instead of generating an output voltage that's linear with diode current I decided
to generate the log of the current. Whether that was a good idea, we'll see in a moment. In theory this
should give a larger dynamic range, though we shall have to see whether I can actually make use of it
[it will depend on where the dark current falls on the scale].
My starting point was a quick simulation, just to check whether what I was thinking of would work in
Here's the simulation circuit. It is somewhat messy because it is just how it was slapped together; I
wasn't really thinking about anyone other than myself looking at it.
I've got a current generator (IG1) placed where the LED would be to act as a substitute. It isn't going
to behave quite the same because a somewhat better model for a photodiode would have the device
capacitance in parallel with the source, however I just want to look at the logging here, so it won't
matter much. The component that does the log conversion is the transistor (T1) in the amplifier
feedback path that is wired as a diode. The voltage across the 'diode' will be proportional to the log
of the current and that operates over quite a wide range. That diode voltage adds to the 2.5V voltage
source which, in the final circuit, I'm going to construct with a TL431. To condition the output of the
first op amp I've got the second device in the package connected as a differential amplifier, measuring
the difference between the 2.5V reference and the output and multiplying it by ten. That will then give
a signal referenced to ground.
Here's what the simulation looked like. For the current generator, I had constructed a custom waveform
that stepped the current up by a decade after each second. The other trace shows the output of the
differential amplifier. The transistor is doing the log conversion, but without a great deal of
accuracy. At the low end, it all runs out of steam at a few pA.
Although that looks reasonable on paper, in some ways the op amp and transistor are too good. Since
they're responding and developing an output from the single-digit picoamp area upwards, my problem is
going to be the dark current of the LED [the leakage through the device when no light is falling on
it]. That's probably going to be up in the nanoamp region, so half the range here may be useless as the
current will never be down in that first two or three decades.
Rather than worry about that, I decided to build the circuit anyway so that we could see how it behaved
as a physical prototype. It's not many components and didn't take long to construct.
Here is the circuit
I haven't shown it on the diagram, but I've also got a 100nF ceramic capacitor directly between Vss and
Vdd under the op amp package.
Here is the board with the components on it:
If I try it out with the Arduino UNO, driving an LED at 500Hz, that I used in the previous blog [the
LEDs are inside a small cardboard cylinder to keep out the ambient light], I get this waveform
As suspected, if we compare the bottom level of the waveform to the voltage levels from the simulation,
the dark current looks like it's around the 5nA area. But there are several problems with my circuit.
The rise time
isn't too bad (a couple of microseconds), but the fall
takes a much longer time because there's nothing to discharge the small photodiode capacitance other
than the leakage [the op amp will be trying to pull it low, but it's defeated by the transistor 'diode'
The second problem is that it is very sensitive to mains voltage capacitively coupled in. That's the
variation that you see at the bottom of the waveform. The boards are on top of an old cardboard
shoebox, to get them away from the anti-static mat which I know couples signals into sensitive circuits
[it's a cheap rubbery mat with a fairly low resistance], but there's still enough coupling to the
equipment on the bench for it to show.
This is the output with the UNO board turned off, so just the dark current in the sensor LED with added mains.
And this is with the palm of my hand an inch away from the LED. Obviously my body is good at picking up
mains and coupling it to the circuit.
The final problem is that I have slightly too much gain and it's close to limiting at the rail at the
top [the level from pointing the LED at the sun, through a window, was hardly any different to that
from the test LED].
So, in many ways, the logging turned out not to be a particularly inspired idea.
Update 17th April
Since I did the blog, just out of curiosity I've tried a simple shield around the sensitive bits. It's made from a piece of
flexible PCB material: thin plastic with a copper layer bonded to it. It's connected to the ground, but it's open one end,
so doesn't form a complete cage. Here's what it looks like:
That gets the mains noise down to this on the dark current level
With my finger on the end of the sensor LED (so a bit closer than the unshielded one above), I get this
The chip in the LED on its cup can still sense the outside field, even though it's a few millimetres below the copper
level, but it's better than before.
If you found this interesting and would like to see other blogs I've written, a list can be found here: jc2048 Blog Index