Colour and temperature of the stars: a demonstration using Arduino

Teaching the colour of stars is not as trivial as one might think. It can be challenging for students to grasp that the colour of stars follows a temperature sequence. This paper introduces a simple experimental setup for instructing the correlation between a star’s colour and its temperature. Furthermore, the experimental setup facilitates the exploration of the topic of colour addition, demonstrating to students how to replicate the colour of a star—a spectrum colour—by employing an RGB LED that emits only primary colours (red, green, and blue). The experiment utilised an Arduino microcontroller board in conjunction with RGB LEDs and an LCD display. The activity was conducted with 53 7th-grade students from a private school in Portugal results suggest a positive reception, indicating success in both motivational and cognitive aspects. The overall outcomes underscore the effectiveness of the activity in imparting new knowledge to students.


Introduction
Teaching astronomy is usually difficult when it is taught to young children because it involves wide concepts they will have to accept without further explanation and laws that cannot yet be deeply explained.Astronomy topics are addressed at the 7th grade in Portuguese schools (ages around 12 and 13 years old), according to the guidelines described by the Ministry of Education [1], for regular classes.This document addresses the following topics: • Describe the organisation of celestial bodies in the Universe (…) • Explain the role of observation and instruments used in the historical evolution of the knowledge of the Universe, through research and selection of information (…) • Establish relationships between the structures of the Universe by collecting information from different sources • Describe the origin and evolution of the Universe based on the Big Bang Theory When searching through the internet, students usually find ESA (https://esahubble.org/images/opo0505b/), and NASA (www.jpl.nasa.gov/infographics/the-size-of-the-sunin-comparison-with-other-stars-in-the-universe;https://spaceplace.nasa.gov/sun-compare/en/)websites containing information about those topics.However, one that is not addressed in curricula, but in many situations is a curiosity of the students, is the colour of the stars: do they all have the same aspect as our Sun?And if not, why do stars have different colours?
It is a fact that the colour of a star is associated with the temperature on its surface.The explanation involves the knowledge of physical laws like Stefan-Boltzmann law, Rayleigh-Jeans law and Planck's law, as well as understanding colour perception in human eyes due to cone cells.This is usually well beyond the knowledge of students.
It is known from observations that red (dark) stars are the coolest, while blue stars are among the hottest.When trying to reproduce the relationship between temperature and colour, the problem arises that it is not possible to explain why stars that should be 'green' are, in fact, white.A possible approach was inspired by the work of Planinšic ˇ [2] and Carvalho and Hahn [3] who used LEDs to study colour addition.Considering the limitations of the theoretical framework of the students, the use of electronic devices allows the representation of the colour of the stars.For this purpose, we built a setup with a microcontroller Arduino for controlling the light intensity on an RGB LED that illuminated a ping-pong ball acting as the 'star' and an LCD to display the temperature and the corresponding colour of the star.
Even though stars emit a continuous spectrum of light (not considering the absorption lines due to the chemical elements existing in the stars' atmosphere-https://blog.sdss.org/2015/11/30/how-sdss-uses-light-to-measure-the-massof-stars-in-galaxies/; https://skyserver.sdss.org/dr1/en/proj/basic/spectraltypes/lines.asp),we are able to reproduce stars' colours using LEDs that do not have a continuous spectrum of emission.Moreover, we provide an explanation for teachers and students on how colours can be perceived by our eyes.This will be shown in the following sections.

Experimental setup and methodology
To achieve the desired results, the Arduino UNO open source platform was chosen, which has been highlighted in the literature as a practical way to implement experimental activities [4][5][6][7][8][9], including adding colours.The advantages are, among others, low cost, ease of handling and versatility.
The I2C adapter allows using fewer pins on the Arduino board, liberating important PWM pins (3, 5, 6, 9, 10 and 11) that were used to control the 4 RGB LEDs.The two ping-pong balls had a hole in the bottom and were used as colour mixers [2,9]: one with a small hole covering the RGB LED L 1 representing the 'star' and the other with a bigger hole covering the three RGB LEDs L 2 , L 3 and L 4 functioning independently as red, green and blue colour emitters.The L 2 , L 3 and L 4 RGB LEDs could be hidden by placing a cardboard over the corresponding ping-pong ball.
The experimental setup can be used by the teacher in different ways.The simplest and cheaper one is as a demonstration tool where only one kit is needed and the teacher can interact with the whole class at once, demonstrating the relation between the colour and the temperature of a star.For those who can afford it, the experiment can be done with several kits in order for students to work in small groups of three or four students.It is also possible to mix both strategies and have one kit that will be explored by a small group of students at a time while other students engage in another related activity, such as to search for information about stars and their temperature or even about what is an Arduino.This last strategy was the one chosen for this investigation.In this photo we omit the three RGB LEDs L 2 , L 3 and L 4 for simplicity.

Setup 1-RGB LED L 1 and the potentiometer
The RGB LED L 1 is covered with a ping-pong ball and represents the star with a certain colour.At this stage, a cardboard is placed over the L 2 , L 3 and L 4 RGB LEDs to hide them.When the potentiometer, Pot, is rotated, L 1 starts emitting a light colour following a code (see appendix 1) to reproduce the sequence of colours red-orangeyellow-white-blue as the apparent temperature in Kelvin, displayed on the LCD, goes from 2500 K to 50 000 K (figure 2).This sequence of colours and respective apparent temperatures are in accordance with the classification of stars [10] presented in table 1.
Students must be stimulated to explore the setup and take notes of what they observe.The consequent discussion will enable the students to draw the following conclusions: a.There is a relationship between the colour of the star and the corresponding temperature; b. Red stars are the coolest and blue stars are the hottest c.The Sun (which is at a temperature of about 5800 K [10][11][12]) is a yellow star.d.There are no 'green' stars observed with this setup This last conclusion is an observable fact and will be the focus of our discussion in the following experimental step.

Setup 2-RGB LEDs L 2 , L 3 and L 4
Students may be interested to know why the colour of the 'star' in Setup 1 was obtained as a combination of primary colours red-green-blue and how it was (re)created in the experimental setup.
To show how this happens, the teacher can remove the cardboard box and uncover L 2 , L 3 and L 4 , to explain colour addition, emphasising that these LEDs emit the only colours perceived by our eye's colour receptors (the cones) and NOT the The teacher should explain that the stars emit radiation in a lot of 'colours' altogether, but the cone cells in our eyes perceive only three different colours which are called the primary colours of light: red, green and blue.Thus, it is our brain that combines the information received from the eyes and interprets it as different colours.In this setup 2, each RGB LED L 2 , L 3 and L 4 , emit one primary colour and when they are inserted into a ping-pong ball (figure 2), they simulate the colour addition in our brain.
The choice of having 3 RGBs LEDs operating separately as emitters is to help students conclude that every colour can be obtained from the primary colours.When this is done by a single RGB LED, it acts as a point light source with respect to our eyes, and that is why we see colours on the screens of laptops, TVs or smartphones.

Sample and questionnaire
This setup was tested with 53 students in the 7th grade (ages 12 and 13) in the discipline of physics at a private Portuguese school.All students were previously taught some astronomy contents as mentioned before, but not colour addition.After the activity, the participant students answered the questionnaire (see appendix 2).
The questionnaire consisted of 4 questions.The first three were multiple-choice questions in which students could choose from a range of options, concerning potential knowledge gained during the activity.The last question had seven statements in which students could choose from 'fully disagree' to 'fully agree', to indicate how they perceived the activity and express their feelings about the activity.
The questionnaire was approved by the ethical committee of the Faculty of Sciences of University of Porto (Ref.: Proc.CE2023/p65).Informed consent to participate in the study was obtained both from parents and students in accordance with the Portuguese ethical policy.All responses were anonymous, voluntary and confidential for this study.Moreover, consent for the results of the study to be published were obtained from your participants.

Results and discussion
The first results are the colours of the 'stars' and some of them are shown in figure 2. Note that the LEDs L 2 , L 3 and L 4 are not shown for simplicity of the figure.
The initial three questions in the questionnaire comprised multiple-choice queries related to knowledge acquired during the activity.The outcomes were promising.
Concerning the first question (Q1), 'Which of these colours can the stars display?' an impressive ninety-four percent (94%), or fifty out of fiftythree (50/53) students, answered correctly.This outcome indicates the effectiveness of the activity in learning the possible colours of stars.
For the second question (Q2), 'What does the colour of a star essentially depend on?', once again, ninety-four percent (94%) of students, or fifty out of fifty-three (50/53), responded correctly.This result further underscores the activity's efficacy in establishing a connection between the colour of a star and its temperature.As for the third question (Q3), 'The surface temperature of the Sun is approximately 5800 K.This makes the Sun a ___ star', only fifty-five percent (55%), or twenty-nine out of fifty-three (29/53) students, selected the correct answer, as shown in table 1 [10].Due to the notably higher number of incorrect responses compared to the other questions, the detailed results are illustrated in figure 3.
This outcome highlights two main points: 1there is a need to place greater emphasis on the temperature (and consequently the colour) of the Sun in this activity.Perhaps it is also a good idea to discuss with students the common misconception about the red colour usually meaning 'hot' and the blue colour meaning 'cold', which comes from the students' everyday experience, that is opposite regarding the relationship between colour and temperature in stars [13]; 2-Despite 45% of responses being inaccurate, none of the students identified green as a potential colour for the Sun.This indicates that the experimental setup successfully illustrated the absence of green stars, consistent with the information provided in question 1.
Moving on to the fourth and final question, 'After completing the activity about the colour of the stars, indicate on a scale of 1 (totally disagree) to 6 (totally agree) your perception of the following affirmations', the responses are depicted in figure 4.
The comprehensive findings from the responses denote a positive reception of the activity among students.Furthermore, it is evident that the activity not only sparked curiosity about additional astronomical phenomena but also contributed to a deeper comprehension of the subject matter.Students reported enjoyment and enhanced ease of understanding the content.Notably, some participants expressed a newfound interest in learning coding, indicating a desire to autonomously develop similar activities.
In addition to the questionnaire results, it is crucial to bear in mind that during the exploration of this setup, we need to acknowledge the distinction between stars emitting in a continuous spectrum and the colour addition using LEDs, which is not continuous.Even though LEDs do not provide all spectral colours, employing RGB LEDs enables us to obtain the colours of the stars through the additive effect.Also, green stars cannot be observed because it would require a monochromatic emission of light, which has never been documented in nature.For higher temperatures, red and green light emission diminishes, and all that is visible is a blue star.

Conclusion
The adoption of this cost-effective experimental setup (approximately 30 euros in the most lowcost case) enables educators to involve students in a captivating and inspiring activity, elucidating the connection between star colours and their temperatures.Furthermore, this setup serves as an instructional tool to illustrate the reproduction of various star colours using an RGB LED, emitting only primary colours (red, green, and blue).
Upon implementing the activity with students, a crucial insight emerged for teachers, highlighting the need to ensure students genuinely understand the colour of the Sun.Additionally, the overall outcomes suggest that this activity is wellsuited for 7th graders, imparting new knowledge to the students.
While the sample is non-random, limiting the generalizability of the results, the findings suggest a positive reception of the activities by the students, not only in the motivational and emotional context but also in the cognitive domain.

Appendix 1
How the setup works The first step was to introduce a potentiometer under 5 V difference of potential.This potentiometer is connected to the 5 V pin, the ground (GND) pin and to a 10 bit analog pin (A0), as shown in figure 1.This 10 bit pin is able to read values ranging from 0 to 1023 (2 0 -1 to 2 10 -1).
In order to change the RGB LED (L 1 ) brightness, three PWM (pulse modulated width) digital pins (3, 5 and 6) were used, so the voltage applied to the LED could be controlled.Since the PWM pin is an 8-bit pin, the possible values range from 0 to 255 (2 0 -1 to 2 8 -1) corresponding to an output from 0 V to 5 V, accordingly.
So it was necessary to map values ranging from 0 to 1023 in the analog pin to values between 0 to 255 in the PWM pin.This was done using the Arduino command 'map'.
The same values on pins 3, 5 and 6 were passed on to pins 9, 10 and 11 (respectively).This was done to control L 2 , L 3 and L 4 if additional explanation on colour addition was required.

How to achieve the colour of stars
The goal of this activity was to achieve the same colour results as presented in table 1.
At first, six intervals were defined based on table 1, instead of seven.The main difference was the choice to not differentiate the Yellow and Yellow-White colours, making a unique range from 5200 K to 7500 K.
The second step was to break the range 0-1023 in approximately six equal intervals of around 170 units describing the following colours: red, orange, yellow, white, blue-white and blue.
Since the LEDs brightness responses are not linear and at maximum voltage (5 V) their brightness are different, it was decided that the approach would be visual, that means, the potentiometer would be rotated until the observer saw the orange colour.At that moment, the values of the pins 9, 10 and 11 would be saved.Since this choice was person dependent, it is not claimed that everyone would have the same results.
The last step was made over and over again until all six colours were perceived and the values on pins 9, 10 and 11 were saved.
With those values, it was possible to code, so L 1 would show the colours according to table 1.
It is important to note that: • The initial colour for the 'star' was selected 'by hand' by the authors to be a dark shade of red with a value of 55 on pin 9, to represent a 2500 K temperature near the infrared region, but already on the visible spectrum.• Since the green colour was the most prominent when all colours were subjected to a 5 V difference of potential, its maximum value was chosen to be 220 instead of 255.This enabled the best visual result experienced by the authors.
The visual results allowed the creation of the following table (table 2) that summarises the written code.Table 2 presents the ranges used for the potentiometer (A0 pin) and the corresponding ranges for the different colours that were used for the RDB LEDs, as well as the temperature and the colour identification displayed on the LCD.

Appendix 2
Q1-Which of these colours can the stars display?

Figure 2 .
Figure 2. Some observed colours of the experimental setup.(a) Red.(b) Orange.(c) Yellow.(d) White (e) Whiteblue.(f) Blue and the LCD display showing the apparent temperature (48 488 K) and the colour indication (Blue).In this photo we omit the three RGB LEDs L 2 , L 3 and L 4 for simplicity.

Figure 3 .
Figure 3. Histogram for the answers in question 3.

Figure 4 .
Figure 4. Students' responses regarding the seven affirmations in Q4.
(a) Red, green and white (b) Red, yellow and white (c) Red, green and blue (d) Orange, green and blue (e) Magenta, Cyan and Blue (f) Orange, blue and violet Q2-What does the colour of a star essentially depend on?(a) its atmosphere (b) the incident radiation (c) the reflected radiation (d) its temperature (e) its age (f) the amount of helium and hydrogen it has Q3-The surface temperature of the Sun is approximately 5800 K.This makes the Sun a ___ star.completing the activity about the colour of the stars, indicate on a scale of 1 (totally disagree) to 6 (totally agree) your perception of the following affirmations: A1-I think I know why stars have different colours A2-I feel curious to learn more about astronomy phenomena A3-The activity helps me understand that there is a connection between the colour of stars and their temperature A4-Activities like the one I did make it easier to understand phenomena A5-I would like to have more knowledge about programming so that I can create activities like the one I did myself A6-It was fun doing the activity A7-The activity conveys scientific knowledge in an accessible way

Table 1 .
[10]sification of stars according to the colour and respective temperature.Adapted from[10].

Table 2 .
Values range for analog A0 pin connected to the potentiometer and digital pins used to control the RGB LEDs.The LCD displays the temperature and the corresponding colour.