The Classroom

Making with Light

Understanding, Measuring, and Making Colour in Maker Projects

Daniel Koch

Issue 47, June 2021

We explore and measure some of the properties of light and frame them against the needs of makers trying to get that perfect lighting effect.

An examination of the properties of light may, at face value, be an odd topic for DIYODE. For us, this all started as an investigation to measure the colour of a chemical light stick in order to make an LED replacement. It quickly became a much bigger examination of light and how it relates to our maker projects.

A significant proportion of maker projects involve light in some way. This might be from a simple indicator, to an LED screen, to complex and tuned lighting effects. Understanding light can help achieve the desired effect when one is sought. It may not matter what shade of green an LED power indicator is, for example, but knowing a deep red indicator might cause more headaches for a nearby infrared sensor than a blue indicator would is certainly useful knowledge to have. Likewise, trying to match light to a certain coloured object is much harder without this understanding. Other reasons to cover this material will become apparent as we explain things throughout.

This is a very broad topic and we know that makers are from all backgrounds. Once upon a time, it would be common to assume a certain level of knowledge in the electronics hobby. That’s no longer true, and rightly so. The result, though, is some people have lots of knowledge in one area while never having learned another. Previously, it could have been assumed that learning had taken a certain, relatively defined progression. Because of this, we have to pitch to a very broad audience and make as few assumptions as possible. There have to be some words and concepts that we assume people will know or easily look up, else we’d fill the whole issue with one article. However, we'll try to explain as much as we can while still considering those who know a lot of this material already.

WHAT IS LIGHT?

We’re all familiar with light, but a lot of people don’t know what it is. What we all know are its effects, because the human eye responds to it as one of our five senses. Even those who are completely blind are affected by it, because the near-infrared and infrared parts of the spectrum of what is scientifically defined as light, are what cause the sensation of heat. There is still limited scientific debate as to what light is, having been considered a wave, a particle, and a variety of other things over history, but there is a strong consensus now that it is in fact in its own category. However, we’re not getting into quantum physics, which is the branch of physics that explains what light is. The summary version that you need to know for most purposes is that light is a form of energy that exhibits characteristics of both particles and waves, sometimes together, depending on the situation.

There are a great many terms related to light that you’ll no doubt hear or read in your electronics journey. Some are commonly misused or misunderstood, while others are more obvious. We’ll try to discuss them in a logical order, but some of these things are a chicken-and-egg challenge depending on your existing knowledge. You may find going backwards to something you’ve already read may help at times.

SCIENTIFIC CONSISTENCY

That heading is something of an oxymoron. In any given topic, there is at least some disagreement over a given point by the scientific community. The same can be said for the engineering community too, and we see this in the maker world with ‘experts’ disagreeing over what we should do or have done wrong in our projects. In science, for mainstream topics, there is generally a consensus. However, even a concept as fundamental as gravity has detractors, who are qualified, knowledgeable people but who interpret data differently or challenge the way the data has been gathered. This is actually a good thing, because whenever we revisit our knowledge and examine it in order to defend it, we find any problems with our understanding, interpretation, or information-gathering. This makes the body of knowledge stronger but it also means that knowledge changes over time. Remember, once upon a time, the whole world ‘knew’ the Earth was flat and was the centre of the universe.

For many years the speed of light was considered constant in a vacuum, and this figure is usually quoted as ‘the speed of light’. However, some say the true speed of light may be different, citing new developments in measurement technology and computing. Some other challenges come from the realisation that what was previously thought to be a perfect vacuum is, in fact, not completely empty. That is in addition to the fact that light is known to move at different speeds in different media. While some sources do quote the speed of light in air, this has to be done with conditions, as even the slightest change in temperature, air pressure, impurities, or the like can change the figure.

For consistency, light in a vacuum is still quoted as the Universal Constant, a figure used a lot in scientific calculations and deeply embedded in the world around us. Ignoring the debate over the absoluteness of a vacuum as we know it, we will rely on the figure of 299,792,458 metres per second. This is the SI standard unit used around the world across branches of science and mathematics. As you read other sources, you may find other figures based on the points above, including those challenging the absolute vacuum issue. The speed of light, or the Universal Constant, is represented in calculations by the letter ‘c’, always in lowercase.

WAVELENGTH AND FREQUENCY

One of the ways of describing light is by its wavelength or frequency. This is the most common descriptor encountered in electronics (besides the common name of the colour, of course, like ‘blue’), and underpins some of the following explanations. Any wave has a wavelength, even ocean waves. It’s harder to use the term with ocean waves because they’re irregular, but light waves are sine waves with clear regularity. The wavelength is the physical distance between two identical points on the wave. It can be any point, from the peak or trough, to the zero crossing, to anywhere in between. It just has to be the same, so zero crossing points are often used for measurement.

Radio waves are described the same way, but they’re a lower frequency than light. Some radio frequencies have wavelengths in the metres range. Light, on the other hand, is measured in nanometres. That’s one metre divided by one billion. It’s most commonly expressed as nanometres and abbreviated as ‘nm’, but you might find it in scientific notation, too. In this case, it appears as n x 10-9m. Note the suffix there: If the measurement is given in scientific notation, it is always in base units, which in this case is the metre. Wavelength is denoted in calculations by a slightly modified version of the Greek letter Lambda; λ. It’s the same letter, written in a more cursive script than the Greek alphabet version.

Frequency is the number of identical points of the wave that pass a point in one second. It is expressed by the unit name Hertz, abbreviated to Hz. The usual set of metric prefixes apply, such as the familiar ‘kilo’ and ‘mega’, all the way through to exahertz (EHz) for Gamma rays.

Frequency is inversely proportional to wavelength. That means, as the wavelength gets smaller, more identical points will pass a given point in one second and so the frequency increases. The frequency can be found by using the Universal Constant. Specifically, ƒ = c ÷ λ.

As a worked example, let’s figure out the frequency of 520nm light, which is a deep green colour.

Yes, that’s Terahertz. Remember to perform the calculation with base units. The 520nm was converted to metres, written in the equation in scientific notation. This is problematic with some phone calculators. A scientific calculator has an ‘exponent’ button, usually labelled ‘exp’ or ‘e’, and performs the calculation correctly. Phone-based calculators can be a challenge.

Many inbuilt phone calculator apps now have a scientific mode but it is not always perfect. Some do not have an exponent button and others do not regard order of operations correctly. There should at least be some sort of ‘to the power of’ button, so you will have to enter ‘520 x (10^9), where ^ represents whatever that app’s ‘to the power of’ button is labelled, and the brackets ensure the phone gets the order of operations correct.

THE EM SPECTRUM

Light is part of the electromagnetic spectrum. This spectrum covers all electromagnetic energy from the highest-known frequencies (which are the most energetic), to the lowest. Gamma rays are near the top, with research and definition still ongoing into what’s above that. At the bottom, radio waves start from below 1Hz, although practical applications start above there. The 50Hz radiation from mains power is on the electromagnetic spectrum. However, the 20Hz to 20,000 Hz audio band is not, because this is sound pressure, a physical wave. Having said that, the electrical signals that make it in a speaker coil will still radiate electromagnetic fields at the same frequencies.

EMITTED VS REFLECTED

Leaving the maths for a while, we need to think about how light reaches our eyes. There are two avenues: Emitted and Reflected. Reflected is by far the most common, but emitted needs to be explained first. Emitted light is the light given off by a source. It travels in straight lines unless acted upon by some external phenomena (most of which are uncommon and outside the scope of this article). Light may reach our eyes this way, such as looking at a light bulb, or a panel full of indicator LEDs. All atoms and molecules making up matter have a shell of electrons as part of their structure. These electrons have different bands they can occupy, at different distances from the atom. The higher the band, the further out from the nucleus of the atom and the more energy the electron possesses.

Emitted light is generated when the electrons in an atom or molecule are excited by some applied energy into a higher than normal state, then drop back down again, releasing this energy as a photon. This energy travels as an electromagnetic wave (remember, light exhibits traits of both particles and waves) at a specific frequency and wavelength. It is a form of energy conversion, because something has to excite the electrons into their higher energy orbit, before they can release that energy as a photon and revert to their lower energy orbit. The energy contained therein determines the wavelength, and is different for different materials.

Light can be emitted in different ways. Any black body radiator that is heated will emit light. A black body radiator, which is the term for a theoretical non-reflective and completely opaque (solid with no light able to pass through) body, emits light based on its temperature. The hotter it is, the higher the frequency and smaller the wavelength of the light emitted. At some point, that light progresses from the infrared to the visible, and will eventually pass beyond. This is the basis for the concept of colour temperature. This heating is how incandescent bulbs emit light, as well as fire. We’ll expand on colour temperature later, but this overly-simplified explanation of black-body radiation will do for now.

Besides heat, electrical energy can also be used to excite molecules into emitting photos. Different chemicals will emit different wavelengths or combinations of wavelengths depending on their atomic structure and energy orbits. This is the basis for LEDs, as different chemical combinations in the semiconductor, and different doping chemicals, produce different colours of light. In the case of the incandescent globe, the emitted light through heat usually encompasses a broad range of frequencies. In the chemical combinations of LEDs, the emitted wavelength is usually quite precise, with only a small deviation from a specific dominant wavelength. Electricity does not have to pass through a semiconductor to emit light, either. Lightning’s light, as well as corona discharges, come from the energy in electricity exciting atoms which then release photons.

The other forms of coloured light that were employed before LEDs became mainstream are forms of filtering. White or broad-spectrum light was passed through some form of filter to obtain light of a narrower spectrum, and therefore light output was always reduced when compared to the source. There’s more on filters further on. The last point to note for now is that light can also be emitted from chemical reactions. The energy from the reaction excites a certain molecule in the same way heat or electricity does, and this is the basis for things like glow sticks, Luminol used in forensics, and bioluminescent living things. Most importantly, our own sun emits light as a result of nuclear and chemical reactions, and this is by far the greatest source of light on earth, with far more light reaching earth from the sun than all other sources, human-made included, combined.

Reflected light relies on emitted light. After photons are emitted from a source and travel through space, they eventually meet some form of matter. Out in space, there isn’t much of that, so let’s assume sunlight has reached the surface of Earth. When sunlight hits a substance, some wavelengths are absorbed by the molecules, and some bounce off. Every molecule has a range of particular energies that it will absorb, and the others bounce off as reflections. White substances reflect all the light that hits them, while black materials absorb all wavelengths. Sometimes a percentage of whole light bounces off, but this is more a structural, surface consideration. Having said that, most things we call ‘black’ do reflect a very limited amount of wavelengths as well as a percentage of the whole light that strikes them, which is why we can still see them. Think of shiny black plastic.

The photons of the absorbed wavelengths give up their energy to the molecule and cease to exist. This energy is often released again, but as heat or molecular vibration. Those wavelengths which are not absorbed and therefore bounce off are the reflected light, and this is what the human eye sees as colour. So, the leaf of a plant absorbs red, orange, some yellow, blue and purple light, while reflecting green and some yellow light. Red paint reflects red light and absorbs others. In this way, making pigment colours is actually a subtractive process. Chemical compounds are added until only the desired wavelengths are reflected and all others absorbed. Printer inks are a good example of that, and this introduces some of the limitations we’ll discuss later.

EXCITATION AND FLUORESCENCE

Some substances behave a bit differently. Very small wavelengths of light, just outside the visible range, are called Ultra Violet (UV). Ultraviolet wavelengths have quite a lot of energy and are capable of exciting certain atoms. However, when they do, these atoms absorb a photon of UV light and its energy transfers into the electron shells of the atom, pushing the electrons into a higher energy orbit like emitted light. When they collapse and release a photon, however, some of the energy has been transposed as heat or in other ways lost from the equation. The light emitted is now of a longer wavelength than that which created it. This is the basis for Fluorescence. Most of us see this in ‘fluoro’ colours, which always appear to have a bit of a ‘glow’ to them.

In a space that is lit only by UV light, there will be some visible light because no UV emitter commercially produced is perfect. Shorter wavelength sources, such as 365nm UV lights, tend to have a soft blue light. 385nm and 395nm sources are a deep purple. Different UV wavelengths excite different substances, but the 385nm to 400nm range is what is generally known as ‘blacklight’ as used in stage, music, party, and entertainment venues. The photo here shows several objects and materials on the DIYODE Workbench under 385nm UV light. The spots are hot-melt glue, which cannot be seen in the amounts present under white light.

Some substances can hold the energy absorbed from bombardment with photons, and release it later. This is ‘phosphorescence’, the basis for ‘glow in the dark’ products. As UV light has the most energy, most phosphorescence can be seen after UV light exposure. Sunlight has quite a lot of UV, as do ‘fluoro’ tubes. Modern LED downlights and other area lights have a reasonable amount too, but an incandescent globe has little. That’s why a light globe has less effect on glow-in-the-dark stars in a child’s bedroom than, say, a fluro tube or blacklight. The effect is still there, however.

After photons are captured and the energy transferred to the molecule’s electron orbits, the energy stays for a while. Slowly, these electrons drop back to their lower orbits and release a photon. So far, this is like fluorescence. However, the process is not instant. Some molecules hold their energy longer than others. Some are released straight away, while others are released hours later. Phosphorescent substances actually conform to an exponential release curve and have a half-life. After a given time period, half the stored energy will have been released. After another identical time period, half of what was left will have been released. That’s why glow-in-the-dark products have an intense glow that fades quickly but maintain a visually medium glow for a longer time.

FILTERS AND TRANSPARENCY

One aspect of emitted and reflected light that we touched on was the concept of colour filtration. We said that some substances absorb some wavelengths of light and reflect others. The same is true of substances that pass light through them. Some materials pass nearly all of the light that strikes them. Things like clear glass are an example, and makers of camera lenses and glasses are always seeking to improve glassmaking and modern synthetic materials to bend light but not absorb any. This passing through is called ‘transmission’.

Other substances absorb some wavelengths just like solid objects, but pass others. These substances can be used as filters. Some pigments can be used to colour glass. Blue stained glass, for example, absorbs other colours but allows blue light to pass through. Older stained glass used pigments that were not always terribly transparent, but modern materials are far clearer. Think of a tinted acrylic sheet, which you can see through with total clarity but in a limited colour range. Flash colouring gels are a similar example, though those don’t always need to be so clear. The soft gels used on stage lighting before LED stage lights became common are another example, as are coloured glass envelopes for incandescent light bulbs. Many cheap party lights in incandescent days were actually not transparent to the eye, and were in fact just thin paint in plain glass.

THE HUMAN EYE

Understanding how the human eye sees light can help us make decisions regarding maker projects that use it, even when that’s as simple as choosing a colour of panel indicator. The sensors that make up the human eye can detect light between around 700nm at the deepest red through to around 400nm at the deepest violet. These are idealised typical values, and any given individual may not be able to see this range. In the centre of the human eye are about seven million ‘cones’, which receive visible light and transmit it to nerves that are sensitive to it.

There are three types of cone cell: One is a sensor for long wavelengths peaking at 564nm to 580nm, another for medium wavelengths peaking at 534nm to 545nm, and one for short wavelengths peaking at 420nm to 440nm. Each one has a ‘response curve’, where it responds to a range of wavelengths but is more sensitive to some than others. There is also some overlap and some deficiencies. While the majority of the cones themselves are of the L type, the human eye is overall most sensitive to green light, although the centre varies from 555nm in bright light to 507nm in low light. In very low light, the rods at the sides of the retina take over. These are very sensitive but do not process colour like the cones do.

COLOUR

Colour is the name we give to the human perception of different wavelengths of light. We say perception, because the brain will interpret a pure wavelength of, say, 550nm, the same as it will interpret the correct combination of a higher and a lower wavelength. For example, the right amount of 520nm light mixed with the right amount of 650nm light will produce the right signal in the brain.

In pigment mixing as described earlier, things may be a bit different. Usually, pigments are mixed to absorb wavelengths until the desired spectrum is left. However, sometimes this takes the form of leaving several narrow spectrums which the human brain interprets as one colour. In emitted light, the trend is toward mixing wavelengths until the desired colour is achieved. There are gaps in the capabilities of both systems. Before we discuss them, however, we need to know about colour temperature.

Colour temperature is the temperature at which an ideal black body radiator emits light of that colour. On its own, it does not mean anything because no light source is produced this way anymore. Having said that, carbon arc lamps, soda-lime lamps, and other historical light sources did come close. Colour temperature is most useful as a comparative definition for light generated by other means than heat. It is more precise than trying to use nanometres or frequency because often, it is used to describe the tinge in an otherwise broad-spectrum light source encompassing many wavelengths.

The colour temperature scale is measured in Kelvin, the unit measure of absolute temperature. This is the same size increment as the Celsius temperature scale (degree is a synonym for increment) but starts from absolute zero, -273°C. We don’t use the ° symbol with Kelvins, but it can be helpful for some people to think of it this way to avoid getting confused with the decimal multiplier k. When used to describe Kelvins, the uppercase letter is used. Colour temperature technically starts in the red scale, as the object heats enough to excite from infrared into red. However, it never progresses through the whole spectrum. Therefore the colour temperature scale as used goes from orange through white to blue.

Colour temperature is most useful when trying to get accurate lighting for photography but is important when lighting spaces to be habited by humans. Getting the right colour temperature of light has all sorts of effects on the human body, sensory system, and psychology, and it’s well beyond the scope of this article. For makers creating, say, controlled lighting for a space or a fancy auto-dimming desk lamp, it may be more important. Getting the right ‘tinge’ in a light makes a big difference for colour perception, eye strain, and even mood and concentration.

In general, the colour ‘daylight’ is considered to be the light from the sun at midday. Obviously, this will not be the same all around the world, so a standard has been earmarked as 5600K, the colour temperature of sunlight under a given set of conditions including being vertical, and a clear sky with minimal water vapour. This is the standard used for photography and if you’re building your own LED video or still photography lighting, you’ll need to look for LEDs that specify a colour temperature. This is one of the distinguishing factors between cheap and good quality lights.

The other aspects of colour are hue, saturation, and brightness. These apply to reflected, transmitted, and emitted light, although saturation is rarely discussed in terms of emitters. Most people are familiar with the colour wheel at least from school, if not since. In school, it was presented with red, yellow, and blue as the primary colours. This is valid for pigments and the light they reflect, but the primary colours of emitted light are red, green, and blue. Any other colour can be made (with some material limitations) by a combination of these colours. This is what the term ‘hue’ refers to: it is the exact colour as shown on the colour wheel.

This separates the term from the word ‘colour’, which is really about a perfection in the human brain and can vary even for one given hue if environmental factors are altered. Many of us have seen those viral photos where changing the contrast, surrounding colour, or some other factor completely alters the apparent colour of a fixed hue object, and results in wide and heated debate. In fact, perception is a big factor in choosing a colour, and emitted light as opposed to reflected light is a little less prone to these factors because of how it interacts with the eye and therefore the brain. Hue, therefore, is related to wavelength.

Saturation is, for want of a better word, the intensity of a hue. At the one end, grey has no intensity of a given hue, and at the other, full saturation means total colour. It’s hard to grasp from a written description, so look closely at the diagrams. Brightness may also be referred to as lightness. This is the amount of the hue, literally the same as the brightness of a light bulb. A hue may be at full saturation but not very bright, in which case it will appear rich but dim. Brightness may exceed the point where the hue is perceptible and approaches white in the brain, and this is important when considering whether a light is too bright or the colour absent.

LIMITING FACTORS

For any maker wishing to portray a specific colour, there are limiting factors. The same goes for a lot of other situations, too. Any technology has gaps in its capability and a limit to its reach. Think of a basic home printer. Generally, there are three colours that are mixed to form a spectrum of colours. Each ink starts with a defined hue, and the only thing that varies is the amount of each deposited. This means there are gaps in what can be produced.

To overcome this, the more serious a printer is, the more ink colours it has. In the DIYODE office is a printer that has twelve ink tanks in it. This very advanced, large-format printer can print visually stunning photos but still has limits. It cannot, for example, produce a very vivid bright purple. The combination of hues in the available inks cannot combine to make the colour. This concept is called ‘gamut’, and describes the range of capabilities of a pigment.

However, the trend continues. An LCD screen has a gamut, too, and quite a limited one at that. Before the advent of LED monitors, colour-accurate monitors for photographic use were hard to engineer and very expensive because of this. Colour-accurate LED monitors are still expensive. The same can be said of any other source: There will be a point where a combination of the available wavelengths simply cannot reproduce a particular colour or range of colours.

COLOUR SPACES

While we’re on this topic, it’s worth covering the difference between RGB and CMYK. While not directly related to maker projects, it relates to the maker experience in a lot of ways. The term ‘colour space’ refers in part to gamut, but also refers to the way that colour information is processed, separated, and recorded. The most common is sRGB. The lowercase ‘s’ is for ‘standard’, which RGB is of course Red, Green, and Blue. The sad thing is, there isn’t a standard. Where one manufacturer sets ‘red’ might be 650nm, while the next may use 640nm. The same is said for software. This makes things very difficult when it comes to comparing and converting. There are other RGB spaces too, such as Adobe, who have their own. Converting from Adobe RGB to sRGB will result in a loss of gamut.

However, all RGB colour spaces are additive, meaning that the colour is produced by the addition of wavelengths in differing proportions. The side effect of this is that any form of digital display will have a wider gamut than any printed option. By contrast, printing used the CMYK standard, for Cyan, Magenta, Yellow, and black. Even printers with many ink options still use a variation of this, with colours chosen within the hardware or unique software to give a better colour representation that the four-colour option, but still never as good as RGB. We have to convert DIYODE material to CMYK to be sent to print, and many a time we’ve been disappointed with the loss of vibrancy or detail. It cannot be avoided, however.

RGB values will be given as a percentage of the three colours (or possibly a decimal), or as a value from 0 to 255. For example, a value of 0,125,255 means no red, half brightness green, and full brightness blue. Values can also be represented in hexadecimal. While technically all of this results in 16.7 million colours, and the human eye only ‘sees’ around seven million, digital representations still fall short of reality sometimes. There are still times when a colour the human eye can see is not one of the 16.7 million. There are, depending on the display technology, noticeable gaps as the 16.7 million colours are not always evenly distributed, nor are the 7 million.

CHOOSING OR MAKING A COLOUR

All of this is finally leading to a maker-relatable point: Choosing or making colour. As has been pointed out, there are limits to what can be reproduced with emitted light. Every chemical combination has its peaks and choices have to be made.

If all you want is a certain colour of indicator LED or even monochromatic (single colour) broad-area lighting, then you can choose LEDs based on the datasheets. These, as well as many catalogue listings, quote the dominant wavelength and peak wavelength.

Dominant means, as its name suggests, the colour that will be most apparent, and this is the one to focus on. The chemical combinations of each LED vary, and so does, therefore, the wavelength emitted. For example, while trying to replicate a chemical glow stick recently, we chose LEDs with dominant wavelengths around the 550nm mark rather than the more common 520nm. This gives a bright, vibrant green rather than the deep forest green of 520nm. This is useful for sensitivity to the human eye, and we want the glow sticks to serve as distant pathway markers in dark environments, making attention-catching important.

If you want a panel indicator that is noticeable when looked directly at, but won’t distract your peripheral vision, then comparing the response graphs of the human eye to the wavelengths of the LEDs you can buy can help you make a choice. Bright blue, for example, ends up being noticeable quite easily while deep red is right down the response curve for the long wavelength cones.

The same goes for area lighting: If you want to create an atmosphere, you may need more red light to give the same apparent brightness when compared to green or blue light near their peaks. Incidentally, the main reason the peak human eye colour sensitivity is between the medium and long wavelength cones is that, while the 565nm color is between the peaks, it activates both sensors to a greater degree in total than one of the other peaks on its own.

In many maker situations now, the trend is towards integrated RGB LEDs, and has been for some time. By setting the RGB value as above, you can vary the amount of each colour of light and therefore the colour of the combination. There are some caveats, though. Many RGB LEDs, cheap ones in particular, do not conform to the response curves of the human eye. The blue chip, for example, may be a much higher brightness than the red chip. This is a drastic problem, because not only does it affect the result of a theoretical RGB value, it also means you’ll have even more trouble compensating for the human eye’s response. Let’s say you have an RGB LED chip with a blue LED die that is twice as bright as the red die present. The human eye is already far less sensitive to the 650nm typical red LED than it is to the typical 460nm blue LED. This means that the red LED would actually need to be much brighter than the blue to give a mix that is, to the brain, apparently equal.

Further complicating this is the starting wavelength of the LED dies themselves. In our glow stick project, we were trying to replicate a certain green colour. It’s not quite lime green, but we think it’s around the 560nm mark. Green low-brightness diffused LEDs are usually 570nm, and these are more yellow-looking than the glow stick.

We have a bunch of green LEDs at 550nm, and these look a deeper green. Our response was to use a WS2812-controlled RGB LED to try to make the right colour. But try as we might, the right colour is simply in the middle of what is available, because of the natural wavelengths of the LEDs on that particular chip. Even when we incremented the 0-255 values for each die one bit at a time, we could not get a match. At every point, activating the red die was causing too much yellowing and never got to the ‘lime’ colour we wanted.

If you are wanting to use an RGB strip to, say, light the area surrounding a sign with the same colours that the sign is screen-printed in, then it may or may not work. If the dominant wavelengths of the dies on the RGB LEDs are in the right range, you can produce the colour. If they’re not, you’ll have to settle for ‘near enough is good enough’. Most of the time this is fine. If the colours on the sign are in right away from the dominant wavelengths of the LEDs, however, then sometimes you’ll find colours that just cannot be reproduced, just like with the printer ink.

The higher the quality of the LEDs used in an RGB LED, the less of a problem this is. Again, datasheets are your friend. Better-quality chips will include a graph of the response of each colour. A well-made one will be intense across a broader range of wavelengths, meaning the mixing is more effective at producing a given colour. This is in contrast to discrete LEDs, which are often made to quite a narrow spectrum because of other end-use considerations. In these cases, the LED is chosen for its fixed colour.

The ins and outs of RGB LEDs in terms of analog vs digital, common anode or common cathode, and addressable vs pwm and other controls, won’t fit here. We’ve had to assume you either already know or are finding out, because that information would be a full classroom length article on its own. In fact, people ask us for that, then we’ll make it so.

Remember back to colour temperature? If you’re making with white light, don’t forget about this either! One of the projects we have in development, albeit a small one, is a ring light for a 25mm macro lens. The objective of this lens is so small it’s hard to buy what we want. To make sure we have maximum accuracy, we sourced 5600K LEDs to make our ring light. If you’re making something where accuracy is key, then daylight colour temperatures are your friend. On the other hand, if you’re making flickering candles, then stark cool whites are not your friend. In these cases, make sure you try to find white LEDs which list their colour temperature, and choose something from the warm part of the scale.

Before we change pace, there are several calculators available online to help with these tasks. One that we found enables you to enter a wavelength, and then it generates a colour swatch, sRGB, and Hexadecimal values for that wavelength. As noted, the accuracy of the RGB value depends on where that RGB system’s values define as absolute red, green, and blue. It’s still a very helpful tool. Please note we have no affiliation with these suppliers, we’ve just found their tools very useful for playing around on the workbench. See the Reading & Resources section for the calculators.

MEASURING WAVELENGTH

As promised, we’re going to do some hands-on exploration now. We originally set out to measure the wavelength of a chemical light stick in order to replicate it. Sadly it wasn’t bright enough to measure with the equipment and techniques we have available, but they can be used with any bright-enough light source. While a 20mcd panel indicator is probably not bright enough, a 500mcd LED is if you have a dark enough workspace and reduce the distances involved as much as practical.

SPECTROSCOPES

A spectroscope is an instrument for measuring the wavelength of light. At heart, they all work on the principle of splitting light by reflection through a prism. Very basic ones for primary and early high school use project that split light onto a scale. This is read through a viewfinder, but accuracy is limited. Si limited in fact, that the one we bought showed very nearly the same reading for a deep green LED versus a bright slightly-yellow green LED. The scale didn’t have enough resolution for anything else. However, this is adequate for its intended purpose, where pointing it at blue light will give a very different result on the scale than pointing it at red light.

More advanced spectroscopes use optical tubes, precise prisms, adjustable tables, and scales marked in degrees to measure the angle of refraction of a sample of light directed through one tube and viewed through the lenses in the other. This form is far more expensive - around $600 for one worth having. That’s too much for the one-off or very rare use it would get on our workbench. It stands a chance at measuring that problematic light stick though, if used in darkness.

IMAGE CREDIT: labconusa.com

For practical purposes, we’re going down a different road. What is needed is a piece of equipment called a diffraction grating. This is a plate of very finely etched plastic or glass. The first diffraction gratings were fine wires or even hairs suspended in parallel in close proximity. Etching is just a more mass production-friendly way of doing things. When light passes through these narrow slits, it bends, or diffracts. This causes the light to travel at a different angle to what it was before. The angle is related to the spacing of the slits and the wavelength.

The longer the wavelength, the more the light is diffracted. There is a relationship between the angle of diffraction and the wavelength, and so, using measurement, we can calculate the wavelength. This is the principle on which the more advanced spectroscope works, with its rotating parts and degree-increments scale. It’s also how the basic spectroscopes work too, but instead of measuring angles, they just project the bent light beam onto a scale.

The diagram is a simplified representation and in real life, some light is not diffracted but goes straight through. This helps us determine if our light source is square to the diffraction grating, which is very important for what comes next.

Hands on:

Make A Very Simple Spectroscope

To make your own very simple spectroscope, all you need is some white cardboard and a diffraction grating. We sourced ours from an online educational supplier, and there are several companies like this. Most diffraction gratings in these listings will have spacings between 300 and 1200 lines per millimetre. We bought 600, 1000, and 1200 line per millimetre versions and found that, although the more lines per millimetre, the more accurate the results, the harder the measurement was. This is because the more the light is diffracted through closer lines, the further apart the measurement points are therefore the lower the error. However, the further apart the points are, the bigger the apparatus has to be.

Instead of plain cardboard, we mounted our device on foam-cored cardboard. This is more rigid and makes life easier when manipulating it or moving it to darker locations. First of all, use a ruler to mark and draw a line in the dead centre of the sheet. Use a drafting square to mark a line precisely perpendicular (at right angles to) the centre line, about 30mm from the end of the sheet.

From the front of the sheet, mark and cut a piece that is the same length as the width of the sheet, and around 50mm high. From the other side, triangular braces that are 50mm on the long side and 25mm on the short side.

Now glue the pieces so that there is a backdrop piece exactly 90° to the centre line, supported by the two triangles. We used hot melt glue for speed on camera, but craft glue would be a better choice if you have time.

Cutting more from the same side as the bracing triangles, make up a holder for the diffraction grating. It needs to be snug as the grating must stay vertical. Place this holder so that it is 200mm from the backdrop piece, and straddling the centre line. At 700nm, a worst-case scenario, the angle of diffraction is just under 45°. This will place the dots of light 10mm in from the edge of the card.

Now you’re ready to test your new apparatus. The light source needs to be fairly cohesive. Lasers work the best, but it will be rare that you actually want to find the wavelength of one of these. Usually it will be an LED or some other light source. For LEDs, we placed them into a blacked tube made from a taped-up drinking straw. The light coming out of here was mainly the forward-facing rays. Point this through the diffraction grating so that the light projects onto the backdrop and the centre spot is directly in the centre. If you cannot secure the light source (but Blu Tack will help you here), then you may need a friend.

With the light carefully centred, measure the distance between the centre line, and the middle of the brightest of the two outer dots. The way diffraction gratings are mass-produced means that usually, one side is brighter than the other. Record this number, then measure the distance from the grating surface to the backdrop, to the millimetre. Then, get some paper, a scientific calculator, and lots of caffeine.

CIRCLES, TRIANGLES, AND THE DREADED ‘T’ WORD

Unless you’re comfortable with mathematics and geometry in particular, the word ‘trigonometry’ will probably have you very scared right now. However, it need not be that way. What many people don’t realise is that trigonometry is actually the maths of a circle. Triangles are related to circles via the way radii and arcs interact. Thankfully, because of the way we set up our apparatus, we can skip the hardest of the trigonometry lesson and concentrate on the easier right-angled triangle trigonometry.

We have just measured two sides of a triangle. We have enough information to find the third side, but it doesn’t help us so we won’t bother. What we need now are some angles. The angle of diffraction through the grating relates to the wavelength of the light and the distance between the grooves in the grating. They relate with the trigonometric function ‘sine’, abbreviated on the calculator buttons as’ sin’. The equation looks like this:

Where Θ is the angle of diffraction, λ is the wavelength in nanometres, and d is the distance between the gratings. Because we used a 1000 lines per millimetre grating, the distance between them is one thousand divided by one thousand. That’s a millionth of a metre. If you use a 300, 600, or other lines per millimetre grating, you’ll have to factor this in.

A word on entering information into your calculator: If you’re not familiar, calculators can trick you. Remember that in mathematical equations, functions and numbers placed beside each other are multiplied.

So, sineΘ is actually the sine function multiplied by the angle in degrees represented by Θ. We don’t have that number yet, so bear with us. Also remember that not all calculators do order of operations properly. Phone apps will give you the most grief. All numbers must be in base units. To get the distance d into metres, we divide by one million.

Dividing during the calculation is asking for trouble, so we’ll divide it first by expressing it in scientific notation. For our grating, that’s 1 x 10-6. The superscript number is the number of places to move the decimal point, and the minus sign tells us to move it to the left.

We end up with five zeros between the decimal point and the ‘1’. However, that’s clumsy to enter into the calculator too. Look for a button on your calculator with ‘exp’ or ‘10-x on it. This button allows you to enter scientific notation straight in.

The same goes for our wavelength when we get it. It will be in metres, so we need to convert that. We’ll do that later, however. First, that angle that we need for Θ. Look back at the trigonometry diagram from earlier. We have two lengths, n and m. n is the distance between the grating and the backdrop, which we accurately measured earlier.

We also have m, which is the distance between the centre and the bright spot of our diffracted light. This is what we have just measured. We have a different relationship now, however. We’re using the Tangent trigonometric function, abbreviated as ‘tan’ on the calculator. The equation looks like this:

Where Θ is the angle we need to find, m and n are as above, and ‘tan-1’ is the calculator function for inverse tan. To enter it, we will need brackets to ensure the calculator performs the m/n division first then multiplies the result by tan. Order of operations treats division and multiplication equally. Enter the string straight into your calculator like this, substituting your measurements for m and n:

tan-1(m ÷ n).

Note that on most calculators, the inverse tan function will involve pressing ‘shift’, ‘2nd function’ or something similar to call an alternative option for the ‘tan’ key.

The result should be a whole number with decimals that visually approximates the angle you can see formed on your apparatus. For example, for red it will be somewhere around 40-45°, and for blue it will be smaller. So, if you have a result of 5° or 150°, something’s wrong. This number is what we use for Θ.

Now, go back to the original equation. Now you have Θ, you can complete that first calculation. Again, use brackets just to make sure your calculator behaves how you want it to. A good one won’t need them, but use them anyway to be sure:

(1 x 10-6)sinΘ

Substitute your angle for the Θ symbol, and also alter your 1 x 10-6 to reflect whatever grating you are using, as above. The result will be the wavelength of your light in metres. To convert to nanometres, look for the ‘answer’ key, which is usually abbreviated as ‘ans’.

Some calculators have it outright, while others use a shift for second function (2nd F) key. Press it so that ‘ans’ or equivalent appears in the entry area of your calculator, then enter 1’Exp’9, where ‘Exp’ is the exponent or x10x key. Pressing enter should give you a result in nanometres.

Congratulations! You’ve calculated the wavelength of a light source. It’s not perfectly accurate in this form and is unlikely to distinguish between, say, a 420nm and 425nm LED, but it’s fairly reasonable depending on your measuring accuracy. You can experiment with known light sources to find its overall accuracy.

The bigger you make it, the better. In the video we link to, a whiteboard is used and n is one metre, not twenty centimeters. Measuring accuracy is improved because a 1mm error on our 200mm apparatus is a much bigger percentage of the total than 1mm across 1000mm. The bigger you make the apparatus the bigger the effect, but the stronger your lightsource needs to be to see a result.

THINGS WE DIDN’T COVER

There are some things we still did not have space to cover. We mentioned the different aspects of using RGB LEDs, such as analog vs digital. We’ll cover that another time. One thing that is worth reading that we likely won’t get to cover again, is CRI. If you deal with white light for photographic or video purposes, or indoor lighting, CRI is important. It stands for Colour Rendering Index and is a measure of how accurately a light source can reproduce colours.

The concept of colour temperature is deeper than we summarised, too, as are the issues surrounding cones and rods in the eye, and indeed colour itself. The summary here will likely get you making things well, but if you're interested in the deeper science, there’s much more to it.

In addition, we didn’t cover any of the behavioural properties of light and associated terms. Things like reflection, refraction, incident and reflected rays, and other basic concepts are outside the scope of the points we are making but useful to know in other situations. You may also be interested in the deeper workings of diffraction gratings.

All of that aside, we hope that summary gives you an idea of all the ways light and colour can be considered during maker projects, from awesome art displays to simple panel indicators.