book collections email follower instructable user
Picture of Low-cost Sensors in the Physics Classroom

Thanks to controller boards such as Arduino, sensors are easy to use and affordable, which makes them very attractive as an educational resource. This lnstructable aims to bring teachers closer to the didactic use of low-cost sensors in the Physics class. We will offer examples of practical activities in which sensors are used as a tool to illustrate physical concepts, to show the relationship between magnitudes in a practical way, or to take measurements in laboratory activities. The aim is to make physics classes more practical and motivating, and to encourage students to be creators and not just consumers, of technology.

To show some examples of the use of sensors in secondary education, we’ll measure temperature, infrared radiation, and humidity. For each sensor, we start with a short introduction of the sensor, and then we show how to connect and program it, giving example programs. Finally, some practical activities are given to show how to include the use of the corresponding sensor in the classroom. Specifically, we'll measure the following magnitudes:

  • Temperature, both with the LM35 Analog Temperature Sensor and with the waterproof version of the DS18B20 Digital Temperature Sensor.
  • Infrared radiation, using the Flame Sensor.
  • Humidity, with the DHT22 Humidity and Temperature Sensor

We think that the central point of this activity are the physics concepts that we’re dealing with, and technology is just a teaching aid. For this reason, we’ve tried to simplify the programs and the hardware as much as possible, so technology does not distract students from the important thing. But if students are already familiar with Arduino, you can encourage them to make more complex programs or to add additional components like an LCD screen to read the measured values and an external power bank to make it portable. Or they can make a data logger, saving the measured values in an SD card. And why not design and 3D print an encasing for it? The possible improvements are endless!

Learning objectives

  • Connect and program sensors with Arduino.
  • Measure temperature, infrared radiation, and humidity.
  • Analyze experimental data and extract conclusions.

Science topics

We'll use different sensors to measure several physical magnitudes, so we'll cover a wide range of science topics:

  • Thermometric scales
  • Heat transfer
  • Electromagnetic radiation
  • Changes of state
  • Thermal equilibrium

Grade level

Secondary education (13-18 years)

Before starting

To read the values measured by the sensors we'll use the Arduino programming language in the Arduino IDE. To keep this Instructable reasonably short, we'll assume that you are already familiar with Arduino. If, on the other hand, this is your first time with this microcontroller, we recommend you to visit this Instructable: “A Beginner's Guide to Arduino”, where you'll find all the necessary information on how to start using the Arduino board.

So from now on we'll assume that you have installed the Arduino IDE in your computer, and that you already know how to write a sketch, how to add a library to the Arduino IDE, how to upload a sketch to the board, and how to open the serial monitor.


  • Computer with the Arduino IDE (
  • Arduino UNO board
  • LM35 Analog Temperature Sensor
  • Flame Sensor Module
  • DHT22 Temperature and Humidity Sensor
  • DS18B20 Digital Temperature Sensor
  • Jumper wires
  • One 4,7 kOhm resistor (for the DS18B20 temperature sensor)
  • Breadboard

The material used in this activity can be bought from a local reseller or from any web store that sells electronic components.


The diagrams and schematics in this Instructable have been adapted by the author, using Inkscape, from the following sources: Fritzing, Inductiveload (Wikimedia Commons),, AdaFruit, Flaticon and Leonardo Potsay (Wikimedia Commons). Thank you all for sharing!

Step 1: LM35 Analog Temperature Sensor

Learning objectives

  • To measure temperature
  • To convert temperature in degrees Celsius into degrees Fahrenheit and Kelvin.

The LM35 sensor is an inexpensive device that can be used to easily measure temperatures between 2 °C and 150 °C, with a 0.5 °C precision at room temperature. Thanks to its internal integrated circuit there's no need for any external calibration, since the measured values are directly proportional to temperature in degrees Celsius. According to the sensor's datasheet, the relationship between the voltage it measures and the temperature is 10 millivolts = 1 °C.


Connecting the sensor

The sensor has three pins that can be connected directly to Arduino (or, if you prefer, you can use a breadboard). Pins 1 and 3 power the sensor through the Arduino board: pin 1 is connected to +5 V and pin 3 to GND (see the attached images). The pin in the middle is the data pin, meaning that Arduino uses this pin to read the values measured by the sensor. It must be connected to any of Arduino's analog inputs (any of the six pins marked as “Analog In” in the board, from A0 to A5). We'll assume that the sensor is connected to analog pin 0, so if you choose a different pin you need to change the programs accordingly.

Reading the sensor

Once you have connected the sensor, let's check that everything is working properly. To do so, try the following program that reads an analog signal in Arduino:

void setup() {

void loop() {
 int sensorValue = analogRead(0);

Copy the sketch in the Arduino IDE and upload it to your board. Once the upload has finished, open the serial monitor to read the measured values. You'll see a column of integer values. Heat the sensor with your fingers. Do you see how the numbers change? And what if you put it close to an ice cube? Anyway, these values aren't what we were expecting... because the analogRead() function returns integer values between 0 and 1023. So let's transform them into degrees Celsius.

Expressing the data in degrees Celsius

When the analogRead() function returns the value 0, it means that the voltage read by Arduino is 0 V, and the value 1023 means that the voltage is 5 V. Taking this into account, we can transform the analog values into voltage just by doing this simple calculation:

volts = sensorValue*(5.0/1023)

where volts is the voltage (in volts) and sensorValue is the analog value measured by Arduino.

According to the LM35 sensor's datasheet, the relationship between voltage and temperature is linear, with a change of 1 °C in temperature resulting in a change of 10 millivolts in voltage. So first we convert the volts to millivolts:

millivolts = volts*1000

and then millivolts to degrees Celsius:

degreesC = millivolts/10

Now the raw values measured by the Arduino board are expressed in degrees Celsius. Simple, isn't it?

Putting it all together, the final program is as follows:

void setup() {
  // Initializing the serial communication at 9600 bits of data per second

void loop() {
  // Reading the value of the sensor from analog pin 0
  // and storing the value in a variable called sensorValue
  // sensorValue stores integer values (int)
  int sensorValue = analogRead(0);
  // Transforming raw input (0-1023) into voltage in volts (0-5 V)
  // volts stores decimal values (float)
  float volts = sensorValue*(5.0/1023); 

  // Transforming voltage in volts into millivolts
  float millivolts = volts*1000; 

  // Transforming voltage in millivolts into temperature in degrees Celsius
  float degreesC = millivolts/10;
  // Printing the output in the serial monitor

  // Delay in between reads (in milliseconds)

As you can see, this sensor is very simple to connect and program, making it very appropriate as an introduction to the use of sensors in the physics classroom.

Activities for students

This sensor is calibrated to give the temperature in degrees Celsius. Modify the program in order to convert the measured temperatures into degrees Fahrenheit and Kelvin.

"...closer to the didactic use of low-cost sensors in the Physics class..."
I am confused by the inclusion of the word 'didactic.' What do you mean to say?
Didactic means educational or teaching. So, "...closer to the educational use of low-cost sensors..."
When I Google "Define Didactic" I get "intended to teach, particularly in having moral instruction as an ulterior motive." and "in the manner of a teacher, particularly so as to treat someone in a patronizing way."

Of course usage 'like changes' so Websters may yet decide to redefine the term to accommodate the millenials and Humpty Dumpty (“When I use a word,’ Humpty Dumpty said in rather a scornful tone, ‘it means just what I choose it to mean — neither more nor less.’ ― Lewis Carroll, Through the Looking Glass)
English is not his first language soooo:
synonyms:instructive, instructional, educational, educative, informative, informational,
JohnC4302 days ago
Thanks for sharing
billbillt3 days ago
Wonderful!... Thanks for sharing!......
I am a former Science and Math teacher. I found that many times teachers wanted to use the newest cute devices without regard to effectiveness. You could save some money by using a $2.00 thermometer for the temperature and in addition demonstrate the thermal expansion of a liquid. The use of an Arduino type computer is widespread, but mostly reinventing the wheel by educators. And in the case of thermal expansion and the rise of temperature vs. time it obfuscates. An analog thermometer also shows visually the rise in temperature, rather than just numbers on a display.
Again good ideas, but your target audience is wrong. These demonstrations might be useful in a grade school or primary general science curriculum, not in a physics class.
Very good ideas here.

"...3D print an encasing for it..." This is not possible. You could 3d print a case for it so you could encase it.

The word magnitudes is not a scientific term. It is an idiom. Your device doesn't measure magnitudes. It measures the magnitude of various properties of matter. If you're going to use the device in a physics class you need to get the terms correct.

This is great! Thank you for creating and sharing this guide. :)