The Classroom

Light Unseen - IR LEDs

Infrared light and its Relationship with Makers

Daniel Koch

Issue 53, December 2021

We look at available components to use infrared light in your projects for detection and data transmission.

Most people are familiar with Infrared (IR) light sources, whether they realise it or not. From the TV remote to the entry buzzer in a shop doorway, we use IR-reliant devices on a daily basis. Even your phone’s camera sensor may be very sensitive to IR, if it’s a CCD device (though CMOS sensors are more popular). However, Infrared light is useful for maker projects, too. In this month’s Classroom, we’ll take a look at different types of IR emitters, and several different receiver options, too. We’ll wrap up with a project that allows you to ‘hear’ heat.

Incidentally, the term “Infrared Light’ is not necessarily correct. Its most common name in science is Infrared, without the word ‘light’ added. It can be found in similar settings as ‘Infrared Radiation’, which is also more accurate. However, in any writing meant for general consumption, the word ‘light’ is usually used. Infrared exhibits many of the properties of light and so few of the properties of other commonly known forms of electromagnetic radiation like radio waves. By that, we mean the properties that a general person without specific knowledge would observe; an everyday person, for want of a better phrase. Because of this, we will keep the layman’s status quo and go with ‘Infrared Light’.

ELECTROMAGNETIC RADIATION

Firstly, it helps to revisit the bigger picture. Infrared light is a certain electromagnetic radiation (EMR). Electromagnetic Radiation is a form of energy that has both magnetic and electrical properties. If an electromagnetic wave is moving in a given direction, the electrical and magnetic components of the wave are at right angles to each other, and both are perpendicular to the direction of travel. While that’s hard to describe well in words, luckily it can be plotted on the Cartesian Plane. The z-axis is the direction of travel, the x-axis is the electrical component, and the y-axis is the magnetic component.

An EM wave radiating through space exhibits behaviours of both waves and particles at once. It is generally called a wave, regardless of what behaviours it is showing at that moment. The deepest levels of this are still debated in science, but for all practical purposes, you can think of all EMR as waves. The distance between identical points on an EM wave is the ‘wavelength’, while the number of whole wave cycles passing a given point in one second defines its ‘frequency’. That means that as frequency increases, wavelength decreases, because all EM waves travel at the same speed, assuming the conditions are the same. If the number of waves going past a certain point increases, then the length of the wave must decrease because all the waves travel at the same forward speed.

It is the frequency and therefore the wavelength that gives different EM waves their properties, such as colour in visible light. The unit of frequency is the Hertz (Hz), with 1Hz representing exactly one whole wave cycle in one second. Wavelength is denoted by the Greek lowercase letter Lambda (λ). It is often shown with the symbol λ, which is the mathematical version. It’s the same letter, just italic and in a more curved font prefered in mathematics and science.

It is worth noting that the information above is for perfect conditions, such as a vacuum. EM waves still travel with the electrical and magnetic components in synchronisation and perpendicular to each other in most other situations. The biggest change is transit speed. In a vacuum, EM waves travel at the Universal Constant, the speed of light: 299, 792, 458 kilometres per second. Different wavelengths are affected by different substances in different ways. For example, visible light is stopped by the plaster on your house walls, while radio waves go through, albeit with a loss.

IR LIGHT AND THE EM SPECTRUM

All EMR is described on the Electromagnetic (EM) Spectrum. This is a way of relating EMR of different frequencies. Technically, the longest wavelength could be the length of the universe, and the shortest is still up for debate but is subatomic. In more common descriptions, the spectrum is described from 3Hz, which is an Extremely Low Frequency wave with a wavelength of 100 000km; to Gamma rays at 300EHz (that’s ExaHertz, or 300, 000, 000, 000, 000, 000, 000 Hz) and a wavelength of 1 picometre. Within this spectrum sit all manner of familiar terms: Radio waves including the familiar UHF, VHF, AM and FM bands; visible light; Ultraviolet light; microwaves; x-rays; and of course, Infrared light.

IR IN DEPTH

Infrared light is EMR from a frequency of 430THz and 700nm, to 300GHz and 1mm. For comparison, visible light is from 400nm and 750THz to 700nm and 430THz, while ultraviolet light is from 10nm and 30PHz to 400nm and 750THz. These ranges share common limits because they are immediately next to each other, and share some properties but not others. For example, the higher-energy, shorter wavelength UV radiation is capable of altering some chemical bonds, while infrared tends to cause heating.

The terms ‘near infrared’ and ‘far infrared’ are often encountered, and describe wavelengths that are close to or far away from the red section of the visible light spectrum. There is some blending of boundaries between visible and Infrared light. In many cases, this is due to no lightsource being absolutely pure, outside of the laboratory at least. Many infrared emitters emit some red light if they are in that end of the spectrum, anywhere near the boundary, and that happens to be the area of the range that is used most in electronics. You may have seen this when noticing a surveillance camera in low light: Infrared LEDs often emit a faint, or even not so faint, red glow.

The quality of the device plays a part, and very cheap IR LEDs often look like a standard-brightness (think panel indicator level) red LED. Even the best IR LEDs emit some red light from the PN junction, and so many feature cases made from plastic which has additives to filter the visible light. This effect can be seen in the UV scale as well, where deep blue LEDs cause some fluorescing of the same materials that a blacklight would, and blacklights emit some purple light.

That said, if an IR lightsource is designed for wavelengths right away from the ends of the band, there should be no real emissions outside the band. However, natural sources can vary even more. A flame, for example, emits IR light across most of the band, as well as plenty of visible red, orange, and yellow light, and even some of the other colours. There are some sources of comparatively pure IR light in space, but even then, it’s a relative statement.

NATURAL SOURCES

Infrared EMR was first identified comprehensively by William Herschel in 1800. He had noticed a thermometer affected by some form of radiation that was at a lower energy level than red light. On Earth, slightly more than half of the radiation arriving on the surface from the sun is infrared. Of this, most is near infrared, less than four micrometres. It is absorbed and emitted differently depending on the substance, although all materials known to science interact with infrared in some way. That means the heat from a fire, oven, or even hot air is infrared radiation. Where it sits in the IR spectrum or how much of the spectrum it spreads across, varies both with the source of the heat and the source of the information we consulted.

Heat felt by the human body is in the infrared range, often reported as around twelve micrometres, in the long wavelength range. The actual concept of heat in the human body is far more involved and so are the wavelengths, but it makes no difference for us in this article. On the atomic level, infrared radiation transfers energy by causing molecules to vibrate more, as they absorb that energy. The longer the wavelength, the less heating effect radiant energy has. Past visible light and into the UV spectrum, the short wavelength UV C band is able to damage human cells, which is why it is a cause of cancer.

Infrared, by contrast, even at the near infrared (more energetic) range, cannot cause cellular damage. Very intense IR will still burn you, in the same way sitting too close to a heater or putting your hand on a stovetop will. This is not an issue for most maker uses of IR, like remote controls, break beams, sensors, and things like that. However, it is a very serious issue once you start playing with IR lasers. Because the human eye doesn’t see IR, there is no visual warning that something may be about to go terribly wrong. The same can be said for intense IR spotlights. While your eye may not ‘see’ the light from these, it is still intense enough to cause retina burns. Again, few makers will end up anywhere near these.

IR DEVICES IN MAKING

In electronics, things are a bit less varied. It is possible to buy devices that work in the far infrared range, or anywhere else in the IR spectrum. However, the vast majority work in the near-infrared range. Certainly anything commonly available to the maker shopping at retail or hobby suppliers is in the near-IR range. There are a couple of exceptions, like body-heat-sensitive Passive Infrared (PIR) detectors as used in alarm systems. These are sensitive to the human body’s emitted long-wavelength IR, closer to the far-IR end of the spectrum. IR devices fall into two categories: Emitters and Receivers.

EMITTERS

Most emitters in making are semiconductor devices, and the majority of those are diodes. Even most of the readily available IR lasers are diode-based devices, much like the visible versions more commonly encountered. In both cases, there are many more wavelengths, and laser types, once industrial, engineering, and scientific lasers are considered. For the maker, emitters of IR that can be used in projects are LEDs, or at most, laser diodes.

Infrared LEDs look like either a darkened or waterclear version of a regular LED. They commonly are available in 3mm T1 and 5mm T1 ¾ packages, but are not to be treated like regular LEDs! The majority have forward voltages between 1.2V and 1.5V, and forward currents of 50mA to 100mA. Even older red LEDs start generally at the 1.7V mark and 20mA, while some more modern high-brightness types creep to 2.2V and 30mA to 50mA. However, most coloured LEDs that a maker uses are above a forward voltage of 3V and have forward currents in the 20mA to 30mA range.

When output figures are given for regular visible LEDs, makers are familiar with expressions in millicandela (mcd) or, increasingly, Lumens. However, IR LEDs are generally rated in Watts per Steradian (W/Sr), which is a function of energy and angle. To understand why, we have to take a tangent.

The Candela is a unit of Luminous Intensity, which itself is a wavelength-weighted measure power of a light source, in a given direction per unit of solid angle. Solid angle can be thought of for our purposes as 3D angle, which means a cone or pyramid shape. So, the luminous intensity in Candela for a light source focused into a 20° beam, would double if you focused the same light into a 10° beam. This assumes no losses. Luminous Flux, measured in Lumens, is the measure of total light output, regardless of angle. A light source measured in lumens will keep the same lumen rating regardless of beam angle. They are related concepts, but not so easily convertible.

Because luminous intensity is weighted for the human eye’s response to visible light, it is not so useful for measuring IR light, nor UV for that matter. Consequently, the unit of W/Sr is used. This is the energy in Watts (usually milliWatts for IR LEDs) per unit angle, which is given as the Steradian. The Steradian is the three-dimensional equivalent of the radian in the two-dimensional plane. It is the angle squared, although this isn’t a perfect picture. If you’re mathematically minded, you might want to read up on the Steradian. If not, it probably makes no real difference for our purposes.

The upshot is that if an IR LED has a rating in mW/Sr, then that is the rating per square degree. If two LEDs have a rating of 50mW/Sr, but one has a viewing angle of 15° and another 30°, the 30° one has twice the output of the other, even though you can’t see it. The ‘brightness’ at a given point is the same because it is given as per angle. This is the best way to compare IR LEDs for their energy output, which is what would be thought of as brightness in visible spectrum LEDs: Compare the power rating in mW/Sr, against the stated viewing angle.

Beyond this, IR LEDs behave just like regular LEDs. When considering power, IR LEDs are just like visible light LEDs in that they do not have enough internal resistance to self-limit their current and will self-destruct, quickly or slowly, if the current is not externally limited. A constant current source can be applied in the same way as for regular LEDs if voltages might fluctuate. IR LEDs also have similar rise and fall times (switch on and switch off times) as their visible cousins, and for most cases, this is so low as to be negligible. For fast data transfers, you might have to check the datasheets for rise/fall times, to make sure you can still transmit at the frequency required.

There is a fair degree of crossover between wavelengths in many mass-produced light sources. While many high-brightness LEDs have a peak wavelength around the 620nm mark, some hover closer to 660nm, called ‘deep red’. In the standard brightness range, many older high-efficiency red LEDs were deep red, too. The very first practical, commercially manufactured LEDs were low-output IR emitters. We have some early 1990s vintage Gallium Arsenide Phosphide (GaAsP) red LEDs here in the DIYODE workshop that are very close to the IR end of the spectrum, and they happily trigger IR receivers. This, as mentioned, is true in the reverse direction, too. If you need an IR light source with no visible light, you will need to either choose a wavelength away from the 700nm boundary, or make sure you buy an emitter with a tinted or even black case.

IR LASERS

Another source of IR used in making is the laser. IR lasers are far less common in general than their visible counterparts for making (but not necessarily in scientific and industrial use). Lasers are far less common in maker circles anyway, due to their specific nature, but they are still encountered. Some are used for limit or boundary sensing, but we recommend against this as makers: Eye damage is a very real risk when the beam cannot be seen. Even the 1mW red lasers commonly used can cause retina damage if left in contact with their eyes too long, and IR lasers do not give the visual warning that the visible light lasers do.

Lasers tend to have a much narrower wavelength bandwidth, with a sharp peak wavelength curve with steep dropoff to either side. Despite the use of diodes in most accessible lasers, the light output is coherent and polarised. However, we still achieved some triggering of IR detectors with a 1mW 670nm red laser module. This was expected for some of the detectors we discuss further on, but less expected with the black-cased photodiodes. This means that in some situations, you will be able to use a red laser with an IR detector. Given that IR lasers are expensive and far less accessible than small red lasers, this is the path many makers will go down. The main use we have found for IR lasers in general making, is experimental laser cutters.

OTHER SOURCES

While semiconductors are the main source of IR that a maker will deliberately use, there are other sources of IR that need to be considered for interference, as possible sources. Sunlight is the obvious source. With over half the energy from the sun arriving on Earth as IR, it is a very real consideration. This makes IR a viable method of detecting daylight: While clouds significantly reduce IR transmission, far more than they do for UV, they do not eliminate it. Depending on circuit design, an IR detector could even be designed to tell the difference between sunny days, cloudy days, and night. Given that the night sky is also a source of IR, albeit weaker and not in the near-IR band, a clear or cloudy night indicator could be created, too.

Other sources of IR include most thermal radiators. An incandescent globe, for example, emits a reasonable amount of mid-IR. The same goes for most heat sources, however much of the IR emitted is not in the near-IR range, while most retail-accessible detectors are. Many thermal radiators including the human body emit their IR this way, although it does spread across the whole IR spectrum.

IR RECEIVERS

There is a variety of receivers of IR, and all of those covered here are semiconductors. While there are other methods of detecting IR, they are limited to laboratory or industrial settings. Additionally, some devices detect or respond to IR light by coincidence, such as some chemistries of LED. However, they are not considered reliable, strong, or predictable enough to be used as detectors. That leaves us with dedicated photodiodes, phototransistors, specialised integrated circuits, and devices like Passive Infrared Detectors. We’ll cover a couple from the ‘coincidentally’ category as well.

PHOTODIODES

All PN junctions are sensitive to light and exhibit some of the following properties. In most cases, this is undesirable and cases are made completely opaque to prevent light causing unwanted behaviour. However, a PN junction can be made even more sensitive to light by careful selection of materials and construction techniques. Most photodiodes are made not as PN junctions, but PIN junctions. While many makers are well versed in the doping of semiconductor materials with chosen impurities to create P- and N-type materials with different properties, less makers know that undoped, pure semiconductor material, known as ‘Intrinsic’ or ‘I-type’ material, is used as well. A PIN junction is a PN junction with a slice of I-type material in the middle. This changes the properties yet again, and makes the junction much faster.

While dedicated photodiodes are particularly sensitive to light, regular LEDs are not too far behind them. The PN Junction in an LED is constructed with a relatively large exposed surface area. Consequently, it receives a lot of light compared to other components when it is not being driven. LEDs will respond to light that is the same as their peak emitted wavelength, and anything shorter, but not longer. Therefore, the ideal LED to use if one were to seriously be used as a detector, would be one in the red area of the spectrum. This would receive red light, but also anything shorter, all the way to the UV section of the spectrum, and maybe even beyond.

As an experiment, we hooked a waterclear high-brightness red LED across an oscilloscope probe, cathode to ground and anode to the input. We adjusted the trace until it was on the first graduation above the very bottom of the screen. With a 500mV vertical resolution, and a 1ms horizontal resolution, the scope shows that under workbench lighting, there is about 200mV across the LED. Placing a hand over it takes the voltage down to, as far as can be perceived among the noise, 0V. Shining a green 100,000mcd LED straight at the red LED, from a distance of 20mm, yields a voltage of 1.5V across the red LED. That’s quite significant for a device that is not well known as a sensor.

Changing the horizontal resolution to 500ms, we were able to record two instances of a hand covering the red LED, and two of the green LED being shone into the red LED. We also tried an IR LED. Sure enough, the only effect was to see the voltage fall to zero, because the IR LED and the hand holding it were blocking the workbench light. This is consistent with the information above: The 525nm green light is shorter in wavelength than the 660nm peak of the deep red LED. The IR LED, which has a peak of around 800nm, does not extend close enough in its bandwidth to have any effect on the red LED.

As interesting as that is, it isn’t terribly useful to us. While there may be situations where using a regular LED as a sensor is viable, as we’re certainly thinking of some ideas right now, it isn't an everyday sensor. It might be a good idea when you want a defined cut-off to the light response. Most often, however, some other properties of the LED make it undesirable as a sensor. If there is any current flowing through the LED in the forward-biased direction, the LED will be activated and not sensitive to light falling on it. This opposes the way photodiodes are usually used as sensors.

PHOTODIODES IN PRACTICE

Dedicated photodiodes, as highlighted when discussing PIN junctions, are constructed a bit differently to regular LEDs or signal diodes. Photodiodes can operate in one of two main modes: Photovoltaic and Photoconductive.

In photovoltaic mode, the diode is connected with no bias, which also gives the other common name for this mode: Zero bias. Light falling on the photodiode produces a forward current, which can be measured by an ammeter. In a short circuit, the photocurrent will be maximised but the voltage minimal. For all practical discussions, it will be zero. Of course in reality there is some resistance through the diode, so some voltage could be measured. Conversely, if the photodiode is open circuit, no current will flow and a voltage will develop across the anode and cathode. This voltage, with no current flow, builds quite quickly for minimal light, but does not increase significantly more once light increases, because the available charge carrier and hole pairs inside the semiconductor are already active while no current flows to cause them to pass on their charge.

It is possible to use a photodiode this way, but the results will not be easy to translate. There are also few measuring circuits which respond to a current signal in this way. Most are designed to read voltage, as it is electronically easier to measure. In addition, knowing the voltage is important because the impedance through the device changes with conditions, so the current on its own has no real meaning. However, this is useful if you have a device where the manufacturer has performed such tests and has a graph published, showing current versus light, and others for the things that might affect impedance, such as temperature.

The answer for practical use is to connect the photodiode to a resistor, and measure the voltage drop across the resistor. Because the current produced by light falling on the phototransistor is its primary variable, the known resistor can be used with Ohm’s Law to find the value of the current via the measured voltage. As a complete aside, hooking a photodiode straight to an oscilloscope, anode to probe and cathode to ground, still produces a result. The current produced flows through the built-in impedance of the oscilloscope (1MΩ), and probe if the 10x switch is engaged (adding 9MΩ), which causes a voltage drop. However, more reliable results are achieved by using the external resistor and measuring the voltage.

While that’s good for basic use, the most accurate and usable results are achieved by combining the photodiode with an operational amplifier. This can be done without a resistor, because the impedance of operational amplifiers is deliberately as high as manufacturing considerations allow. However, the photodiode still works best if the photocurrent has a load to flow through: Without this, the impedance of the op-amp is not high enough to load the photodiode, and it can therefore develop a high voltage with only low light falling on it. The result is a sensor that is unlikely to give a very accurate response, being weighted low and exhibiting minimal change as light increases but voltage is already close to the maximum. In addition, the feedback resistor RF is there to adjust the sensitivity of the device. Its value would vary depending on the choice of photodiode, op amp, and the desired sensitivity. IL is the photocurrent.

As an aside, regular solar panels are electronically giant photodiodes. They are constructed to have as big a surface area as possible, but otherwise behave the same way. They are constructed to function with a wide range of impedances as loads, but even so, regulators are preferred when using solar panels directly to a load, because voltage and current vary greatly with both light, and load factors. Additionally, solar panels are constructed with their peak efficiency suited to strong sunlight, and so are not good detectors of low light levels. Much like the dedicated photodiode component, a solar panel will show a much higher voltage open circuit than it will with a load connected, and exhibit its maximum current at short circuit.

The other mode in which a photodiode can operate is Photoconductive mode. This involves reverse-biasing the diode. With no light falling on it, the PN or PIN junction acts almost as a regular diode. There is a very small current, the dark current, that flows regardless, but for most practical circuits, it can be ignored. If you are designing a hyper-sensitive or precisely tuned detector, the sort that breadboards aren’t suitable for, then you’ll need to check the diode’s datasheets. Even so, it is a good thing to keep in mind. Dark current can induce noise in some cases.

Besides the dark current, the effect of light on the PN or PIN junction is a change in the way the charge carriers and holes in the semiconductor behave. Light causes some breakdown, and current can flow in the reverse direction. You could think of it as a light-activated Zener in a way, except the amount it conducts is proportional to light, whereas a Zener is a fixed threshold. Like a Zener, however, photodiodes have a power dissipation rating. They should be used with a resistor, both to limit the current and also to provide a voltage drop to measure with your circuit. If the power dissipation rating is exceeded, they will be damaged. The BP104 diode that we use later has a power dissipation of just 215mW.

Much like the photovoltaic mode, photoconductive connection of a photodiode still gives the most usable results when connected with an op amp. The circuit is very similar to the photovoltaic version, but the diode is connected to a bias voltage. There is no limiting resistor because the input impedance of the op amp is too high to allow any significant current, certainly not enough to damage the device or even approach its dissipation limit. While we show the bias voltage as the supply, you could easily connect it to a regulated or Zener reference voltage.

CALIBRATING

It is all well and good to know how to arrange a circuit, but what does the voltage out mean? Can you calibrate a sensor to give a certain voltage for a given amount of light? You can, but it varies. Each device is different, and the answers will involve delving into the datasheets. There will be a graph which shows the reverse current for a given amount of light, and you can use this in conjunction with your chosen resistor to figure out what voltage will be present for a given amount of light. Other important data like dark current versus temperature, and the capacitance of the device are contained within as well.

From Vishay Semiconductors datasheet

WHAT ABOUT WAVELENGTH?

The information above is quite general, because there are different devices around which are used for different purposes. Much of that information discusses sensing ambient light, or measuring the quantity of light, which implies the visible spectrum. However, photodiodes can be made to respond to visible light, ultraviolet light, infrared, or specific parts of those spectra. The real challenge is that of those available domestically at mainstream and specialised maker retailers, the majority are sensitive to IR. To find something in the visible spectrum, you may have to do some digging. If you do have an IR device, make sure its range of sensitivity matches the emitter or source you wish to use it with.

SENSING AMBIENT LIGHT VERSUS COMMUNICATING

Prima facie (first impression), photodiodes in the IR spectrum may not have much point. However, sensing ambient light levels to a measurable degree is only a small part of what photodiodes are used for. In many cases, they are used to sense the presence or lack of light, in digital form. This may be as simple as a break-beam detector, such as found on shop doorways and used in maker projects sometimes as optical limit switches. In this case, the IR photodiode is ideal because it will have a minimum of interaction with ambient light sources, and the go/no-go nature of the detection means that the exact response curve becomes irrelevant. The other main use for IR photodiodes in maker projects is for communication, such as serial data sent as a remote control command. This takes the form of rapid on/off switching of the IR light source, and the receiving of that information through the photodiode. Again, because the signal simply needs to be above or below a threshold, much of the response curve, dark vs light current, actual light level versus light current and sensitivity considerations become less critical.

PHOTOTRANSISTORS

If a photodiode is not for you, or it sounds too hard to use, there is another option. As noted, most PN junctions are inherently sensitive to light. This means that the base of most transistors would be activated by light if they were exposed. Devices made to do this are called phototransistors, and early developmental ones were just regular transistors exposed to light. Modern phototransistors are dedicated devices in specific packages. Some have three pins, so that the base can be electronically controlled or optically controlled. However, others have only two pins, with light being the only mechanism by which the base is activated. Both forms have clear or windowed packages, and it is the base-collector junction that does the work. Many two-pin devices are packaged as T1 ¾, the 5mm LED case. Be careful to label them well!

Two-pin packages have to be NPN transistors by default. Of course, light on a PN junction can provide the current to turn on an NPN transistor, but it cannot provide a pathway for current to reach ground in a PNP transistor. PNP phototransistors do exist but are rare. We couldn’t even find a listing for one on Element14’s website. They typically involve a PIN photodiode between the base on the transistor die, and the base lead, so that the diode only conducts when illuminated and so switches the base current to ground. These are technically an IC rather than a phototransistor. We did find information online detailing true PNP phototransistors but could find none for sale. This makes sense given that it is the collector-base junction that is sensitive to light. In a PNP transistor, the emitter passes current through the base to ground via the bae lead, not the collector. Creative engineering is required to turn this into a phototransistor.

Like the photodiode, a range of phototransistors are made to respond to different wavelengths. Some work in far IR, some near, some middle. Others work in the visible spectrum, while others still have a response across the range. The one we explored for this article is described as an IR device, but does have some response in the visible spectrum. It is made by Kingbright, who are a large but basic manufacturer whose documentation in this case is pretty basic too. At no point does the datasheet state the bandwidth that the device responds to, nor provide a graph. The only references are that it is spectrally matched to an emitter made by the same company, and a test condition in one of the tables of 940nm.

However, other phototransistors will have datasheets with far more useful information. Factors that need to be considered are the maximum collector current, wavelength bandwidth (the range of wavelength the device responds to), the peak wavelength, power dissipation, maximum voltages, and the dark current when no light falls on the device.

Phototransistors also have two modes of operation, called ‘active’ and ‘switched’ mode. Active mode is sometimes called ‘linear’ mode because the current amplification in the transistor increases with the amount of light falling on the device. However, it is far from linear. The graph varies for different devices, but none are smooth, neat lines and instead more closely resemble the path of a drunken walk. For this reason, switched mode is preferred. This is where the device is arranged so that its output is treated digitally, either ‘on’ or ‘off’. Because the saturated (fully switched on) current of a phototransistor is often reached at a reasonably low level of light, using them in switched mode is rarely difficult. Further to this, NPN phototransistors can be comfortably used in both common emitter and common collector modes like regular transistors.

COMMON CONNECTION CIRCUITS

In the case of the phototransistor, both function with the same principle: The load resistor limits the current through the device to a safe level, and provides a voltage drop which can be measured. Because the current coming through the device is vaguely proportional to incident light up until saturation, this may provide a way of measuring light. However, the lack of linearity favours its use as a switch, probably as the input to an op amp or to another transistor stage as a switch.

Common Emitter
Common Collector

To use either, consult the datasheets to find the amount of light required for saturation, the dark current, and the gain. Assuming ideal conditions, the dark current will be multiplied by the gain even when the device is in total darkness, and represents the lower threshold: The circuit receiving the output from this block should be able to ignore this current. In reality, however, there is likely to be some ambient light. This is why an op amp is recommended, but a transistor with a low enough sensitivity would work too. As long as the phototransistor will be exposed to enough light to reach saturation when desired, the ‘on’ threshold can be designed quite high, enabling a good noise rejection. For example, you could design the circuit to run from 5V, but give an op amp a reference voltage of 4V. This would turn on the final output only when the phototransistor was truly saturated or at least very close to it.

IR AND PHOTORESISTORS

Common Light Dependent Resistors (LDRs) are made from Cadmium Sulphide (CdS) except in the European Union, where Cadmium use is heavily restricted thanks to its toxicity from mining to disposal. These are still the main LDRs used in the rest of the world, and the ones most makers can access over the counter. However, they have a peak sensitivity typically around 550nm, and rarely into the IR scale. In fact, their performance varies greatly according to temperature, and most IR sources are capable of heating the glass and ceramic construction of LDRs, having a greater unwanted effect via temperature increase than the effect that may be gained by light stimulation even when one is possible.

If response to IR light is desired for an LDR, different chemical compounds must be used. Lead Sulphide and Indium antimonide are the materials of choice when an LDR needs to sense the mid-IR range, while Germanium-Copper alloy LDRs are the detectors of choice for far-IR. They are the ones used as IR sensors in astronomical IR detectors, searching deep space for far-IR signals. Even if regular retail-variety LDRs could detect IR, they are particularly sluggish in their response. This would exclude their use in many situations.

END USES - TO ENCODE, OR NOT TO ENCODE

We did mention earlier that IR signals are often used for communication rather than pure detection. This brings up the topic of encoding. In a detection situation, ambient light can be a problem. If, for example, an IR detector is used to detect the presence of an outdoor motorised gate in its home position, that detector can reasonably be expected to encounter either direct or reflected sunlight with a strong IR component. This may necessitate a shield to prevent direct exposure and therefore ‘swamping’ of the detector, but that will not help differentiate between sources.

The answer in this case is to modulate the IR source, and feed the detector’s output to a missing pulse detector tuned to only receive that frequency. That way, ambient IR would be ignored, but an absence of IR coming from the emitter at the desired frequency triggers the output. This is commonly used in IR remote controls, and enables the receiver to be quite sensitive even among many sources of ambient IR.

On top of that, many signals are sent as encoded bursts of modulated signal. If, for the sake of explanation, the emitter and receiver are designed to work with a signal of 10kHz, then bursts of data in the millisecond range can be sent. As long as each bit arrives on the ‘carrier frequency’, it is received by the circuit and further processed as data. This works for remote control signals, but also data communication. While the common TV remote sends a preset bank of commands as a string of IR pulses at an agreed carrier frequency, more varied data can be sent.

Years ago, mobile phones had IR communication ports to send data to compatible devices. Until relatively recently, IR was the wireless medium of choice for wireless headphones. This data is not pre-agreed from a table like the commands from the TV remote. Rather, it could be anything and so a language must be created. As long as information can be sent as a string of 1s and 0s, it will work with IR as much as it will work with WiFi or Bluetooth. Except, that's not completely true.

IR devices are limited in their speed. IR phototransistors are some of the slowest options examined. The photodiode exhibits the fastest response but the datasheets will still give a worst-case rise and fall time. It is this that in part determines the maximum speed at which IR devices can communicate wireless data, and it is simply not fast enough for something like a video signal to be sent. There is just too much data to be sent at the maximum bitrate available.

IR INTEGRATED CIRCUITS

There are a vast number of IR devices around, but we specifically aimed to cover the sort that makers can readily get their hands on without needing trade purchasing skills. In other words, retail or online maker suppliers. That leaves us one more group of general IR devices that we should examine. That is the IR detector Integrated Circuit (IC). These consist of a photodiode and an amplifier, connected internally to a bandpass filter. That’s the really important bit. These devices are designed to operate at a specified carrier frequency and reject all else.

There are many on the market, but a common carrier frequency is 38kHz. The bandwidth (the amount either side of the centre frequency that the device will respond to) varies. As always, check the datasheets. The devices typically have three pins: Vcc and GND as a power supply to run the internal circuitry, and Vout from where the data is extracted. This pin generally goes high when IR at the correct carrier frequency is detected, and low when it is not. Therefore, if serial data is sent over a carrier wave at the right frequency, the Vout pin will go high or low in accordance with the length of the bit, without having the carrier frequency on top like the raw data of the photodiode would.

These are specifically designed as a communication tool, not an ambient detector. However, they do present a neat solution in environments where ambient IR will be a problem, and they can easily be used for something like a simple interference-resistant break-beam detector. Having a 38kHz detector and an IR LED modulated at 38kHz forms a pretty sun-proof doorway beam.

POINTS TO REMEMBER

When choosing an IR device, remember to check first and foremost the wavelength. It is no good trying to make a photodiode with a peak wavelength response of 700nm respond to an IR LED emitting 940nm. IR is not simply IR and this has led to many headaches for makers, ourselves included. Also make sure you check the overall bandwidth of the device. A product that responds to a very narrow or very broad range of wavelengths may be desirable or bad news depending on your situation. The other main point to remember is to check the response time. The rise and fall data are important if you are using modulated data, and can even be an issue in pure switching roles. For example, an optical RPM detector or rotary encoder, where an IR LED is positioned opposite an IR photodiode with a slotted disc in between, may only be useful up to a certain speed because of the rise-fall time of the detector or emitter.

THE PIR

Another device worthy of mention is the Passive Infrared detector, or PIR. We consider this in something of a different category to all of the other devices covered because for the vast majority of makers, they are only available as pre-built modules. The detection devices themselves are complex and fragile, and even when available as a component, they have handling considerations that make antistatic precautions look careless.

PIRs are an array of highly sensitive semiconductors tuned to have a peak response in the range of human body heat. This array is coupled to circuitry to track changes in the field of view. It is the change in signal, rather than level, that triggers a PIR. For example, twenty people sitting still in front of a PIR will not trigger it, but one person moving will trigger the circuit. They are generally sold with a lens of some form to give a field of view, and those meant for building alarm systems rather than general making often have differing lens options, like narrow and wide.

PIRs for making generally have digital outputs. The module has all the circuitry to control everything else. Usually, two potentiometers are present: One controls the sensitivity, while the other controls the ‘on’ duration for the output once triggered. Some more advanced options have data lines, so this information can be altered by a microcontroller, but we did not find any such modules readily available at the retail level.

PIRs can be damaged by a strong enough source of IR. However, despite the fragility of the detector array, the IR needs to be reasonably close to the device’s sensitive wavelength in order to do damage. It is not like in some films where the bad guy points a torch or a pen-sized IR laser pointer at the detector and disables it. Most IR torches are in the near-IR range, away from human body heat, and we have never seen a pocket-sized IR laser pointer.

AN INCIDENTAL DETECTOR

If you are fiddling with IR on your workbench, or trying to figure out if your remote control is working, you have no doubt wanted to be able to ‘see’ the light to know if it is actually working or if the problem lies elsewhere. By coincidence, most of us carry such a toll around with us. The CMOS or CCD sensors in most mobile phones are detectors of IR as well as visible light. Pointing your camera at these light sources should reveal light on your screen where there is none with the naked eye. However, CMOS sensors are far less sensitive to IR than CCD sensors, and now make up the majority of phone cameras.

However, some CMOS sensors do ‘see’ IR well, as is the trend for modern high-resolution surveillance cameras. If you cannot see any light on your phone, look very closely before deciding the emitter is not emitting. It may in fact just be a very weak response, with a dull purple showing where the IR light would be coming from.

Available Devices

Hands On:

Light Microphone

This little circuit has been on our ‘to do’ list for a long time. We saw it in an old book called ‘304 Circuits’ by Elektor, but it originally appeared in their magazine in 1989. The article credits the circuit as coming from a Boeing 737, where it was used to monitor critical displays made from filament lamps. You can well imagine the issues that could occur if a filament lamp blows and does not display when it should in an aircraft cockpit! We dug deeper and after some time (a bit too much to justify, if we’re honest) we found references to the system in a Boeing technical maintenance training manual. Thus, credit belongs to Boeing as well as Elektor. However, we strongly suspect that the circuit would have been around before.

Parts Required:JaycarAltronicsPakronics
1 x Solder BreadboardHP9570H0701ADA1609
1 x Packet of Wire LinksPB8850P1014ASS110990044
1 x 4.7kΩ Resistor *RR0588R7574DF-FIT0119 *
1 x 82pF ceramic Capacitor *RC5323R2821DF-FIT0118 # *
1 x 4.7uF Tantalum CapacitorRZ6636R2635ADF-FIT0117 # *
1 x BP104 IR PhotodiodeZD1947--
1 x CA3140 BiMOS Op AmpZL3835--
2m Single Core Shielded Audio CableWB1500W3010-
1 x 4AA Battery PackPH9204S5028 + P0455DF-FIT0079
4 x AA BatteriesSB2425S4955BPAKR-A0012
1 x 3.5mm Stereo Plug or Socket, See Text.PP0130P0030-
1 x 8 Pin IC SocketPI6500P0550-

Parts Required:

# Substitute item

* Quantity shown, may be sold in packs. You’ll also need a breadboard and prototyping hardware.

The circuit itself is just an inverting amplifier built around op-amp CA3140, which is a biMOS op-amp with a MOS input stage and an bipolar internals, and are a low-noise, single-supply replacement for the UA741. The gain is set by R1, but the circuit may not need to be changed. We used this directly into a pair of headphones with no problems. Adjust the value of R1 if you want to change the volume of the output. The ceramic capacitor can stay as it is.

The circuit should be built on solder board, as the solderless breadboards introduce too much noise. We laid out the wire links first, and soldered them before adding the resistor, capacitors, and IC socket. Note that the tantalum cap can be an electro, and can be any value from 1µF and upward. It is there for power supply smoothing.

Next, install the wiring. Bare the ends of one long and one short length of single-core shielded audio cable. Take the long piece, and solder the inner core of one end to both the left and right terminals of a 3.5mm stereo plug or socket, depending on if your headphones have a fixed cable, or a socket on the headphone body. Then, solder the braid to the ground tab. Then, solder the inner core of the other end to pin 6 of the IC socket, and the braid to the wire link nearby, which connects to the GND rail of the board.

Take the smaller piece of audio cable, and solder the braid to the GND rail of the board. Solder the inner core to pin 2 of the IC socket. At the other end of the cable, twist the braid and solder it, let it cool, and slide on a piece of 1.5mm heatshrink that covers most of the exposed wire. Strip the tip of the inner core and solder that too. Slide on a small piece of heatshrink for this one, too. Solder the diode onto the wire, with the cathode indicated by the tab going to the inner core, and the braid going to the anode leg which has no tab. The tab is tiny, so be very careful.

Slide up the heatshrink and heat it, then cut a piece of 6mm heatshrink to slide over the entire assembly. Place it so that the  edge lines up with the face of the photodiode. Shrink it into position and trim any excess from the active face of the BP104. Now you can place the sensor inside something to shield it.

We 3D printed a tube that can glue onto the battery pack. Solder the battery pack wires onto the board into the correct rails, and install the CA3140 into its socket. All that remains now is to install batteries and plug in some headphones. You might wish to play a bit before you commit to gluing the board and sensor to the battery pack.

Changing the value of R1 will be much easier if you do it before gluing the whole board down. Use the microphone by pointing the sensor at a source of heat. It works best by detecting changes in heat, and there are limits to the range. For example, we got no sound from a small blue, nearly clear gas flame, but turning the air supply down until the same flame was bright yellow and dancing around gave us a sound like rain on a tin roof.