Menu mobile
LECCIÓN 10: TERMISTOR
Introducción
Un termistor es un tipo de resistor variable significativamente con la temperatura.
El término termistor proviene de Thermally Sensitive Resistor.
Componentes
{Product:2000}{Product:485}{Product:739}{Product:256}{Product:1436}{Product:536}{Product:1794}{Product:605}
Principio
La resistencia del termistor varía significativamente con la temperatura ambiente. Puede detectar los cambios de temperatura circundantes en tiempo real.
Envíe los datos de temperatura al puerto de E/S analógico de la placa Uno.
A continuación, sólo tenemos que convertir la salida del sensor a temperatura Celsius mediante una programación simple y mostrarla en la LCD1602.
Procedimiento
Paso 1: Conecta el circuito como se muestra en el diagrama siguiente:
El diagrama esquemático correspondiente es el siguiente:
Paso 2: Programa (consulta el código de ejemplo en el CD o sitio web oficial)
//
//2015.5.7
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(4, 5, 10, 11, 12, 13);
#define analogPin A0 //the thermistor attach to
#define beta 4090 //the beta of the thermistor
#define resistance 10 //the value of the pull-up resistor
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.clear();
}
void loop()
//read thermistor value
long a =analogRead(analogPin);
//the calculating formula of temperature
float tempC = beta /(log((1025.0 * 10 / a - 10) / 10) + beta / 298.0) - 273.0;
float tempF = 1.8*tempC + 32.0;
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("Temp: ");// Print a message of "Temp: "to the LCD.
// Print a centigrade temperature to the LCD.
lcd.print(tempC);
// Print the unit of the centigrade temperature to the LCD.
lcd.print(" C");
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1); // set the cursor to column 0, line 1
lcd.print("Fahr: ");
lcd.print(tempF);// Print a Fahrenheit temperature to the LCD.
lcd.print(" F"); // Print the unit of the Fahrenheit temperature to the LCD.
delay(200); //wait for 100 milliseconds
Paso 3: Compila el programa
Paso 4: Graba el programa en la placa Uno
Ahora, puedes ver la temperatura actual mostrada en la LCD1602 tanto en grados Celsius y Fahrenheit.