Arduino - Temperature Sensor
Last Updated :
23 Jul, 2025
Sensors are widely used for sensing different quantities and quantifying them. One such example of a sensor is the temperature sensor which uses Arduino for displaying this temperature. The main feature of this sensor is that it can display the detected temperature on a Celsius scale.
In this article, we will study how to design this Temperature Sensor using the Arduino board and programming software. We will study the specifications needed for this sensor, and the methods and circuit diagrams used for designing this sensor. In addition to this, we will see the Arduino code written on IDE that will result in a sensor.
What is a Temperature Sensor?
Similar to any other sensor, the Arduino Temperature Sensor is used to sense the temperature and quantify the temperature measured in a measurable quantity which is voltage in this case. Therefore, we can define the Arduino Temperature Sensor as a device that produces a voltage proportional to temperature change in the environment. The three pins in an Arduino temperature are used for setting the reference level, setting up 5V, and measuring the variable voltage.
Arduino is used for creating this sensor since it needs to be programmed to convert the measured temperature value to an appropriate voltage. This is what a temperature sensor looks like :
Temperature sensorTechnical Specifications
Before getting started with the sensor, we need to mention some specifications of the sensor that can ensure proper working conditions for the sensor.
- The Arduino board should predict output in a common unit meaning the scale should be calibrated in a Celsius scale.
- The Arduino board must have an accuracy range of 0.5°C to ensure minimum error and maximize accuracy.
- It is preferred that the temperature sensor can accurately be predicted in the −55°C to 150°C range.
- The scale over which the temperature sensor operates must be linear and the scale factor should be around 10 mV/°C
Components of Arduino Temperature Sensor
Apparatus refers to the components that are needed for the project. The components required for designing a temperature sensor using Arduino include.
- One Breadboard
- Arduino Uno R3 (Generally this model is only preferred_
- One LM35 sensor
- Some wires for making connections.
These devices are easily available at nearby electronics shops.
Working Principle of Arduino Temperature Sensor
The idea behind temperature detection is to use a simple formula which is given by
ADC Value = sample * 1024 / reference voltage (+5v)
The temperature sensor LM35 sensor is used for detecting the temperature and sending this value to the Arduino. The Analog Digital Converter (ADC) is used to convert input analog values into a digital approximation using the formula provided above. When a +5 voltage is provided at the input, the digital approximation will be equal to
ADC Value = input voltage * 1024/4 so ADC Value = input voltage * 205
Temperature Sensor with its Circuit Diagram
Let us see the construction of Arduino - Temperature Sensor. Here is a circuit diagram of the sensor. We can refer to it for making connections. Note that the temperature sensor has three pins.
Arduino - Temperature Sensor circuit
- Pin 1(DC voltage): This pin is used for setting up the DC voltage pin to 5V on the Arduino UNO board.
- Pin 2(Analog voltage output): This pin is responsible for generating the output of the measured temperature.
- Pin 3(GND): This pin is used to set the ground level on Arduino using some reference voltage.
Connection of Arduino Temperature Sensor
Circuit connections of sensorNote that the LM35 sensor has three terminals namely Vs, Vout, and GND. Each terminal has its significance and needs to be used carefully. These terminals are connected as follows:
- Connect a wire to supply Vs with 5V, the connection must be made to the appropriate pin on Arduino.
- Make a ground-to-ground connection from GND to GND on Arduino to set a reference level.
- Connect the Vout to Analog zero on the Arduino board. This will give the output on the serial port.
Pseudocode
Here is the pseudocode to understand the working of the sensor
Define some constants like temp and the pin that will be used for setting temperature.
Set up the environment in the setup() function at serial 9600.
Use the analogRead() function to read the input temperature from the sensor.
Convert the input value to the Celsius scale using the formula shown above.
Display the temperature at the output port using the print function and halt the program for a certain duration using the halt() function.
Code
C
float temp;
int tempPin = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
temp = analogRead(tempPin);
// read analog volt from sensor and save to variable temp
temp = temp * 0.48828125;
// convert the analog volt to its temperature equivalent
Serial.print("TEMPERATURE = ");
Serial.print(temp); // display temperature value
Serial.print("*C");
Serial.println();
delay(1000); // update sensor reading each one second
}
Advantages of Arduino Temperature Sensor
Let us study some advantages of Arduino - Temperature Sensor
- Arduino temperature Sensor is easy to design and easy to understand due to the basic libraries and code lines used in it.
- The Arduino temperature Sensor can accurately predict the temperature value up to 0.50 C values.
- The Arduino temperature Sensor works in real-time and can show values in real-time by detecting any fluctuations in surroundings.
- The circuit components required for Arduino temperature sensors are cheap and cost-friendly.
- The Arduino temperature Sensor is a beginner-level project and has no prerequisites which make it the most common choice for projects.
Disadvantages of Arduino Temperature Sensor
Let us study some disadvantages of Arduino - Temperature Sensor
- Although, Arduino temperature Sensors can predict temperature ranges it is not possible to integrate them into professional projects due to the limitations of Arduino.
- The Arduino can detect errors up to 0.50 range but these can lead to inaccurate results in devices that are temperature sensitive.
- The range over which this sensor can predict temperature is limited therefore, it can't be used over a wide temperature range.
- As compared to other devices like microcontrollers or microprocessors, the Arduino has comparatively low processing power.
- An Arduino takes some time to determine and provide reading, this response time can be large enough if the readings change continuously.
Applications of Arduino Temperature Sensor
Let us study some applications of Arduino - Temperature Sensor
- Sometimes, local weather reports use Arduino-based sensors to predict the temperature and weather fluctuations in a local region.
- Arduino-based sensors can be put to use for science activities like temperature detection for greenhouse gas models.
- Devices that respond to weather conditions like ventilators, heaters, and air conditioners can be automated using Arduino-based sensors.
- Clinics and other medical places can use the Arduino-based sensor to measure patients' temperature and even tell the temperature of units that store medicines.
- Since aquatic life is possible only at a certain temperature range, Arduino-based sensors are installed in aquariums to measure this temperature.
Conclusion
Once you have uploaded this code on Arduino, the sensor will begin working. The Arduino will successfully display the temperature on the Arduino. It will appear on the serial port monitor. The sensor will work accurately and will update with fluctuations in temperature. You can make further modifications to improve the project according to your needs by incorporating some advanced boards.
Similar Reads
Electronic Devices & Components
Avalanche PhotodiodeAn Avalanche photodiode (APD) is a highly sensitive semiconductor detector that uses the photoelectric effect to convert optical signals into electrical signals. In case of conventional photodiodes, PIN photodiodes operate in a linear mode and the output current is very small and also has limited ga
4 min read
PIN DiodeA PIN diode, abbreviated as a Positive-Intrinsic-Negative diode, is a semiconductor tool that belongs to the diode family. Power electronics play an essential role in converting and controlling electrical strength in numerous packages, ranging from electricity components and motor drives to renewabl
15+ min read
Schottky DiodeThe Schottky diode is popularly known as a hot-carrier diode, low-voltage diode, or Schottky barrier diode. It is a type of diode formed by the junction of a semiconductor with a metal. We know that in a PN junction diode, p-type and n-type semiconductors are joined collectively to form a PN junctio
13 min read
Solar CellA Solar Cell is a device that converts light energy into electrical energy using the photovoltaic effect. A solar cell is also known as a photovoltaic cell(PV cell). A solar cell is made up of two types of semiconductors, one is called the p-type silicon layer and the n-type silicon layer. So Solar
8 min read
Power Semiconductor DevicesIn electronic components, Power Semiconductor Devices are electronic devices that need an external power source to operate actively. Materials used to make semiconductor devices are neither excellent insulators nor conductors. They mainly manipulate, amplify, switch, or control the flow of electric
15+ min read
Digital Circuits & Logic
Analog & Circuit Behavior
RectifierA rectifier is an electronic component that converts alternating current (AC) into direct current (DC), ensuring a unidirectional flow of electric charge. As we know, electricity reaches our homes from power grids in the form of AC, but most commonly used electric appliances, such as mobile phones,
10 min read
Diode As a SwitchThe diode is an electronic instrument of great importance, one of them being using the diode as a switch. It is interesting to note that under certain conditions we can use a diode as a switch. In this article, we will study what is an electrical switch and how it differs from a mechanical switch. W
11 min read
Forward BiasForward Bias is a term commonly used in semiconductor electronics, particularly concerning diodes and transistors. A diode is considered to be in forward bias when its p-side is connected to the positive side of a power supply and its n-side to the negative side. In the case of an NPN transistor, th
9 min read
Schmitt TriggerWe use Schmitt Triggers in digital electronics. It is used for rejecting the noise from the input signals by using the hysteresis curve. To provide accurate and more stable results, it uses two threshold voltages i.e., upper threshold voltage (VUT) and lower threshold voltage (VLT). It is mainly use
11 min read
Integrated CircuitsIntegrated circuits (ICs) also called microelectric chips are used to create a device that can perform certain electrical operations such as signal amplification which is called a transistor from the combination of words of the transfer and resistor. Solid-state electronics is the name given to the
8 min read
Solid-State Devices
Solid-State LightingIn this article, we will study solid-state lighting, which is the use of solid-state materials as a source of illumination, usually light-emitting diodes (LEDs). Solid-state lighting, as opposed to conventional incandescent or fluorescent lighting, which depends on thermal processes, produces light
7 min read
Avalanche PhotodiodeAn Avalanche photodiode (APD) is a highly sensitive semiconductor detector that uses the photoelectric effect to convert optical signals into electrical signals. In case of conventional photodiodes, PIN photodiodes operate in a linear mode and the output current is very small and also has limited ga
4 min read
Avalanche PhotodiodeAn Avalanche photodiode (APD) is a highly sensitive semiconductor detector that uses the photoelectric effect to convert optical signals into electrical signals. In case of conventional photodiodes, PIN photodiodes operate in a linear mode and the output current is very small and also has limited ga
4 min read
MOSFET CharacteristicsMOSFETs (Metal-Oxide-Semiconductor Field-Effect Transistors). It is a transistor that controls the flow of electric current in the circuit. The MOSFETs have 3 main terminals: the Gate (G), the Drain (D), and the Source (S). They are popular because they work efficiently. MOSFETs are able to handle h
6 min read
Junction Field Effect Transistor or JFETIn electronics, the junction field effect transistor is a fundamental component, operating on the principle of electric field control. It is a three-terminal device, and it consists of the gate, drain, and source terminals. There are two types of JFETs: N-channel JFET and P-channel JFET. The N chann
11 min read
Communication Systems
Signal Processing