Anda di halaman 1dari 10

CONTROL DE TEMPERATURA,SENSOR DE HUMEDAD Y SENSOR DE LUZ

ELABORADO POR: LUIS FERNANDO RIVERA RUBIANO MILAN GILDARDO

PRESENTADO A INGENIERO CESAR PERDOMO

LOS LIBERTADORES FUNDACION UNIVERSITARIA 12 DE JUNIO DEL 2013

CONTROL DE TEMPERATURA ,SENSOR DE HUMEDAD Y SENSOR DE LUZ MATERIALES Arduino duemilanove Resistencias 1K, 330Ohmios Cable USB Sensor LM35 Cables conexin Potenciometro LCD 2*16 LDR DHT-11

Sensor 2: Temperature Sensor (LM35DZ)


A precision analog temperature sensor in 3-pin package Connect the Temp pin to Arduino analog input pin The output voltage is 10mV per C When Arduino is using the 5V reference with 10bit ADC it has a 1024 count Temp = (5.0 * analogRead(tempPin) * 100.0) / 1024

Figura 1. Sensor de temperatura

Temperature sensor wiring


Connect +5V and 0V pins Connect Temp pin directly to Arduino analog input pin 0 You may need to add a filter to stabilise the reading when using breadboards

Figura 2

Sensor 3: Light Sensor (LDR - Light Dependent Resistor)


A basic, uncalibrated light dependent resistor Resistance varies from a few hundred ohms in bright light, to several megohms in darkness Use a lookup table or calculations to convert to Lux values Figura 3 LDR

Light sensor wiring


Connect one pin to 0V Connect second pin to Arduino Analog input pin1 Second pin is also connected to one end of10k pullup resistor Other end of pullup resistor is connected to 5V

Figura 4.

Sensor 4: Humidity Sensor (DHT11)


A digital humidity and temperature sensor in 4-pin package Resolution is 1C or 1% RH (so better to use analog LM35 for temp measurements) The output is a stream of 40 bits: 4 bytes of data and 1 byte of checksum No external components are required Simply connect Data pin to Arduino digital input pin 7

Figura 5. Sensor de humedad

PLANO DEL CIRCUITO EN FRITZING

OBJETIVOS Disear e implementar un sistema por medio de sensores ,para ser visualizado en una lcd.

ESPECIFICOS 1. Capturar los datos de cada sensor y visualizarlos 2. Obtener datos del comportamiento de cada elemento 3. Mediante la obtencin de los datos, graficar

JUSTIFICACIN Mediante el diseo e implementacin del circuito, aplicar los conocimientos adquiridos durante el semestre en el rea de control digital reforzando los temas, haciendo uso de herramientas y programas tales como: Matlab, arduino, proteus, etc

Descripcin de Partes:
Arduino UNO: El Arduino uno sirve para poder controlar el ventilador en base a los valores recibidos desde el sensor. Lee desde un puerto analgico el valor del sensor LM35, y en base al valor recibido y convertido a grados centgrados, determina si el ventilador permanece encendido o apagado, esto mediante una seal PWM de salida que se conecta con el transistor para realizar el encendido y apagado del ventilador.

LM35

Utilizado como sensor para determinar la temperatura de un objeto. El sensor arroja un valor entre 0 y 1023 para el arduino(normalmente es un voltaje analgico entre 0 y 3V), que debe convertir esto a una temperatura en grados Celsius, utilizando la frmula.

Esta frmula es as debido a que segn el datasheet del LM35, es posible realizar una medicin ms precisa del LM35, ajustando el voltaje de referencia anlogico a 1.1 (esto es posible hacerlo

con el arduino agregando la lnea analogReference(INTERNAL)). Entonces dividiendo el valor del sensor entre 9.31, nos da una temperatura un poco ms precisa en grados centgrados.

Transistor de Darlington TIP-122

El transistor es usado para poder manipular corrientes de 12V mediante el Arduino, que normalmente solo puede manejar corrientes de 5V por debajo.

Ventilador

El ventilador es un simple ventilador de 12V. Puede ser encendido con menos voltaje(3.3V, 5V) pero el funcionamiento a mxima velocidad es dado con voltajes cercanos a los 12V. Aqu surge el problema que el Arduino no puede manipular directamente voltajes tan altos, al hacerlo se quemara. Por eso se utiliza un transistor de darlington para controlar el encendido y apagado del ventilador con 12V, separados de los 5V que utiliza el Arduino para funcionar.

DESARROLLO DEL PROYECTO 1. Implementacin del sistema sensor

CODIGO PARA PROGRAMAR LOS SENSORES #include <LiquidCrystal.h> #include <dht11.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); int Temp, Light, Humidity, hCheck; boolean Tilt; #define #define #define #define tempPin 0 lightPin 1 tiltPin 6 humidityPin 7

dht11 DHT11; // initialise LCD library and pins void setup() { lcd.begin(16, 2); pinMode(tiltPin, INPUT); } void loop() { Temp = (5.0 * analogRead(tempPin) * 100.0) / 1024; delay(10); Light = toLux(analogRead(lightPin)); hCheck = DHT11.read(humidityPin); if(hCheck != 0) Humidity = 255; //Must be an error else Humidity = DHT11.humidity; Tilt = (digitalRead(tiltPin) == LOW); showData(Temp, Light, Humidity, Tilt); delay(1000);

// Change the ADC reading to Lux. Assumes a 10K pull up resistor to 5V /* Vcc 5 Pullup 10000 Lux Ohms Voltage ADC Scaling 0 1023 1 200000 4.76 975 -0.020937188 10 30000 3.75 768 -0.043428309 80 5000 1.67 341 -0.1640625 120 4000 1.43 293 -0.8203125 150 3000 1.15 236 -0.533203125 250 2000 0.83 171 -1.5234375 300 1800 0.76 156 -3.45703125 800 700 0.33 67 -5.604580966 */ int toLux(int adc) { // return (map(adc, 0, 1023, 900, 0)); simple linear model if (adc > 975)

return 1; else if (adc > 768) return 1 + 0.04 * (adc - 768); else if (adc > 341) return 10 + 0.16 * (adc - 341); else if (adc > 293) return 80 + 0.82 * (adc - 293); else if (adc > 236) return 120 + 0.53 * (adc - 236); else if (adc > 171) return 150 + 1.52 * (adc - 171); else if (adc > 156) return 250 + 3.46 * (adc - 156); else return 300 + 5.6 * (adc - 67);

void showData (int temp, int light, int humidity, boolean tilt) { String s1, s2, s3; String spaces = " "; s1 = String(temp) + char(0xdf) + "C"; s2 = String (light) + "Lux"; s3 = s1 + spaces.substring(0, 16 - s1.length() - s2.length()) + s2; lcd.setCursor(0,0); lcd.print(s3); if(humidity == 255) s1 = "ERROR"; else s1 = String(humidity) + "%"; if (tilt) s2 = "TILT"; else s2 = "FLAT"; s3 = s1 + spaces.substring(0, 16 - s1.length() - s2.length()) + s2; lcd.setCursor(0,1); lcd.print(s3); }

PROGRAMA PARA ACTIVAR EL VENTILADOR POR TEMPERATURA #define #define #define #define #define PRECISION 100 PIN_MOTOR 9 PIN_SENSOR 0 MAX 225 LIMITE 50

int sensorValue; float temp, volts;

float temps[PRECISION]; int c = 0;

float promedio(float array[]){ float suma = 0; int i; for(i = 0; i < PRECISION; i++){ suma += temps[i]; } return(suma/PRECISION); }

void setup(){ analogReference(INTERNAL); pinMode(PIN_MOTOR, OUTPUT); pinMode(PIN_SENSOR, INPUT); Serial.begin(9600); } void loop(){ /*for(c=0; c<PRECISION; c++){ sensorValue = analogRead(PIN_SENSOR); temp = sensorValue / 9.31; temps[c] = temp; }*/ delay(1000); sensorValue = analogRead(PIN_SENSOR); temp = sensorValue/9.31; Serial.println(temp); if(temp > LIMITE){ Serial.println("yes"); //analogWrite(PIN_MOTOR, MAX + (temp - LIMITE)); analogWrite(PIN_MOTOR, 255); } else{ analogWrite(PIN_MOTOR, 0); } } DIAGRAMA

BIBLIOGRAFIA -Instrumentacin electrnica. Sensores (I) / Jos Mara Ferrero -Handbook of modern sensors : physics, designs, and applications / Jacob-Fraden. - 2nd ed. - Woodbury -Sensores y acondicionadores de seal / Ramn Areny. - 2 ed. : Marcombo -The measurement, instrumentation, and sensors handbook / editor in chief-John G. Webster. - [Boca Raton] :

http://electronica.webcindario.com/componentes/lm35.htm http://www.micro4you.com/files/sensor/DHT11.pdf -http://roble.pntic.mec.es/~jsaa0039/cucabot/fotorresistencia-intro.html http://www.iesromerovargas.net/estacion-domotica_arduino.htm http://es.geocities.com/fisicas/ -

ANEXOS

MONTAJE FINAL

Figura 7. Circuito final

Anda mungkin juga menyukai