Ejercicio 7 ....El sensor de temperatura

  Esta haciendo harto frio en Chillan...


Y  bajo mi escritorio tengo un termo ventilador que cuando se enfría, vuelve a encender....y me calienta los pies...maravilloso..
Lo mismo con el hervidor de agua para el café, el aire acondicionado en el verano y un sin fin de inventillos que funcionan en base a sensores de temperatura.

Acá hay un video acerca de como funcionan los sensores de temperatura, bien explicadito y simple.

https://www.youtube.com/watch?v=RqODKxHINj4

y que hicimos en este ejercicio?

"Un sensor de temperatura es exactamente lo que suena 
– un sensor usado para medir la temperatura del 
ambiente. Este particular sensor tiene tres pines – un 
positivo, una tierra y una señal. Este es un sensor de 
temperatura lineal. Un cambio en la temperatura de un 
grado centígrado es igual a un cambio de 10 milivoltios 
en la salida del sensor. El sensor TMP36 tiene un valor 
de 750mV a 25°C (temperatura ambiente). En este 
circuito, aprenderás como integrar el sensor de 
temperatura con tu RedBoard y usar el monitor serial 
del Arduino IDE para mostrar la temperatura"




Acá esta montado o como a mi me quedo



Para ver las lecturas del sensor una vez cargado el código de programación, se debe activar la lupa  en la parte superior de la ventana de programación. 

Asi:






y volviendo al tema de la calefacción, se me ocurrió acercar el calefactor al sensor de temperatura y efectivamente...funciona!!! 

Saludos

Aca esta el codigo de programacion:



******************************************************************/


// We'll use analog input 0 to measure the temperature sensor's
// signal pin.

const int temperaturePin = A0;


void setup()
{

Serial.begin(9600); //Initialize serial port & set baud rate to 9600 bits per second (bps)
}


void loop()
{


float voltage, degreesC, degreesF; //Declare 3 floating point variables

voltage = getVoltage(temperaturePin); //Measure the voltage at the analog pin

degreesC = (voltage - 0.5) * 100.0; // Convert the voltage to degrees Celsius

degreesF = degreesC * (9.0 / 5.0) + 32.0; //Convert degrees Celsius to Fahrenheit
//Now print to the Serial monitor. Remember the baud must be 9600 on your monitor!
// These statements will print lines of data like this:
// "voltage: 0.73 deg C: 22.75 deg F: 72.96"
Serial.print("voltage: ");
Serial.print(voltage);
Serial.print("  deg C: ");
Serial.print(degreesC);
Serial.print("  deg F: ");
Serial.println(degreesF);

delay(1000); // repeat once per second (change as you wish!)
}


float getVoltage(int pin) //Function to read and return
//floating-point value (true voltage)
//on analog pin 
{

return (analogRead(pin) * 0.004882814);
// This equation converts the 0 to 1023 value that analogRead()
// returns, into a 0.0 to 5.0 value that is the true voltage
// being read at that pin.
}

// Other things to try with this code:

//   Turn on an LED if the temperature is above or below a value.

//   Read that threshold value from a potentiometer - now you've
//   created a thermostat!



Comentarios