book collections email follower instructable user
Picture of Photonics Piano #phablabs

Building a “piano”-like device where sound is at first replaced by colored light which is guided and diffused by optical fibers. Conversion of light into sound can be further implemented exploiting commonly available technology.

DISCLAIMER: By using this information you agree to be legally bound by these terms, which shall take effect immediately on your first use of the information. PHABLABS 4.0 consortium and its member organizations give no warranty that the provided information is accurate, up-to-date or complete. You are responsible for independently verifying the information. VUB cannot be held liable for any loss or damage that may arise directly or indirectly from the use of or reliance on the information and/or products provided. PHABLABS 4.0 consortium and its member organizations disclaim all responsibility to the maximum extent possible under applicable laws: All express or implied warranties in relation to the information and your use of it are excluded. All liability, including for negligence, to you arising directly or indirectly in connection with the information or from your use of it is excluded. This instruction is published under the Creative Commons licence CC-BY-NC.

Step 1: An Introduction: Refraction, Reflection, LEDs

Here we briefly introduce the technology of light that will be involved in the construction of the photonics piano.

The refractive index

The refractive index of a transparent medium (n) is the ratio between the speed of light in vacuum (c) and in the medium (v). This number indicates how much the light is slower in that medium with respect to the vacuum. For example, the refractive index in water is n(water) = c/v(water) ≈ 1.33, in glass n(glass) = c/v(glass) ≈ 1.52, in plexiglass n(plexy) = c/v(plexy) ≈ 1.49.

Reflection and refraction

When light hits the boundary between two materials with different refractive indices two things happen:

(a) Reflection: part of the light is reflected back with a reflection angle identical to the angle of incidence. Typically, all propagation directions are measured from the direction normal to the surface. In this case, referring to photo 1: alpha = beta

(b) Refraction: the rest of the light crosses the boundary and is transmitted in the second medium. The transmitted beam changes its propagation direction, and this change is what we call refraction. The new propagation direction, the refraction angle gamma is related to the incident angle alpha by the "Snell’s law": n(1).sin(alpha)=n(2).sin(gamma)

The beams and the angles alpha,beta and gamma are shown in photo 1, for the case in which n(2) > n(1).

Note that if we reverse the beam propagation, incident and refracted beams follow the same path, but in the opposite direction. In addition angles and obey the same Snell’s law. In photo 2, the beam propagates from lower to higher refractive index, and the transmitted beam is refracted towards the normal line; in photo 3, the beam propagates from higher to lower refractive index, and the transmitted beam increases its angle from the normal line.

Refraction is also responsible for the fact that when we observe an object in water, the object seems in a different position: this is because the light from the object gets deflected by refraction, while our brain tends to locate the objects by prolonging the rays propagating towards our eyes. This is sketched photo 2 &3, where refraction creates the illusion that the fish is along the dashed direction. This effect explains why a pencil immersed in water appears to be "broken"

Total internal reflection

As we have discussed, when light hits the boundary between two materials with different refractive indices, it is split into two rays, the reflected and the refracted one respectively. The total amount of light is preserved, but which ray is brighter, the reflected or the refracted one?

The splitting ratio between reflected and refracted depends on alpha and on the refractive indices, n(1) and n(2). Let’s estimate this splitting ratio when light travels into a medium with smaller index of refraction. In this case, according to Snell’s law, the refracted angle is greater than the incident angle, which means that the ray is bent away from the normal and towards the surface.

Concerning the energy, the closer is the refracted ray from the surface, the smaller is its power. This is schematically sketched in photo 4.

What happens when the refracted angle approaches 90°? And when it is larger than 90°? In this case, the refracted light is negligible, and all the energy of the incident light goes into the reflected ray. This process is called “total internal reflection”, and the surface separating the two media acts as a perfect mirror. From this observation, we can also easily calculate the critical incidence angle θc at which the refracted beam direction approaches 90°. The critical angle can be calculated from Snell's law by setting the refraction angle equal to 90°:

n(1).sin(90°) = n(2).sin(θc) → sin(θc) = n(1)/n(2)

Total internal reflection is the basic process governing light propagation in fiber optics. Their working principle is illustrated in photo 5.

Any time the beam hits the border of the inner medium (with n(2)>n(1)), if the incidence angle is larger than θc then it gets reflected. In principle light can propagate without energy losses along a fiber which could be several kilometers long. Photo 6

The following videos and figures show some examples of multiple reflections of a laser beam in water and in a Plexiglas slab.

The experiment with water can be easily done with the help of a laser (we recommend a green laser, since it can be better seen) and a fish tank with some water (few-centimeters-deep is more than enough). Put a spoon of salt into the water: this will enhance the visibility of the beam propagating in the liquid. If you shine the beam from outside the tank towards the water surface, you should see the reflected beam and some light should emerge from the surface (remember: never stare directly into the laser beam, therefore to check whether lights emerges from the surface, use a piece of paper and evaluated whether some transmitted light is projected on it). By changing the incidence angle, you will see that the transmitted beam vanishes, and all light goes into the reflected beam. Thanks to the internal reflection, you have just built a mirror…. without a mirror. If the water is not too deep, you should also see that the beam reflected from the surface, gets subsequently reflected also by the bottom surface of the tank, and directed back toward the surface. You have just built a liquid prototype of an optical fiber. Photo 7&8

LED and resistors


A diode is an electronic device which conducts current on only one direction, when its positive terminal (“Anode”) is connected to the “+” of a voltage supplier or a battery, and its negative terminal (“Cathode”) to the “-”.

When we connect its terminals the other way round, the diode behaves as an insulator and it does not conduct any current. It conducts electricity like the valve of a tire conducts air: air can be pumped from outside into the tire, but it cannot flow outside. Photo 9

There are many diodes for all kinds of purposes in electronics; some of them emit light. They are called “Light-Emitting Diodes”, or short “LEDs”. In this workshop, you are going to encounter LEDs shining in various colors. They will only light up if you connect them the right way (Anode to “+”, Cathode to “-“), they stay dark (and sometimes they burn) when connected the other way around.

How to recognize the Anode? It is usually the longer terminal wire.


A resistor is an electric device which conducts electricity when a voltage is applied to its end connections. The applied voltage V and the transmitted current I are related by “Ohm’s law”: V=RI
where R is called the “electrical resistance” and its units of measurement is Ohm (Ω). The units of the voltage V is the Volt (V), the unit of the current I is the Ampére (A). In contrast with the LED, a resistor conducts current in both directions, which means that it can be connected either way. Photo 10

In the workshop, the resistor will be used to limit the current that goes through the LED. Without it, the LED will likely get damaged. Each LED requires its own resistor before you connect it to a power supply.

Protecting the LEDs

To limit the current flowing through the LED, each LED is connected to a resistor, according to the scheme in photo 11.

Each LED works with a specific voltage V(L) and a preferred current; by choosing the proper resistor for any LED, it is possible to feed the LED with the desired voltage and current. In the workshop we will use a set of 7 LEDs (12 LEDs in the extended version). If they are all different (for example because they are of different colors) the value of each resistor must be chosen according to the properties of the corresponding LED.

Let’s now evaluate how to calculate the resistor for a typical LED.

In the workshop, the piano will be powered by a USB charger (or the USB port of a computer). The voltage of such power supply is 5V. Hence we calculate the resistance for the case

V(0) = 5V

Let’s consider a LED with the following characteristics (we took these data from the official technical sheet of the LED):

V(L) = 3V

I = 20 mA = 0.02A (suggested current)

According to the figure with the circuit:

V(0) = V(L) + V(R) → V(R) = V(0) – V(L) = 5V-3V = 2V

The current I flows through both the LED and the resistor. Therefore, from Ohm’s law we get the resistance of the resistor: R=V(R)/I = 5V/20mA = 250 Ohm

A resistor has a set of colored rings on it which denote its electrical resistance. See photo 12 for the encryption key.

Not all resistance values are available commercially. We suggest to choose, among the available ones, the resistor with the closest lower value of its resistance. In our case this is 220Ω. This corresponds to a current of 22mA, just a little higher than the suggested one, but still enough not to burn the LED.