An Arduino temperature sensor is a device used to measure temperature with an Arduino microcontroller. These sensors come in various types, including digital and analog, and they utilize different technologies like thermistors, thermocouples.
The Arduino microcontroller reads the temperature data from the sensor and can then process or use this information for various applications such as environmental monitoring, HVAC systems, weather stations, and more.

An Arduino servo motor is a type of motor commonly used in robotics, automation, and various other projects where precise control of angular position is required. Unlike regular DC motors, which typically rotate continuously when power is applied, servo motors can rotate to a specific angle based on the input signal they receive.
The motor inside a servo is often a small DC motor with gears to increase torque and reduce speed. Servo motors often have a gear train mechanism that helps convert the rotation of the motor into a more precise and controlled movement. Servo motors have control circuitry that interprets the input signal (usually a pulse-width modulation, or PWM, signal) and drives the motor to the desired position.

Building
What do you need
1 x Micro Servo
1 x Temperature Sensor [TMP36]
1 x Red LED
1 x 220 Ω Resistor
Arduino code
#include <Servo.h>
#define TEMPERATURE_PIN A0 // Пин, к которому подключен термодатчик
#define SERVO_PIN 3 // Пин, к которому подключен серводвигатель
#define LED_PIN 10 // Пин, к которому подключен светодиод
Servo servo;
void setup() {
Serial.begin(9600); // Начать коммуникацию с последовательным портом
servo.attach(SERVO_PIN); // Подключить серводвигатель
pinMode(LED_PIN, OUTPUT); // Установить пин светодиода в режим вывода
}
void loop() {
int temperatureValue = analogRead(TEMPERATURE_PIN); // Считать значение с термодатчика
const int temperaturePin = 0;
float voltage, degreesC, degreesF;
// kasutame analogRead(), mis tagastab sisendi väärtused vahemikul 0 ... 1023.
// koostasime getVoltage() funktsioon, mis tagastab pingeväärtus 0 ... 5,
voltage = getVoltage(temperaturePin);
degreesC = (voltage - 0.5) * 100.0;
// degreesC = voltage * 100.0;
degreesF = degreesC * (9.0/5.0) + 32.0;
Serial.print("voltage: ");
Serial.print(voltage);
Serial.print(" deg C: ");
Serial.print(degreesC);
Serial.print(" deg F: ");
Serial.println(degreesF);
// Проверка температуры и управление серводвигателем
if (degreesC <= 22) {
servo.write(0); // Положение серводвигателя при 22 градусах
digitalWrite(LED_PIN, HIGH); // Включить светодиод при низкой освещенности
} else if (degreesC >= 25) {
servo.write(180); // Положение серводвигателя при 25 градусах
digitalWrite(LED_PIN, LOW); // Включить светодиод при низкой освещенности
} else {
// Промежуточное положение серводвигателя для плавного движения
int angle = map(degreesC, 22, 35, 0, 180);
servo.write(angle);
}
delay(1000); // Пауза для стабилизации
}
float getVoltage(int pin)
{
return (analogRead(pin) * 0.004882814);
// teisendame pinge vahemikust 0,0 ... 5,0 V, vahemikku 0 до 1023.
}
