# Project - Temperature Measurement
To use an NTC thermistor with the Lonely Binary UNO R3, you need to connect it in a **voltage divider** configuration. Here’s how you can do it:
### Components Needed:
- **NTC thermistor** (e.g., 10kΩ thermistor)
- **Fixed resistor** (10kΩ, to form a voltage divider with the thermistor)
- **Lonely Binary UNO R3**
### Circuit Connections:
1. **NTC Thermistor**:
   - One leg of the thermistor connects to the 5V** (VCC) pin of the Lonely Binary UNO R3.
   - The other leg of the thermistor connects to the **ADC pin** (e.g., A0) on the Lonely Binary UNO R3.
2. **Resistor**:
   - The other leg of the fixed resistor connects to **GND** (ground).
   - The other side of the fixed resistor connects to the same point as the thermistor that goes to the **ADC pin**.
This forms a simple **voltage divider** circuit, where the voltage at the junction of the thermistor and resistor can be read by the ADC pin.
### Circuit Diagram:
```mermaid
flowchart LR
5V --> NTC --> A0 --> Resistor --> GND
```
In this setup, as the temperature changes, the resistance of the NTC thermistor will change, which in turn changes the voltage at the ADC pin.
## 4. Arduino Code to Read NTC Sensor
Now that we have the hardware setup, let's write the Arduino code to read the temperature from the NTC thermistor.
### Arduino Code:
```cpp
const int thermistorPin = A0;  // ADC Pin connected to the NTC Thermistor
const float referenceVoltage = 5;  // Reference voltage (5V)
const int seriesResistor = 10000;  // Series resistor value (10kΩ)
const float beta = 3950;  // Beta value for the thermistor (depends on the thermistor used)
const float tempNominal = 25.0;  // Nominal temperature at 25°C
const int resistanceNominal = 10000;  // Nominal resistance at 25°C (10kΩ)
void setup() {
  Serial.begin(9600);
  pinMode(thermistorPin, INPUT);
}
void loop() {
  int adcValue = analogRead(thermistorPin);  // Read the ADC value (0-4095)
  float voltage = adcValue * (referenceVoltage / 4095.0);  // Convert ADC value to voltage
  float resistance = (seriesResistor * (referenceVoltage / voltage - 1));  // Calculate the resistance of the thermistor
  // Calculate temperature using the Steinhart-Hart equation or an approximation
  float temperature = 1.0 / (log(resistance / resistanceNominal) / beta + 1.0 / (tempNominal + 273.15)) - 273.15;
  // Print the temperature in Celsius
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" C");
  delay(1000);  // Wait for a second before taking another reading
}
```
                                
                            Project - Temperature Measurement
RELATED ARTICLES
Photoresistor Sensor
NTC Temperature Sensor
Project - IR Sender
Project - IR Receiver
Remote infrared Sensor
Project - Motion Detection Alarm
PIR Motion Sensor
- Choosing a selection results in a full page refresh.


 
    
    
    
