Read an NTC temperature sensor with an Arduino
FunduinoPublished on
Temperatur mit einem Thermistor messen – mit einem Sensor und mit mehreren
You need this
10 kOhm NTC temperature sensor - waterproof, -20 to 105 °C, 1 m cable
1,01 € *Item no. F23107476About the product — 10 kOhm NTC temperature sensor - waterproof, -20 to 105 °C, 1 m cable
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
11,12 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
1,74 € *Item no. FUN-1010558About the product — Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
Resistor Assortment 100 Pieces - 5 Values 100 Ω to 10 kΩ, 0.5 W
1,72 € *Item no. F23107216About the product — Resistor Assortment 100 Pieces - 5 Values 100 Ω to 10 kΩ, 0.5 W
All 4 parts together 15,59 € *Ready to ship immediately · Delivery time: 1-3 business days
* All prices include statutory VAT, plus shipping costs.
What an NTC thermistor is
You need these technical specifications
Build the circuit
Include library
Read temperature
Read the temperature of an NTC sensor
#include <Thermistor.h>
#include <NTC_Thermistor.h>
int Sensor_Pin = A0;
#define ReferenceResistance 10000 // Resistance value of the resistor connected in series with the NTC
#define NominalResistance 10000 // Resistance of the NTC at normal temperature
#define NominalTemperature 25 // Temperature at which the NTC has the specified resistance
#define BValue 3950 // Beta coefficient (found in the NTC's datasheet)
Thermistor* thermistor;
void setup()
{
Serial.begin(9600);
// The sensor is now initialized with the specific data.
thermistor = new NTC_Thermistor(Sensor_Pin, ReferenceResistance, NominalResistance, NominalTemperature, BValue);
}
void loop()
{
const double celsius = thermistor->readCelsius(); // Read the temperature
Serial.print("Temperature: "); // Output to the serial monitor - text only
Serial.print(celsius); // Send the temperature value here
Serial.println(" °C"); // The unit appears after it
delay(1000); // One-second pause: one temperature reading per second
}Use multiple sensors at the same time
Read and average two NTC sensors
#include <Thermistor.h>
#include <NTC_Thermistor.h>
int Sensor_Pin1 = A0;
int Sensor_Pin2 = A1;
#define Referenzwiderstand 10000 // Resistance value of the resistor connected in series with the NTC
#define Nominalwiderstand 10000 // NTC resistance at normal temperature
#define Nominaltemperatur 25 // Temperature at which the NTC has the specified resistance
#define BWert 3950 // Beta coefficient (found in the NTC datasheet)
Thermistor* thermistor1;
Thermistor* thermistor2;
void setup()
{
Serial.begin(9600);
// Now the two sensors are initialized with the specific data.
thermistor1 = new NTC_Thermistor(Sensor_Pin1, Referenzwiderstand, Nominalwiderstand, Nominaltemperatur, BWert);
thermistor2 = new NTC_Thermistor(Sensor_Pin2, Referenzwiderstand, Nominalwiderstand, Nominaltemperatur, BWert);
}
void loop()
{
double celsius1 = 0;
double celsius2 = 0;
// Add up 1000 readings ...
for (int i = 0; i <= 999; i++)
{
celsius1 = celsius1 + thermistor1->readCelsius();
celsius2 = celsius2 + thermistor2->readCelsius();
}
// ... and divide by 1000: this gives the average.
celsius1 = celsius1 / 1000;
celsius2 = celsius2 / 1000;
Serial.print("Temperature1: ");
Serial.print(celsius1);
Serial.print(" °C ");
Serial.print("Temperature2: ");
Serial.print(celsius2);
Serial.println(" °C");
delay(100); // A tenth of a second pause
}Rate the instructions