Você está na página 1de 23

+

SISTEMA DOMOTICO
APLICADO A UNA
CASA
INTRODUCCION
La domótica o gestión automatizada de aparatos e instalaciones en
habitaciones, viviendas y edificios aumenta cada día. La imagen de la
casa del futuro dejó de ser parte de la ciencia ficción, para ofrecer
todo un conjunto de sistemas que son capaces de automatizar una
vivienda y que buscan brindar mayores comodidades y alivianar las
tareas propias del funcionamiento de la misma a las personas que la
habitan. En resumen, es la integración de la tecnología en
el diseño inteligente para un mejor ahorro energético, confort,
protección patrimonial y comunicaciones, beneficiando la economía
personal y el medio ambiente.
El sector turístico en desarrollo en Cuba no escapa a
este proceso donde el ahorro energético constituye una premisa
importante para la eficiencia económica junto al confort necesario que
exigen sus instalaciones. Es por ello la necesidad del diseño de
este sistema de control inteligente a nivel de habitación, aplicando los
conceptos fundamentales de la domótica y utilizando las
bondades costo/beneficio que ofrecen los microcontroladores PIC.
METODOLOGÍA
El proyecto se realizó para una habitación genérica que presenta la
siguiente estructura:

 Un Calentador de Agua.
 Sistema de Iluminación.
 Una Puerta de Entrada.
 Un baño.
DISEÑO
Hardware

Como hemos comentado,


un servo (ver figura
adjunta) es un simple
motor DC con su propia
electrónica de control.
Normalmente el
parámetro controlado es
la posición: una orden nuestra hace que el
servo vaya hasta una cierta posición y
permanezca en ella.

Aunque menos comunes, podemos


encontrarnos servos cuyo parámetro
controlado es la velocidad. En este caso,
nuestras ordenes causan que el servo gire
uniformemente a la velocidad indicada.

En esta entrada nos centraremos en los


servos de posición. Típicamente constan de
un motor DC normal con una gran reductora
entre el eje del motor y el eje de salida. A
este eje de salida está conectado algún tipo
de sensor (normalmente un potenciómetro) a
través de cuya medida el servo conoce que
ha llegado a la posición deseada y puede
detener el motor.

La mayoría de los servos están limitados a


moverse dentro de una fracción de vuelta,
por lo que en vez de posiciones hablaremos
del ángulo del servo. Un parámetro
importante de un servo es el rango máximo
que puede girar ("throw" en ingles). Así
tendremos servos de media vuelta (180º),
una vuelta completa (360º) o incluso un
cuarto (90º) de vuelta.

Los servos de media vuelta, con un rango


máximo de 180º, son muy comunes y en ellos
basaré la explicación de los conceptos
básicos.
SENSOR DE TEMPERATURA

PROGRAMACION

int kp4;

char keypadPort at PORTD;

char txt[8];

// LCD module connections

sbit LCD_RS at RB2_bit;

sbit LCD_EN at RB3_bit;

sbit LCD_D4 at RB4_bit;

sbit LCD_D5 at RB5_bit;

sbit LCD_D6 at RB6_bit;

sbit LCD_D7 at RB7_bit;

sbit LCD_RS_Direction at TRISB2_bit;

sbit LCD_EN_Direction at TRISB3_bit;

sbit LCD_D4_Direction at TRISB4_bit;


sbit LCD_D5_Direction at TRISB5_bit;

sbit LCD_D6_Direction at TRISB6_bit;

sbit LCD_D7_Direction at TRISB7_bit;

// End LCD module connections

keypad()

{kp4 = 0; // Reset

do

kp4 = Keypad_Key_Click();

while (!kp4);

switch (kp4) {

case 1: kp4 = 55; break; // 7

case 2: kp4 = 56; break; // 8

case 3: kp4 = 57; break; // 9

case 5: kp4 = 52; break; // 4

case 6: kp4 = 53; break; // 5

case 7: kp4 = 54; break; // 6

case 9: kp4 = 49; break; // 1

case 10: kp4 = 50; break; // 2

case 11: kp4 = 51; break; // 3

case 14: kp4 = 48; break; // 0

void main(){
int a,b,c,d,e=1,i,m,n;

trisC=0;

portC=0;

Keypad_Init();

lcd_Init();

Lcd_Cmd(_LCD_CURSOR_OFF);

UART1_Init(9600); //

Lcd_Out(1, 1, "Password:");

i=0;

m=0;

n=0;

while (i!=3) {

i++;

while (m!=4)

m++;

keypad() ;

if (n==0)

kp4= kp4-48;

a=kp4;

intToStr(kp4, txt);Lcd_Out(2, 1, txt);

if(n==1)
{

kp4= kp4-48;

b=kp4;

intToStr(b, txt);

Lcd_Out(2, 1, txt);

if(n==2)

kp4= kp4-48;

c=kp4;

intToStr(c, txt);

Lcd_Out(2, 1, txt);

if(n==3)

{kp4= kp4-48;

d=kp4;

intToStr(d, txt);

Lcd_Out(2, 1, txt);

n++ ;

if (a==1)

{
if (b==2)

if (c==3)

if (d==4)

e=0;

if (e!=0)

Lcd_Out(2, 1, "Wrong");

delay_ms(400);

Lcd_Cmd(_LCD_CLEAR);

Lcd_Out(1, 1, "Password:");

m=0;

n=0;

if (e == 0)

portc=0b00000101;

delay_ms(200);
portc=0b00000000;

Lcd_Cmd(_LCD_CLEAR);

Lcd_Out(1, 1, "bienvenida");

delay_ms(6000);

Lcd_Out(2, 1, "Enter");

delay_ms(8000);

portc=0b00000110;

delay_ms(200);

portc=0b00000000;

Lcd_Cmd(_LCD_CLEAR);

Lcd_Out(1, 1, "cerrar");

delay_ms(14000);

Lcd_Cmd(_LCD_CLEAR);

Lcd_Out(1, 1, "Password:");

i=0;

m=0;

n=0;

e=1;

}}

Lcd_Cmd(_LCD_CLEAR);

Lcd_Out(1, 1, "autorizado");

Lcd_Out(2, 1, "alerta");

Delay_ms(1000);

UART1_Write_Text("AT+CMGF=1");
Delay_ms(1000);

UART1_Write(0x0D); //

UART1_Write_Text("AT+CMGS=");

Delay_ms(1000);

UART1_Write(0x22); //”

Delay_ms(2000);

UART1_Write_Text("984241575"); //

UART1_Write(0x22); //”

UART1_Write(0x0D); //

Delay_ms(2000);

UART1_Write(0x22);

UART1_Write_Text("Alert");

UART1_Write(0x22); //”

Delay_ms(2000);

UART1_Write(26); //Ctr +Z

Delay_ms(2000);

UART1_Write(0x0D); //

Delay_ms(2000);

Lcd_Out(2, 1, "exitoso");

}
SENSOR DE TEMPERATURA

char keypadPort at PORTC;

sbit LCD_RS at RB4_bit;

sbit LCD_EN at RB5_bit;

sbit LCD_D4 at RB0_bit;

sbit LCD_D5 at RB1_bit;

sbit LCD_D6 at RB2_bit;

sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;


sbit LCD_EN_Direction at TRISB5_bit;

sbit LCD_D4_Direction at TRISB0_bit;

sbit LCD_D5_Direction at TRISB1_bit;

sbit LCD_D6_Direction at TRISB2_bit;

sbit LCD_D7_Direction at TRISB3_bit;

#define HEATER PORTD.RC0

#define FAN PORTD.RC1

#define ENTER 15

#define CLEAR 13

#define ON 1

#define OFF 0

void main () {

unsigned short kp,Txt[14];

unsigned short Temp_Ref ; // Reference Temperature

unsigned char inTemp;

unsigned int temp;

float mV, ActualTemp;

Keypad_Init(); // Initialize Keypad

// Configure PORTD as digital I/O

Delay_ms(250);

OPTION_REG =0X06;

INTCON.GIE=1;

TRISA0_bit = 1; //Configure AN0 (RA0) as input


TRISC = 0; //PORTC are outputs (LCD)

TRISD0_bit=0; //RD0 is output (Heater)

TRISD1_bit=0; //RD1 is output (Fan)

Lcd_Init(); // Initialize LCD

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

Lcd_Out(1, 4, "CONTROL ");

Lcd_Out(2, 1, "DE TEMPERATURA");

delay_ms(1000); //2s delay

HEATER = OFF;

FAN = OFF;

//ON startup, read the Referance Temperature from the Keypad

START:

Lcd_Cmd(_LCD_CLEAR); // Clear display

Temp_Ref=0;

Lcd_Out(1, 1, "QUEREMOS: ");

temp = ADC_Read(0); //Read temperature from AN0

mV = temp * 5000.0/1024.0; //Convert to mV

ActualTemp = mV/10.0 ; // Convert to degrees Celcius

intToStr( Temp_Ref,Txt); //Convert to String

inTemp=Ltrim(Txt);

//Lcd_Out(1, 1, "Temp Ref: ");

Lcd_Out(1, 11, inTemp); //Display Ref Temp

Lcd_Out(2, 1, "Temp= ");


FloatToStr(ActualTemp,Txt); //Convert to string

Txt[4] = 0;

Lcd_Out(2,7,Txt);

Lcd_Out(1,9," ");

while(1)

do

kp = Keypad_Key_Click(); // Store key code in kp variable

while (!kp);

if ( kp == ENTER )break;

if (kp > 3 && kp < 8) kp = kp-1;

if (kp > 8 && kp < 12) kp = kp-2;

if (kp ==14)kp = 0;

if ( kp == CLEAR )goto START;

Lcd_Chr_Cp(kp + '0');

Temp_Ref =(10*Temp_Ref) + kp;

kp =0;

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Out(1, 1, "QUEREMOS: ");

Lcd_Chr(1,15,223); // Different LCD displays have different

// char code for degree

Lcd_Chr(1,16,'C'); // Display "C" for Celsius


//Program loop

while(1) {

//Display Referance Temperature and Actual Temperature

temp = ADC_Read(0); //Read temperature from AN0

mV = temp * 5000.0/1024.0; //Convert to mV

ActualTemp = mV/10.0 ; // Convert to degrees Celcius

intToStr( Temp_Ref,Txt); //Convert to String

inTemp=Ltrim(Txt);

//Lcd_Out(1, 1, "Temp Ref: ");

Lcd_Out(1, 11, inTemp); //Display Ref Temp

Lcd_Out(2, 1, "Temp= ");

FloatToStr(ActualTemp,Txt); //Convert to string

Txt[4] = 0;

Lcd_Out(2,7,Txt);

Lcd_Out(2,12," ");

//Compare ref temp with actual emp

if (Temp_Ref > ActualTemp) //If Temp Ref is less than actual Temp, Switch ON Heater

HEATER = ON,

FAN = OFF;

if (Temp_Ref < ActualTemp) //If Temp Ref is greater than actual Temp, Switch ON Fan

HEATER = OFF,

FAN = ON;

}
if (Temp_Ref == ActualTemp) //If Temp Ref is equal to actual Temp, Switch OFF Fan and
Heater

HEATER = OFF,

FAN = OFF;

Delay_ms(1000); //Wait 10 s then repeat

}
CONTROL DE BOMBA Y LUCES POR VIA
BLUETOOH
SISTEMA AUTOMATIZADO
DE UNA
CASA DOMOTICA

INTEGRANTES:
Catunta Conza Yaqui
Ingenieria Mecatronica
Robles Chinchilla Michelle
Ing. Vivar Recarte Silva Alva Ali
VI ciclo Fleitas Sotomayor Claudia
Ibañez Barnechea Jair
Huaman Tito Daniel

2016

Você também pode gostar