Gas station without pumps

2012 July 13


Filed under: Circuits course — gasstationwithoutpumps @ 23:31
Tags: , , , , , ,

I started on the next series of experiments today: LEDs and photosensors.  I tried hooking up a red LED to the output of my signal generator together with a 1kΩ series resistor to prevent excessive current.  Because the output of  signal generator has a DC offset for the sine/triangle wave output, I added connected the cathode (negative end) of the LED to +5v, instead of to ground.  This means that the LED is only on for half the cycle.  At the low end of the signal generator output, I can easily see the flashing of the LED. I can see some flicker up to about 27Hz.

Hmm, that my be a good measurement for the bioengineers to make: vary the frequency of an LED and try to determine their own flicker-fusion frequencies.  It might be worth checking to see if that depends on the LED brightness and whether their eyes are kept still or are moving.  Peripheral vision versus fovea might be interesting also.  There is little electronics here, but it would be worth spending a few minutes on this to get familiar with the function generator and the LED.

I then hooked up an NPN phototransistor facing the photodiode with a series resistor 33kΩ resistor to +5v on the collector.  I looked at various signals into the LED to see what came out of the phototransistor.

The red LED facing directly into the blue phototransistor.

I was surprised. What surprised me with sine wave and triangle wave input was how little output I got at higher frequencies, so I switched to square waves and got traces like the following:

Bottom trace is square-wave input to LED (LED is on when signal is high). Top trace is voltage on the collector of the phototransistor. The time base is 1 msec per division so the frequency is about 220 Hz.

When the LED is on, the voltage across the phototransistor drops to near 0 (it has no trouble sinking 0.15mA from the resistor). When the LED is off, the voltage rises to about 4V, for a current of about 30 µA (much larger than the specified “dark current” of 100 nA, but it isn’t dark in the room).  What surprised me is how slowly the voltage rose—about 600 µsec.  The fall time was also longer than I expected—about 200 µsec.  The specifications for the phototransistor give a rise and fall time of 15 µsec.  So what is wrong?

Well, the specs are for a 5 V drop across the photoresistor, a 1kΩ load, and a bright enough light to get 1mA. Changing the series resistor from 33kΩ to 1kΩ does indeed raise the voltage to about 5 V  (5.051 V, with my power supply at 5.221 V, for a current of 170 µA).    With this setup, I get rise and fall times of about 25 µsec.  Changing the LED circuit to have a 1 kΩ resistor to ground (instead of to 5v) makes the LED  have about 4mA when it is on and the output of the phototransistor swings about 520 mV (520 µA, still about half what the spec says the phototransistor was tested at).  The rise time and fall time look like about 20 µsec now. By using a 330Ω load resistor, I could get the voltage swing to be 240 mV, for a 0.73 mA current.  Now I do see the 15 µsec rise and fall time (roughly). Dimming the LED by connecting the series resistor back to 5V, so that the output voltage swing is only 100 mV (0.3 mA) does not seem to affect the rise and fall times much.

So, the high-speed response of a phototransistor depend on it having a large voltage between the collector and emitter, which means a low load resistance. We can get an 100 kHz signal through, if we are willing to have only a 30 mV signal output, and have it look more like a triangle wave than a square wave.

So the specs seem accurate, but it is important to use a very small load resistor to get any sort of speed in the response.

Note: a CdS photoresistor cell (often used as an ambient light sensor) has much slower response than a phototransistor (on the order of tens of milliseconds), but even very cheap photodiodes are fast: the 31.5¢ PD204-6B has rise and fall times of 6 nsec, though it is only sensitive in the infrared range (840–1100 nm).  For a couple of cents more the 33.8¢ PD204-6C is sensitive in the range 400–1100 nm, still with 6 nsec rise and fall times. I should probably redo this lab with a photodiode instead of a phototransistor—the problem is that we’d be dealing with only 1–10 µA, which means only about a 10 mV swing (if we sacrifice some speed and accept a 60nsec rise and fall by using a 10kΩ load resistance). We might need an instrumentation amplifier to read the signal if the photodiode is on a long wire.

Would the students learn more from using a phototransistor?  Perhaps I should even make them look at the specs for all three devices and figure out which to use.

Now, I have to figure out what I’m going to use the phototransistor (or photodiode) for.  My first thought was to shine the LED through the ear, and look at the fluctuation due to pulses in the blood flow. We don’t want to see 60Hz or 120 Hz signals from the lighting fixtures.  Though when I point the phototransistor at my compact fluorescent room light, I see only about 1 mV (3 µA) fluctuation at 120 Hz, so that may not be much of a problem.  I will have to figure out a way to rig the phototransistor and LED, since I don’t want to hold a breadboard up to my ear.  My first thought is to drill a hole exactly the right size (3mm for the phototransistor and LED, but 4mm for the photodiode) through a wooden clothes pin. That would provide simple mechanical alignment for prototyping.  I should probably try wearing a clothespin for a while to make sure it is not too painful for testing.

If there are problems with ambient light, we can try modulating the LED with a 1kHz square wave.  The output of the phototransistor could be passed through a high pass filter that cuts off around 500 Hz (eliminating 60 Hz and 120Hz hum), and the 1kHz carrier removed (perhaps by rectifying and low-pass filtering).  Alternatively, we could even use synchronous demodulation, by using an analog switch (like the HEF4053B) to switch an op amp between positive and negative gain to extract just the 1 kHz part of the input and then low-pass filter to remove everything above say 40 Hz. Since we’re looking for a signal that varies from about 0.5 Hz (my resting pulse is around 42 bpm, or 0.7Hz)  to about 3.3 Hz (200 bpm), 40 Hz would be enough to reconstruct the first 12 harmonics, which should get most of the interesting shape of the wave form.



  1. […] Phototransistor, I suggested modulating and LED with a  a 1kHz square wave, passing the light through an earlobe, […]

    Pingback by Synchronous demodulator « Gas station without pumps — 2012 July 14 @ 10:24 | Reply

  2. […] Phototransistor […]

    Pingback by Order and topics for labs « Gas station without pumps — 2012 August 16 @ 23:39 | Reply

  3. […] Phototransistor I talked about one possible phototransistor lab, that looked at the response speed of a […]

    Pingback by New phototransistor lab | Gas station without pumps — 2014 March 16 @ 00:56 | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: