Teaching optics using a Raspberry Pi

Raspberry Pi is a great tool for teaching. Its affordable price makes it appealing for students and teachers that can make interesting experiments without spending a fortune.

The understanding of optics requires lot of geometry, but equations are deeply understood only by a small number of students. Drawings may help, but making them requires some ability and precision. Needless to say, in most cases, the result is static and, in order to understand what happens in different conditions, require to realise many drawings.

A very interesting alternative is using an application called GeoGebra that can be downloaded for free from the Internet. Interesting enough, GeoGebra runs on Raspberry Pi. Every student, then, can do his/her own experiment with optics using GeoGebra. See this post to learn how to install it (quite simple, in fact; the only tricky part being installing the Java virtual machine).

In short, download the arm version of the Java VM from http://jdk8.java.net/fxarmpreview/index.html, then issue the following commands in a terminal

sudo apt-get update
sudo apt-get install geogebra
sudo apt-get install geogebra-gnome
mkdir -p /opt
sudo tar zxvf (name of package) -C /opt
rm (name of package)
sudo /opt/jdk1.8.0/bin/java -version
export JAVACMD=/opt/jdk1.8.0/bin/java
geogebra

In Roma, we realised a very successful exhibition about light and its scientific applications for the International Year of the Light, in which, besides other experiments, we put few interactive stations made of a Raspberry Pi running GeoGebra, a screen and a mouse. One of those stations, for example, is intended to show what happens to a light ray when passing from a medium to another with different refractive index.

You can see a copy of it at the following address: https://tube.geogebra.org/material/simple/id/1395913. I firmly believe that, if you use tools on the web (like the one I provided above) you can learn something, but if you make it by your own, you learn much much more. So, I strongly suggest you make your own simulation: even if not so nice, it will be much more useful!

How can you do it? Very simple, in fact: just follow the steps below for a very basic simulation, then help yourself to give it a better look. In the following I’m assuming that in your preferences you set the units of the angles as radians.

Draw a line a parallel to the x-axis. Just select the appropriate tool on GeoGebra, then select the x-axis and move the pointer to draw a line parallel to it. This action selects a point A on such a line.

Locate a random point B in the plane above the line. This will be the light source and it is supposed to be in the air, whose refractive index is 1. Draw a vector from B to A.

Selects the perpendicular line tool and draw a line perpendicular to the first one passing through point A. Locate a point C on it.

Using the angle tool, selects, in turn, points B, A and C to compute the incident angle α .

Now, a little algebra is needed. In order to compute the refraction angle you need to use the Snell’s Law:
n1sin(α)=n2sin( γ )
Here n1=1 is the refraction index of the starting medium, while n2 is the one for the medium supposed to be under the first line. Assume n2=1.33. You can then compute the refraction angle γ as the arcsin of sin( α )/1.33. The angle made by the refracted light with the x-axis is the a right angle minus the latter, hence you can compute the angle
β=
π
2−γ
You can just type that formula in the input box at the bottom of the GeoGebra window. Greek letters can be selected from the tool on the right of the input box, while π can be just written as pi. The tangent of such an angle is the slope of the line parallel to the refracted beam, that you can compute just typing
m=tan( β )
There are infinite lines with that slope: the one passing through point A has intercept given by
q=x(A)-m*y(A)
where x(A) and y(A) returns the x- and y-coordinate of point A. You can, then, just type the equation of the line whose slope is m and whose intercept is q as
y=m*x+q.

Select, now, the intersect tool and locate the point D where the x-axis intersects the latter line, and draw a vector from point A to that point.

You can now select the line used to locate point D to make it invisible. You can now move the light source B around: the incident angle changes, as well as the refraction one, hence the refracted beam, represented by the latter vector moves accordingly.

You can, of course, refine the simulation: the case in which the starting medium has a higher refractive index with respect to the second one is not well simulated by the above tool. With GeoGebra you can specify conditions for the visibility of objects, so you can add an alternative simulation to be shown when those conditions occur. You can learn more about that either reading the GeoGebra user manual or stealing what I made in the simulation cited above.

This post appears also on the Element14 blog.

Annunci

An Arduino based Newton’s disc

During the past days I was busy with the preparation of a scientific exhibition that opened on September 25 for the European Research Night. The year 2015 is the International Year of the Light, as declared by the UN, hence the theme of the exhibition is the Light and its scientific applications.

We were working on a Newton’s disc, when I came to the idea that one can easily build an electronic version of such a device. A Newton’s disc is a disc divided in segments, each of which has a different color. When the disc spins rapidly, the coloured segments fade and the disc appears to be white. The Newton’s disc is used to demonstrate that white light is in fact the superposition of light beams of different colours.

The reason for which the disc appears to be white is that images collected by our eyes persists on the retina for a while (1/20 of a second). When the disc spins and you look at a given sector, the coloured light coming from that sector enters you eye and ‘remains’ on its surface for such short time. However, if the disc spins rapidly enough, the light coming from the same place rapidly changes color and light of different colours hits the same portion of the retina in less than 1/20 of a second. The eye then receives a series of different signals in a short time window and our brain interprets all these signals as a single image providing the illusion that the disc is white.

We can do the same using an RGB LED.

A RGB LED is a LED capable of emitting three colours with different intensities: red, green and blue. Weighting the light of each color allows us to produce light of mostly any color. Instead of mixing three colours at the same time, one can switch on and off each color at the time. If the switching time is low enough you can easily distinguish the sequence: red, green, blue, red, green, blue, etc.. However, if each color is on for a very short time, the eye detect each color in less than its persistence time and interprets the sequence of the three colours as just their sum: white.

RGB LED’s exist in two flavours: common cathode and common anode. Both have four pins and contain, in fact, three coloured LED’s. In the common cathode pins, the longest one is the cathode to be connected to the ground. Putting a voltage on the other three pins, a current flows through the appropriate LED and the device emits light of the corresponding color. In common anode LED’s, the longest pin is the anode to be connected to the voltage source. Connecting the other pins to ground let the current flow.

In this example, I used a common cathode LED with an Arduino board: the longest pin was connected to the Arduino GND pin, while the other to pins 9, 10 and 11 (the PWM ones) by means of a resistor, to limit the current flowing.

Operating such a device is very simple. Just define the used pin as output pins and put them to zero in the setup:

 

void setup() {    
  // set pins as output pins
  pinMode( 9,   OUTPUT);  
  pinMode(10, OUTPUT);  
  pinMode(11,  OUTPUT);  

  // switch off all LED's
  digitalWrite( 9,   LOW);  
  digitalWrite(10, LOW);  
  digitalWrite(11,  LOW);  
}  

In the loop, you can just put each pin to an appropriate value in sequence. For example:

void loop() {
 int i = 9;
 while (i < 12) {
    // switch on a given color
    analogWrite(i, 125);
    // wait d milliseconds
    delay(500);
    // switch off that color
    analogWrite(i, 0);
    // go to next color
    i++;
  }
}

With this code you switch on a color for 0.5 s, then switch it off and repeat the sequence on each color. Reducing the delay to 50 milliseconds you can no more distinguish the single colours. The switching between them is so fast that what you can see is just white light.

The movie above shows my Arduino Newton’s disc looping such that the time for which each color lasts is progressively reduced until the eye can no more see the single colours switching. In the end, the LED appears as white.

RGB LED’s, in fact, are yet another applications of the Newton’s theory of light that can be either interpreted in the wave theory. What happens in an RGB LED is that lights of three colours and different intensities sum up and the result is light whose color is the “sum” of the three beams. Modern TV’s and computer monitors, as well as phone screens and similar devices works the same way: the screen is divided in pixels, each of which is made of three tiny light sources of three colours (red, green and blue). Switching on and off with the appropriate intensity each of the sub-pixels results in the image on the screen.

This post appears on the Element14 blog, too.

Scienza e Arte nell’Anno della Luce

Dal 5 marzo al 21 giugno alle Scuderie del Quirinale c’è una mostra di opere di Matisse. Ne sono venuto a conoscenza grazie alla pubblicità esposta un un autobus in servizio che mi precedeva mentre tornavo a casa dal lavoro (vedi foto). La DSC_0433pubblicità mi ha subito colpito per un particolare. Per capire perché è necessario sapere che nel mio ruolo di Delegato alla Comunicazione Scientifica della Facoltà di Scienze di Sapienza Università di Roma, sto curando una mostra, che dovrebbe inaugurarsi a fine settembre, sul tema della luce, in occasione della proclamazione del 2015 come Anno Internazionale della Luce.

Quello che mi ha colpito della pubblicità è il quadro in essa riprodotto: “i pesci rossi”, realizzato nel 1911. Nel quadro Matisse dipinge una vasca con quattro pesci rossi che non si vedono solo attraverso le pareti trasparenti del vaso che li contiene, ma anche attraverso la superficie libera dell’acqua, cioè da sopra (vedi figura a destra). Di sicuro abbiamo avuto piú volte quest’esperienza che consiste nel vedere due immagini dello stesso soggetto.

matisse pesci rossiLa spiegazione del fenomeno è data dalla rifrazione che la luce subisce provenendo dai pesci e passando attraverso le pareti del recipiente dall’acqua ai nostri occhi, ma anche dagli stessi pesci agli occhi attraversando la superficie libera dell’acqua. I due percorsi sono diversi e diverso è l’angolo del quale sono deviati i raggi luminosi, ma hanno la caratteristica di partire da uno stesso punto e di raggiungere entrambi i nostri occhi facendoci percepire due immagini dello stesso soggetto.

È lo stesso fenomeno che mi permette di sorprendere i bambini delle primarie ai quali propongo il seguente esperimento: metto una moneta da due euro sul fondo di una ciotola dalle pareti opache posta al centro d’un banco. Li faccio quindi disporre in circolo attorno alla ciotola e chiedo loro di allontanarsi fino a quando non riescono piú a vedere la moneta. A questo punto verso acqua nella ciotola e magicamente la moneta riappare. A questo punto basta chiedere ai bambini di spiegare perché per far partire un’interessante dibattito scientifico che di solito giunge alla spiegazione corretta abbastanza rapidamente.

Suggerisco ai miei colleghi insegnanti di prepararsi, in occasione dell’Anno della Luce, una lezione integrata di geometria (in particolare di geometria analitica), ottica e arte: i vostri studenti non dimenticheranno piú le Leggi della rifrazione e l’opera di Matisse e di altri pittori che hanno riprodotto situazioni simili.

Di certo ancora una volta si dimostra, se mai ce ne fosse bisogno, che arte e scienza sono tra loro strettamente legate e che, al contrario di quanto pensano in troppi, non è affatto vero che le spiegazioni scientifiche distruggono la poesia di certe manifestazioni della Natura o dell’arte: semmai è vero il contrario! È proprio la possibilità di spiegare razionalmente certi fatti che li rende ancor piú affascinanti. Che meraviglia ci sarebbe se un fenomeno fosse opera di un mago o di qualcosa di soprannaturale? L’abilità di un prestigiatore desta certamente piú ammirazione della constatazione del possesso di poteri magici. Allo stesso modo la spiegazione scientifica di un fenomeno che induce sentimenti di stupore e meraviglia non fa che rafforzare questi sentimenti, dal momento che se ne possono godere tutti, ma proprio tutti, gli aspetti.

Solo chi conosce la fisica di un tramonto può apprezzarne fino in fondo la bellezza, e solo uno sciocco può pensare che la conoscenza dei fenomeni che permettono alla luce del Sole di produrre un tale meraviglia la renda arida e meno godibile di chi non la conosce.

Crea un sito o un blog gratuitamente presso WordPress.com.

Su ↑