REMOTE CONTROL AND MONITORING SYSTEM VIA SMS AND INTERNET

35 434 0
REMOTE CONTROL AND MONITORING SYSTEM VIA SMS AND INTERNET

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

REMOTE CONTROL AND MONITORING SYSTEM VIA SMS AND INTERNET

HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY FACULTY OF ELECTICAL – ELECTRONICS ENGINEERING DEPARTMENT OF TELECOMMUNICATION PFIEV PROGRAM -o0o - GRADUATION THESIS REMOTE CONTROL AND MONITORING SYSTEM VIA SMS AND INTERNET Instructor: PhD Hoang Dinh Chien Student: Le Phuc Hoang Student: Phan Tuan Duong HCM, July 2009 Abstract This thesis consists of five parts In the first part, we present block diagram of control circuits and models connection to connect these circuits with computer at the processing center through infrastructure mobile network or internet network Programming algorithms for the microcontrollers in these circuits will be presented in Part II The most important part, communicating with the phone (PC vs Phone, Microcontroller vs Phone), to access reality through infrastructure telecommunications network is presented in part III Part IV will present more details about connection in the system as in UART connection, RF connection, internet connection (using Yahoo server or TCP socket) Chapter five will present results and discussion I Circuit block and model connection 1.1 Main circuit block diagram [10] Extension circuit [6] Switch block [7] RS232 [2] LCD Display [11] Phone [1]Microcontroller PIC16F877A [5] Relay block [3] Receive RF block [4]Sensors block (thermal, pH ) [9] PC [8] Power Main circuit - The most important block in this circuit is [1] Microcontroller PIC16F877A (PIC), coordinating activities of the remaining (control display ASCII characters on the LCD display [1], the control switch (relay) [5], control serial communication via RS232[7], process signals from the sensor block [4], and encode and decode for the RF link [3] LCD display PC/ Main circuit RS23 Microcontroller PIC16F877 [3] Receive RF block Power Phone Relay block (*) Sensor block (thermal, pH…) Extension circuit This block is similarly to the block of the main circuit, but there is no switch block circuit We can use this circuit independently with the main circuit, and the structure of the sensor block (*) may be changed to connect with different sensors 1.2 The most simple connection model Home Mobile Center PC Cell phone network Remote Mobile Sensor Center PC connects with a cell phone (Home Mobile) Home Mobile will send message containing commands (SMS) to Remote Mobile Remote Mobile is a cell phone connected with the board having sensors This board collects parameters from sensor, then transfers to Remote Mobile and Remote Mobile sends SMS containing these parameters to Home Mobile At home, Center PC reads SMS from Home Mobile and processes data 1.3 The model connection with extended circuit using transmitter and receiver RF modules or RS232 PC Home Mobile Remote mobile RF Remote Center Sensor [1] Extended Remote Sensor1 [3] RS232 Extended Remote sensor2 [2] The blocks “Extended Remote Sensor1” and “Extended Remote Sensor2” are extended blocks to enlarge the system The details of RF link and RS232 link (UART link) will be presented in Part IV Data from sensors in the block [1], [2], [3] will be send to center by remote mobile The SMS message received at Home Mobile will be processed by PC (storage and graph) 1.4 Model connection for collecting data from remote sensor using internet Home PC Internet RS232 RS232 Remote PC Remote Center Sensor RS232 Extended Remote Sensor1 Extended Remote Sensor2 Target of this model: Saving cost for region which have internet 1.5 Replaced model for remote region while don’t have internet, but covered by mobile network Home PC Internet GPRS Extended Remote Sensor1 Mobile Remote PC Remote Center Sensor Extended Remote Sensor2 This model using GPRS (2G) network for connection sensors from remote area to center II Algorithms for programming microcontroller in the board (center board and extension board) 2.1 Center Board We use model connection in section 1.4 for programming microcontroller in center board (Because this is the most complicated model connection) Start No Have RF signal? Yes Save received characters to RF buffer Process UART buffer [a], and delete it No RF frame is completed? Yes -Process RF buffer[b] And delete it Processing data in buffer RF (block [b]), buffer UART (block [a]).It means detach data bytes in them, and save to third Buffer After that waiting for certain time, or trigger event caused by center (such as calling signal or arrival message signal from center), to transmit data in that buffer to center by SMS 2.2 Extended circuit for main circuit Start Collecting data from sensors and save to buffer No Have trigger event? Yes Send data in buffer to Board center (center circuit) III Protocols for connecting cell phone to PC or microcontroller We use two types of protocol in this thesis, AT command and FBUS protocol 3.1 AT command 3.1.1 Some single AT commands used in communication with the cell phone at+cbc? Get information about the pin status, to know when to cover the pin at+gmm? Get information about your phone model, to select the appropriate AT command set at+cgmi? Get information about device‘s manufacturer at+csq? Get information about the strength interference at+cusd=1,"*101#" Get information about the amount in the account of SIM, for the should recharge the SIM at+csca? Retrieved number message center, used to sending message process at+cpbr=1,25 Used to read the telephone directory from to position 25 3.1.2 The combination of AT commands - Combination of AT commands to read the last message in the device at+cpms=”me” After this command we know the number of messages (X) have in the phone at+cmgf=1 Specify the message read in text format ( at+cmgf=0, PDU format) at+cmgr=X After this command we have the last message in the device Sample at+cpms="me" +CPMS: 18,70,7,30,18,70 OK at+cmgf=1 OK at+cmgr=18 +CMGR: "REC READ","+84936975464","MrChick","09/05/01,10:13:13+28" Test doc noi dung tin nhan OK - Combination of commands to help read all messages at+cpms="me” show out memory to read data is the device memory (at+cpms="sm” show out memory to read data is the SIM memory) at+cmgf=1 Specify the message read in text format at+cmgl="all” Read all messages in the memory - Combination of command to help read the message received from device at+cnmi=2,1,0,0,0 Setting up the report when the message send to device When a message come to device, the phone will output to COM port the following text string +CMTI: "ME",60 This string show that the message is saved in the position 60 in the phone (ME) Similarly, if messages stored in SIM in position 60, the string returns form +CMTI: "SM",60 Then we need to output the combination of the following to read the message in text format at+cpms=”me” at+cmgf=1 at+cmgr=60 - Combination of command to delete message in the phone Command delete messages in the position X in the device memory or SIM memory at+cpms=”me” (SIM memory: at+cpms=”sm”) at+cmgd=X 3.2 FBUS protocol 3.2.1 General about FBUS protocol The FBUS protocol is used in communication between phone and PC We can also use FBUS for communication between phone and microcontroller FBUS bases in packets for error control and management FBUS parameters Speed: 115,200 bps Bits: Parity: None Stop Bits: 3.2.2 General structure of a command in FBUS 1e: cable 10 ... (storage and graph) 1.4 Model connection for collecting data from remote sensor using internet Home PC Internet RS232 RS232 Remote PC Remote Center Sensor RS232 Extended Remote Sensor1 Extended Remote. .. RS232 PC Home Mobile Remote mobile RF Remote Center Sensor [1] Extended Remote Sensor1 [3] RS232 Extended Remote sensor2 [2] The blocks “Extended Remote Sensor1” and “Extended Remote Sensor2” are... containing commands (SMS) to Remote Mobile Remote Mobile is a cell phone connected with the board having sensors This board collects parameters from sensor, then transfers to Remote Mobile and Remote

Ngày đăng: 25/04/2013, 11:25

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan