Skip to content

Rafeul1997/NTCTemp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NTCTemp Library

Universal NTC thermistor temperature library for Arduino-compatible microcontrollers.

Status Version License Arduino ESP32 ESP8266 RP2040 STM32 PIC

Supported Boards

  • Arduino UNO
  • Arduino Nano
  • Arduino Mega
  • Arduino Leonardo
  • ESP32
  • ESP8266
  • Raspberry Pi Pico / RP2040
  • STM32
  • NRF52
  • SAMD Boards
  • ATtiny Boards
  • Other Arduino-compatible microcontrollers

Features

  • Read Celsius temperature
  • Read Fahrenheit temperature
  • Custom Beta coefficient support
  • Custom nominal temperature support
  • Custom ADC resolution support
  • Lightweight and fast
  • Easy to use

Installation

  1. Download the library ZIP
  2. Extract the ZIP file
  3. Move the NTCTemp folder to:
Documents/Arduino/libraries/
  1. Restart Arduino IDE

Basic Example

#include <NTCTemp.h>

// NTCTemp(pin, ntcResistance, seriesResistance)
NTCTemp ntc(34, 10000, 10000);

void setup() {

  Serial.begin(115200);
}

void loop() {

  Serial.print("Celsius: ");
  Serial.println(ntc.getCelsius());

  Serial.print("Fahrenheit: ");
  Serial.println(ntc.getFahrenheit());

  delay(1000);
}

Advanced Example

#include <NTCTemp.h>

// NTCTemp(
//   pin,
//   ntcResistance,
//   seriesResistance,
//   betaValue,
//   nominalTemp,
//   adcMax
// )

NTCTemp ntc(
  34,
  10000,
  10000,
  3950,
  25.0,
  4095
);

void setup() {

  Serial.begin(115200);
}

void loop() {

  Serial.print("Celsius: ");
  Serial.println(ntc.getCelsius());

  Serial.print("Fahrenheit: ");
  Serial.println(ntc.getFahrenheit());

  delay(1000);
}

Constructor

NTCTemp(
  pin,
  ntcResistance,
  seriesResistance,
  betaValue,
  nominalTemp,
  adcMax
);

Circuit Diagram

                 3.3V 
                  |
                  |
               [ NTC ]
                  |
                  +-------> Analog Pin
                  |
             [ Resistor ]
                  |
                  |
                 GND

Wiring

Component Connection
NTC one side VCC
NTC other side Analog pin
Resistor one side Analog pin
Resistor other side GND

Creates a voltage divider circuit.


Default Values

Parameter Default
Beta Coefficient 3950
Nominal Temperature 25°C
ADC Max Value 4095

Library Structure

NTCTemp/
│
├── src/
│   ├── NTCTemp.h
│   └── NTCTemp.cpp
│
├── examples/
│   ├── TempRead/
│   │   └── TempRead.ino
│   │
│   └── CustomTemp/
│       └── CustomTemp.ino
│
├── library.properties
├── README.md
├── LICENSE
└── keywords.txt

License

MIT License


Author

Abdul Rafeul Mallick

GitHub: https://github.com/Rafeul1997

About

Simple Arduino library for reading temperature from NTC thermistors.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages