+ All Categories
Home > Documents > Modulos remotos de medicion de temperatura y humedad realtiva

Modulos remotos de medicion de temperatura y humedad realtiva

Date post: 06-Aug-2015
Category:
Upload: carlos-eduardo-martinez-hernandez
View: 13 times
Download: 1 times
Share this document with a friend
Description:
Sistemas Embebidos
Popular Tags:
10
1 Subject: DIGITAL SYSTEMS 2 Project Fire Alarm Detector SMS Project number Length (Hours) 4 OBJECTIVE (Learning result) Make a Fire Alarm Detector SMS, the device have send a SMS (text message) to any number, when a fire is detected. THEORETICAL FRAMEWORK Xbee. XBee modems are one of the easiest ways to create a wireless point-to-point or mesh network. They have error correction, are configured with AT commands, come in multiple flavors and can create a wireless serial link out of the box! I wanted to make a wireless Arduino project but all the adapter boards on the market made me unhappy. So I designed what I think is an excellent low-cost adapter board. Yes it can act as a breakout board, but it also has.... Onboard 3.3V regulator to cleanly power your XBee, up to 250mA Level shifting circuitry means that its trivial to connect it to 5V circuitry such as an Arduino without risk of damage Two LEDs, one for activity (RSSI), the other for power (Associate) 10-pin 2mm sockets included to protect the modem and allow easy swapping, upgrading or recycling All the commonly used pins are brought out along the edge, making it easy to breadboard or wire up For use with any XBee/Pro pin-compatible module (check your module datasheet to verify power needs) Works with XBee series 1 and 2! Specifically created for use with an FTDI cable to connect to a computer via USB. This means that you can use, configure or upgrade the adapter painlessly simply by plugging in a cable: Microcontroller. A microcontroller (sometimes abbreviated μC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program
Transcript
Page 1: Modulos remotos de medicion de temperatura y humedad realtiva

1

Subject: DIGITAL SYSTEMS 2

Project Fire Alarm Detector SMS

Project number Length (Hours) 4

OBJECTIVE (Learning result)

Make a Fire Alarm Detector SMS, the device have send a SMS (text message) to any number, when a fire is detected.

THEORETICAL FRAMEWORK Xbee.

XBee modems are one of the easiest ways to create a wireless point-to-point or mesh network. They have

error correction, are configured with AT commands, come in multiple flavors and can create a wireless

serial link out of the box! I wanted to make a wireless Arduino project but all the adapter boards on the

market made me unhappy. So I designed what I think is an excellent low-cost adapter board.

Yes it can act as a breakout board, but it also has....

Onboard 3.3V regulator to cleanly power your XBee, up to 250mA

Level shifting circuitry means that its trivial to connect it to 5V circuitry such as an Arduino without risk of damage

Two LEDs, one for activity (RSSI), the other for power (Associate)

10-pin 2mm sockets included to protect the modem and allow easy swapping, upgrading or recycling

All the commonly used pins are brought out along the edge, making it easy to breadboard or wire up

For use with any XBee/Pro pin-compatible module (check your module datasheet to verify power needs) Works with XBee series 1 and 2!

Specifically created for use with an FTDI cable to connect to a computer via USB. This means that you can use, configure or upgrade the adapter painlessly simply by plugging in a cable:

Microcontroller.

A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated

circuit containing a processor core, memory, and programmable input/output peripherals. Program

Page 2: Modulos remotos de medicion de temperatura y humedad realtiva

2

memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small

amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the

microprocessors used in personal computers or other general purpose applications.

Microcontrollers are used in automatically controlled products and devices, such as automobile engine

control systems, implantable medical devices, remote controls, office machines, appliances, power tools,

toys and other embedded systems. By reducing the size and cost compared to a design that uses a separate

microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally

control even more devices and processes. Mixed signal microcontrollers are common, integrating analog

components needed to control non-digital electronic systems.

GSM/GPRS.

GSM (Global System for Mobile Communications, originally Groupe Spécial Mobile), is a standard set

developed by the European Telecommunications Standards Institute (ETSI) to describe technologies for

second generation (or "2G") digital cellular networks. Developed as a replacement for first generation

analogue cellular networks, the GSM standard originally described a digital, circuit switched network

optimized for full duplex voice telephony. The standard was expanded over time to include first circuit

switched data transport, then packet data transport via GPRS. Packet data transmission speeds were later

increased via EDGE. The GSM standard is succeeded by the third generation (or "3G") UMTS standard

developed by the 3GPP. GSM networks will evolve further as they begin to incorporate fourth generation

(or "4G") LTE Advanced standards. "GSM" is a trademark owned by the GSM Association.

The GSM Association estimates that technologies defined in the GSM standard serve 80% of the global

mobile market, encompassing more than 1.5 billion people across more than 212 countries and territories,

making GSM the most ubiquitous of the many standards for cellular networks.

General packet radio service (GPRS) is a packet oriented mobile data service on the 2G and 3G cellular

communication systems global system for mobile communications (GSM). The service is available to

users in over 200 countries. GPRS was originally standardized by European Telecommunications

Standards Institute (ETSI) in response to the earlier CDPD and i-mode packet-switched cellular

technologies. It is now maintained by the 3rd Generation Partnership Project (3GPP).[1][2]

GPRS usage charging is based on volume of data, either as part of a bundle or on a pay-as-you-use basis.

An example of a bundle is up to 5 GB per month for a fixed fee. Usage above the bundle cap is either

charged for per megabyte or disallowed. The pay as you use charging is typically per megabyte of traffic.

This contrasts with circuit switching data, which is typically billed per minute of connection time,

regardless of whether or not the user transfers data during that period.

GPRS is a best-effort service, implying variable throughput and latency that depend on the number of

other users sharing the service concurrently, as opposed to circuit switching, where a certain quality of

service (QoS) is guaranteed during the connection. In 2G systems, GPRS provides data rates of 56-

114 kbit/second.[3]

2G cellular technology combined with GPRS is sometimes described as 2.5G, that is, a

technology between the second (2G) and third (3G) generations of mobile telephony.[4]

It provides

moderate-speed data transfer, by using unused time division multiple access (TDMA) channels in, for

example, the GSM system. GPRS is integrated into GSM Release 97 and newer release.

Page 3: Modulos remotos de medicion de temperatura y humedad realtiva

3

MATERIALS AND EQUIPEMENT

2 Xbee S1 2 Microcontroller PIC18F4550 1 CO sensor 1 LCD screen 2 humpty and temperarute sensor

METHODOLOGY

The CO sensor must detect de CO to activate the GSM module to send de SMS We have two modules, the first module we called “sensors” because it only read the information in the ADC channels of the microcontroller, and after that send this information through Xbee to the other module, who controls the information and program the sim900 to send the SMS. We show the code of the project of the sensors module. #include <18F4550.H> #include <STRING.H> #include <STDLIB.H> #fuses XT,NOWDT,NOPROTECT #use delay(clock=4000000) #use rs232(rcv=PIN_C7,xmit=PIN_C6,baud=9600,bits=8,parity=N,stream=xbee) #use rs232(rcv=PIN_B0,xmit=PIN_B1,baud=9600,bits=8,parity=N,stream=sim900) #include <lcd.c> #define buf_length 32 int buf[buf_length],str[buf_length],str_flag=0,i=0,ban=0; int8 j=0; #int_rda //Interruption void rcv_data() // Enters the break every time you write a character { buf[i]=fgetc(xbee); if(buf[i]==0x0d) { str_flag=1; buf[i+1]=0; strcopy(str,buf); i=0; } else i++; } void get_string() { regresa: if(str_flag==0) { goto regresa; }

Page 4: Modulos remotos de medicion de temperatura y humedad realtiva

4

str_flag=0; } void temperatura(){ float tem; char c='x'; fprintf(xbee,"t\n\r"); //delay_ms(10); enable_interrupts(INT_RDA); get_string(); disable_interrupts(INT_RDA); tem=atof(buf); c=223; lcd_gotoxy(1,1); printf(lcd_putc,"Tem = %.1f %cC",tem,c); } void humedad(){ float HR; char c='x'; fprintf(xbee,"h\n\r"); //delay_ms(10); enable_interrupts(INT_RDA); get_string(); disable_interrupts(INT_RDA); HR=atof(buf); c='%'; lcd_gotoxy(1,2); printf(lcd_putc,"Hum = %.1f %c",HR,c); } void monoxido(){ int1 CO=0; char e=0x1a; float mon; fprintf(xbee,"c\n\r"); //delay_ms(10); enable_interrupts(INT_RDA); get_string(); disable_interrupts(INT_RDA); mon=atof(buf); CO=(int)mon; lcd_gotoxy(1,1); if(CO==1){ printf(lcd_putc,"Alerta de CO!!!"); if(ban==0){ fprintf(sim900,"A"); delay_ms(200); fprintf(sim900,"\r"); delay_ms(3000); for(j=0;j<5;j++){ fprintf(sim900,"AT"); delay_ms(200); fprintf(sim900,"\r"); delay_ms(200); }

Page 5: Modulos remotos de medicion de temperatura y humedad realtiva

5

output_high(PIN_C0); fprintf(sim900,"AT+CMGF=1"); delay_ms(200); fprintf(sim900,"\r"); delay_ms(200); fprintf(sim900,"AT+CMGS=\"4423608357\"");//4421420052 toledano.4421445820 hetur.4423329666 emo.4422711906 mama 4427045599 delay_ms(200); fprintf(sim900,"\r"); delay_ms(200); fprintf(sim900,"Alerta de CO detectado... Peligro de Incendio!!!"); // mensaje guardado en una variable delay_ms(200); fprintf(sim900,"\r"); delay_ms(200); fprintf(sim900,"%c",e); delay_ms(200); fprintf(sim900,"\r"); delay_ms(3000); lcd_putc('\f'); lcd_gotoxy(1,1); printf(lcd_putc,"Mensaje"); lcd_gotoxy(1,2); printf(lcd_putc,"enviado !!!"); delay_ms(1000); ban=1; output_low(PIN_C0); } } else{ printf(lcd_putc,"Nivel Estable"); ban=0; } } void main(){ for(j=0;j<120;j++){ fprintf(xbee,"r\n\r"); delay_ms(500); } enable_interrupts(GLOBAL); lcd_init(); while(true){ temperatura(); humedad(); delay_ms(1000); lcd_putc('\f'); monoxido(); delay_ms(1000); lcd_putc('\f'); } Also we show the code senors #include <18F4550.H> #device ADC=8

Page 6: Modulos remotos de medicion de temperatura y humedad realtiva

6

#include <STRING.H> #include <STDLIB.H> #fuses XT,NOWDT,NOPROTECT #use delay(clock=4000000) #use rs232(rcv=PIN_C7,xmit=PIN_C6,baud=9600,parity=N,bits=8) #define buf_length 32 int buf[buf_length],str[buf_length],str_flag=0,i=0; #int_rda //Interruption void rcv_data() // Enters the break every time you write a character { buf[i]=getchar(); if(buf[i]==0x0d) { str_flag=1; buf[i+1]=0; strcopy(str,buf); i=0; } else i++; } void get_string() { regresa: if(str_flag==0) { goto regresa; } str_flag=0; } void main(){ int16 a0=0,a1=0,a2=0; float T=0,HR=0; char T0[]={'x','x','x','x','x'},HR0[]={'x','x','x','x','x'},CO0[]={'x','x','x','x','x'}; enable_interrupts(GLOBAL); setup_adc(ADC_CLOCK_INTERNAL); setup_adc_ports(AN0_to_AN2); while(true){ enable_interrupts(INT_RDA); get_string(); disable_interrupts(INT_RDA); output_high(PIN_B7); if(str[0]=='t'&&str[2]==0x0d){ set_adc_channel(0); delay_us(10); a0=read_adc(); T=(float)(a0*24.41)/44.; sprintf(T0,"%.1f",T); printf("%s\n\r",T0); //delay_ms(10); }else{ if(str[0]=='h'&&str[2]==0x0d){

Page 7: Modulos remotos de medicion de temperatura y humedad realtiva

7

set_adc_channel(1); delay_us(10); a1=read_adc(); HR=(float)(a1*20.)/34.; sprintf(HR0,"%.1f",HR); printf("%s\n\r",HR0); //delay_ms(10); }else{ if(str[0]=='c'&&str[2]==0x0d){ set_adc_channel(2); delay_us(10); a2=read_adc(); if(a2>56){ sprintf(CO0,"1"); printf("%s\n\r",CO0); //delay_ms(10); }else{ sprintf(CO0,"0"); printf("%s\n\r",CO0); //delay_ms(10); } } } } } } PHOTOS

Page 8: Modulos remotos de medicion de temperatura y humedad realtiva

8

Page 9: Modulos remotos de medicion de temperatura y humedad realtiva

9

Page 10: Modulos remotos de medicion de temperatura y humedad realtiva

10

Bibliography

en.wikipedia.org/wiki/GSM en.wikipedia.org/wiki/General_Packet_Radio_Service


Recommended