Remote Plc System Using Gsm Network

  • Uploaded by: Vishal4u
  • 0
  • 0
  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Remote Plc System Using Gsm Network as PDF for free.

More details

  • Words: 4,486
  • Pages: 7
Remote PLC system using GSM network with application to home security system A. Alheraish, W. Alomar, and M. Abu-Al-Ela

Remote PLC system using GSM network

Department of Electrical Engineering, King Saud University, Riyadh, Saudi Arabia Keywords Programmable logic controller, machine automation, GSM, home security, microcontroller. Abstract The focus of this paper is to present a low-cost and simple approach to designing intelligent home system using the concept of mobile-to-machine and machine-to-mobile communication. First, we develop a general purpose electronic circuit design that can control and monitor a variety of home appliances with interface that can be plugged into GSM handset unit. The design based on PLC comprises microcontroller, adaptation circuit, power circuit, and RS232 interface. Then, we develop prototype home security system as an application example of the designed PLC system. The system is completely built and tested and showed perfect operation.

1

Introduction Global System for Mobile communication (GSM) has been one of the best trustable wireless communication systems that can be accessed and used very easily. It is cost effective either if we consider the price of its transceiver module (a simple cellular phone) or the subscription fees. With the trend of huge growing usage of GSM during the past decade, network services is extended beyond speech communication to so many other custom specified applications, machine automation and machineto-machine communication. This paper designs an intelligent home that can communicate with the user by using a mobile phone over GSM network. The interface and communication between home appliance the controlling circuit is the most important component in automation process. This function is implemented by using a Programmable logic controller (PLC) interfaced to a mobile phone. The user sends GSM data in the form of SMS (short message service) message to switch ON or OFF any appliance inside the home, like lamp, light, air condition, washer machine, TV, register, video …etc. The appliance may also sends to the user its status and alarms. For instance, if some body tries to get into the home, then the home will automatically send alarm message to the user mobile phone or call the police station (if required). The system can be improved to provide the user with information about the status of each appliance, for example “Is the air condition ON or OFF?” A sketch of overall design of the PLC system is shown in Fig. 1. In the literature, there are few contributions proposed in recent years in machine-to-machine, mobile-to-machine, or machine–to-mobile communication. These include: designing prototype integrated mobile telemedicine system interfaced with sensors to a patient’s body using GSM simulation[Woodward, 2001]; designing mobile system with wireless LAN [Kugean, 2002]; implementing measurement system to monitor the ambient air quality using GPS, GPRS modem and advanced RISC machine [Sang,2 004]; designing remote control of sensors and actuators using GSM module [Aranguren, and designing stand-alone human temperature and We bloodfirst pressure purpose hardware circuit 2002]; and software algorithm of home appliance system. system using microcontroller with embedded software [Al-Ali, 2003]. In line with these works, shed the light on the PLC system followed by describing the major components of the we describe in this paper simple guideline procedures to build general purpose hardware circuit and system: circuit, power circuit. detailed softwaremicrocontroller, algorithm of homeadaptation appliance system. We and first shed the light on the More PLC system followed microcontroller operations with focus on system: AT commands transmission is presented by describing the major components of the microcontroller, adaptation circuit, andinpower circuit. 4.More detailed5, microcontroller operations withsecurity focus onsystem AT commands transmission is Section In Section we develop prototype home as an application presented in Section 4. In Section 5, we develop prototype home security system as example of the designed PLC system. Finally, Section 6 concludes the paper. an application example of the designed PLC system. Finally, Section 6 concludes the paper. Figure 1.

Figure 1. Simplified block diagram of PLC system

Simplified block diagram of PLC system

User Controlling Circuit

Home Appliance

PLC System The GSM network provides full duplex link to support the user requirement. The user

18th National Computer Conference 2006 © Saudi Computer Society

2

PLC System The GSM network provides full duplex link to support the user requirement. The user can access the application remotely through SMS service where his message read and decoded by the microcontroller attached to the mobile set through a suitable interface, usually RS232 is used but also either Bluetooth or infrared links can be used. A resident assembly program on the microcontroller board allows it to transmit and receive data bytes to and from the attached GSM module under the control of the far end phone key board or upon receiving SMS from the remote mobile phone The decoded message is then processed and used to access the application using digital input /output or digital to analog converter. Adaptation circuits are also needed to provide suitable operating voltage level for the application. Examples of adaptation circuits are relay, power switch, power amplifier…etc. Fig. 2 shows the block diagram of the connection between the main components of the PLC system. In the figure, the level shifter is used to change the signal level in the serial port (12 volt for logic 0 and -12 volt for logic 1) to TTL level (5 volt for logic 1 and 0 volt for logic 0) to be compatible with the microcontroller. The used level shifter in this circuit is MAX232. The machine is the major part of the system because the overall system is built to control it. The machine can be either electrical or mechanical or any other type according to the user requirements. The machine includes all the necessary circuits and sensors needed to couple, apply input or output signals from the microcontroller to the units to be controlled. Among the circuit that may be employed in general are: 1- Different types of sensors, analog or digital, to sense temperature, pressure , speed, …etc 2- Analog signal processing circuits 3- Programmable counters and timers, power switches: mechanical relays or semiconductor switches. Input output latch circuits. 4- A/D and D/A�circuits 5- Input output latch circuits. 12V

0

10

1

5

10

1

GSM

Far end User

Figure 2.

Figure 2. The block diagram of the PLC system

-12V

Level Shifter

RS232 AT Command

Microcontroller AT Command

Adaptation circuit

The block diagram of the PLC system Machine

Hardware Construction This sectionHardware describes inConstruction details the major hardware components in Fig. 2, namely: microcontroller, adaptation circuit, and power circuit. The integration of all these components will be also sketched.

This section describes in details the major hardware components in Fig. 2, namely:

The Microcontroller microcontroller, adaptationdevice circuit, power circuit. Theasintegration all these The microcontroller is a programmable that and can be designed to work the designerof want. components will be also sketched. It acts as the brain of the system. This microcontroller is designed to be multi input multi output and general purposes microcontroller. To make this microcontroller works, the programmer writes a program that the overall system then downloads this program inside the microcontroller Thecontrols Microcontroller chip. This program must be a HEX file. The program is written using assembly language and then converted toThe HEXmicrocontroller file. There are several types of the microcontrollers available in the markets. Theas the is a programmable device that can be designed to work easiest way designer of using the microcontroller is tobrain replace it with the personal computer (PC). However, want. It acts as the of the system. This microcontroller is designed to such approach is not efficient and even not cost effective. The optimum way is to use a small microbe multi input multi andAT89C52 generalMicrocontroller. purposes microcontroller. To make this controller instead of PC. In this paper,output we adopt

microcontroller works, the programmer writes a program that controls the overall

The AT89C52 is a low-power, high-performance CMOSinside 8-bit microcomputer with 8Kchip. bytesThis of Flash system then downloads this program the microcontroller program

must be a HEX file. The program is written using assembly language and then converted to HEX file. There are several types of the microcontrollers available in the markets. The easiest way of using the microcontroller is to replace it with the personal computer (PC). However, such approach is not efficient and even not cost effective.

programmable and erasable read only memory (PEROM). The device is manufactured using ATMEL high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 and 80C52 instruction set. The on-chip Flash allows the program memory to be reprogrammed insystem or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the ATML AT89C52 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. The 89C52 chip contains the following sections: 1- Standard 80C51 CPU 2- Full–Duplex UART (Universal Asynchronous Receiver Transmitter). 3- 3 programmable timers. 4- 8 k byte Flash memory. 5- 4 I/O programmable ports 6- Crystal Oscillator circuit where the crystal is connected externally. The chip can also work from external clock generator while disabling the Crystal oscillator. The functions of the microcontroller in the system are: a- Initiate the attached GSM module and make it ready to communicate with the other phone by sending a confirmation either through SMS or dialing the previously stored phone numbers list. This is important to acknowledge the far end control units that the system is ready. This step is done once when system power is turned ON, and each time the power is turned ON. b- Check the reception of any commands either in SMS or by answering a call and waiting the commands from the far end mobile set. This also include sending a confirmation that the message is received . c- Process the received commands and produce all signals needed to physically execute this command . d- Perform any needed tests and acquire all possible signals that confirm the execution of the received commands. e- Send a confirmation message to the far end mobile set and return again in waiting state for another commands. Of course the above functions are general and the system driving software may be written to adopt a specified application. One of the 8051’s many powerful features is it’s integrated UART, otherwise known as a serial port. The fact that the 8051 has an integrated serial port means that the programmer may very easily read and write values to the serial port. If it were not for the integrated serial port, writing a byte to a serial line would be a rather tedious process requiring turning on and off one of the I/O lines in rapid succession to properly “clock out” each individual bit, including start bits, stop bits, and parity bits. However, the programmer does not have to do this. Instead, he simply needs to configure the serial port’s operation mode and baud rate. Once configured, all what he has to do is writing to an SFR (Special Function Register) to write a value to the serial port or read the same SFR to read a value from the serial port. The 8051 will automatically let the programmer know when it has finished sending the character he wrote and will also let him know whenever it has received a byte so that he can process it. The programmer does not have to worry about transmission at the bit level--which saves him quite a bit of coding and processing time. The Adaptation Circuit The microcontroller controller can accept TTL level in its input or output but most of the external circuits work in either 220volt or 110 volt and thus the microcontroller can not operate these circuits. To overcome this, the adaptation circuit is used to convert the input or the output voltage level between the microcontroller and the external circuit. The adaptation circuit consists mainly of relays and transistors. Fig. 3 shows the adaptation circuit suggested in this paper. When the input to the adaptation circuit is low then the output will be 220v and the switch will be opened but when the input is high then the switch will be closed. The reason behind using this type of the circuit is to completely isolate the relay current from the microcontroller current. This method prevents the output voltage from dropping and prevents the microcontroller from producing a high current, which may damage the microcontroller.

Remote PLC system using GSM network

3

circuit is low then the output will be 220v and the switch will be opened but when the input is high then the switch will be closed. The reason behind using this type of the circuitisislow to completely isolate the thewill microcontroller current. circuit then the output will berelay 220vcurrent and thefrom switch be opened but when This the input is high then the be closed. The reason using type of the method prevents the switch output will voltage from dropping andbehind prevents thethis microcontroller circuit is to completely isolate the relay current from the microcontroller current. This from producing a high current, which may damage the microcontroller. method prevents the output voltage from dropping and prevents the microcontroller 5v from producing a high current, which may damage the microcontroller. 5v

11

AC

Load

Adaptation Adaptation circuit circuit

1

2

Relay 1

Load

11

22

22

220v

220v AC 220v

Figure 3. FigureAdaptation 3. Figure 3. circuit

22

220v

1

2

2

1

1

2

4. 7k Relay

input

150k

1

4.7k

input

4

The Power Circuit

150k

The required power to operate the microcontroller is 5 volt (DC) but the available voltage supply is 220 volt (AC). The system must use a circuit to covert the voltages

The to Power Circuit 5 volt. The circuit consists of a transformer to change the voltage from 220v (AC) The to required power to operate the microcontroller is 5 volt (DC) butofthethe available voltage supply is and 220 volt 6 volt (AC), a bridge to take the absolute value signal, a capacitor a (AC).regulator. The system must a circuit to covert the voltages to 5 volt. The circuit consists of a transformer to The Power Circuit Fig. 4 use shows the building of this circuit. change the voltage from 220v (AC) to 6 volt (AC), a bridge to take the absolute value of the signal, a capacitor and a regulator. Fig. 4 shows of this The required powerthetobuilding operate thecircuit. microcontroller is 5 volt (DC) but the available

~

5v volt (AC). The system must use a circuit to covert the voltages voltage supply is 220 Input Regulator output to 5 volt. The circuit consists of a transformer to change the voltage from 220v (AC) 1m 220v a capacitor and a to 6 volt (AC), a bridge to take the absolute value of the Bridge - signal, AC regulator. Fig. 4 shows the building of this circuit.

+

Figure 4.

Figure 4. The power power circuit The circuit

5v

5v

Regulator

output

Regulator +

~

~

~

Input

Adaptation

1m Integrating the above main microcontroller (AT89C52), adaptationCircuit circuit, 220v and M power 220v AC Bridgeis -illustrated circuit as well as level shifter (Max 232) in Fig. 5. In the figure, the AC 1m many machines (M) or home appliances. system is constructed to control and monitor

Figure 4. The power circuit

7

Serial port

Figure 5. The integrated PLC circuit

+ Bridge ~

~

1 2 3 4 5

220v - AC

Adaptation Circuit

Adaptation Circuit Adaptation Circuit

220v AC

M

220v AC

M

220v AC

M

Integrating the above main microcontroller (AT89C52), adaptation circuit, and power M circuit as well as level shifter (Max 232) is illustrated in Fig. Adaptation 5. In the220v figure, the Circuit AC system is constructed to control and monitor many machines (M) or home appliances. Adaptation Circuit

1000n 1 1000n

40 39

10k

220v AC

M

220v AC

M

1000n

1000n

1000n

Figure 5.

The integrated PLC circuit

1 2 3 4 5 6 7 8

AT89C52 2.2k

16 15 14 13 12 11 10 9

MAX 232

9 10 11

31

18 19 20

28 27 26 25 24 23 22 21

350

0.47m

HELE 11.0592MHZ

1

Adaptation Circuit

2

1k

Adaptation Circuit 1

1

2

Relay 4.7k

150k

Microcontroller Operation

1

2

2

220v

220v AC

M

2

5v

1

2

1

Integrating the above main microcontroller (AT89C52), adaptation circuit, and power circuit as well Remote as level shifter (Max 232) is illustrated in Fig. 5. In the figure, the system is constructed to control PLC system and monitor many machines (M) or home appliances. Microcontroller Operation AT commands (Attention commands) are commands that control the PLC system. The AT commands can be considered as a representation of the signal that passes inside the PLC system. If the microcontroller is considered as the brain of the system then the AT Commands act as the nervous of the system. These commands are used to allow the connection between the data terminal equipment and the data communication equipments through any port like the serial port RS232. The most commonly used AT Commands that are related to the SMS message are the following:

using GSM network

1- AT+CMGF=1 /* Setting the massage format to the text mode. 2- AT+CSDH=1 /* Setting the AT command to the mode that allows sending SMS. . 3- AT+CSMP=17, 167, 0, 0 /* Setting the text mode parameter, where the second parameter specifies the period for resending, meaning that 167 specifies that the time is 24 hours. The other parameters are related to the coding protocols. 4- AT+CPMS=<mem1>, <mem2>, <mem3> /* Preferring the memory location for the message storage. mem represents the type of memory to be used either SIM card or mobile equipment which are indicated by SM or ME respectively. mem1 specifies the memory from which the message will be read and deleted. mem2 specifies the memory to which writing and sending operation are made. mem3 specifies the memory that the received message will be stored in it 5- AT+CMGR=1 /* Reading the message, where “1” is the number of the message in the memory. 6- AT+CMGS= “the phone number” /* Sending the message. 7- AT+CMGD=1 /* Deleting the message. Sending the AT Commands by using the microcontroller is not an easy job. This is because the designer has to understand the communication protocols that are used by the GSM and by the mobile phone. Since sending the AT Commands will be through the serial port, the AT Command will be sent character by character. Once the mobile receives the character, it will use an error checking technique to check if the character was received correctly or there is error on it. The technique used in the mobile is the echo checking technique. In this technique, the mobile will resend the same received character again to the microcontroller to check if the transmitted character was received correctly or not. The procedure of transmitting the commands will be as follows. First, the microcontroller sends the first character of the AT Commands to the mobile. Then, the microcontroller will wait for the mobile phone to resend the same character to prevent the collision between the transmitted and received signal at the SBUF (Serial Control, Addresses 99h). The microcontroller will send the remaining characters by the same way. Once the AT Command has been sent completely, the mobile phone will send a response to the microcontroller. The number of the character response will vary from At Command to other. The microcontroller must wait until the received response finish completely. Home Security System A simple application of the above described system is a home security system as shown in Fig. 6. This system enables the far end user through SMS facility to monitor the state of home door and detect any illegal intrusion; select and change a certain password for key locking the door; and control the home lighting system to give impression for the outsiders that there is somebody inside. The password may be any four characters where their ASCII code is inserted in the deriving program either using the key pad or by sending a SMS message from the far end mobile. The intrusion detector is a simple LED (Light Emitting Diode) and an infrared sensors. These two elements are fixed across the door and send on/off signal in case of intrusion. The sensor will be connected to the microcontroller and acts as a switch. The sensor is read by the microcontroller that decode their reading and send it to the far end user through GSM network as SMS. Notice that the alarm of an illegal intrusion will be ignored when the program receive the correct password. The Control of the lighting system can be performed simply by using voltage controlled power switches connected shunt the usual on/ off switch of selected rooms and appliances in the house. The control signals of these switches come from port C of the microcontroller as it programmed as an output port.

5

intrusion will be ignored when the program receive the correct password. The Control of the lighting system can be performed simply by using voltage controlled power switches connected shunt the usual on/ off switch of selected rooms and appliances in the house. The control signals of these switches come from port C of the microcontroller as it programmed as an output port.

dc power supply +/- 12V Level Shifter + RS232C Connector and Cable

6

5V

��ATMEL 89X52 Microcontroller UART

Input Output Ports

Start Initializing the Microcontroller

Figure 6. Block diagram of Figure 6. Home Block diagram security of Home system security system

Initializing the mobile Power Switch drivers & [AT+CMGF=1], [AT+CSDH=1], [AT+CSMP=17, 167, 0, 0], Status[AT+CPMS="ME", signals "ME", "ME"] Is there a thief?

Key Lock Control 1- bit Yes

Intrusion Detector 1-bit Sent SMS to the user" there is a thief"

No

Lighting System and Home No Is there a new appliances Message?

Key Lock Solenoid

AT+CMGS

Infrared Sensor

Fig. 7 shows software implementation of the home security system operation. Two implementaSave and read the message tion scenarios are considered: controlling the alarm (from user’s remote mobile to the machine) and Figure 7. notification (from machine to user’s remote mobile) For the first scenario, the user sends SMS alarm 7 shows software implementation of the home security system operation. Two Themessage flow Fig. to the microcontroller. The microcontroller will then check for any new message. If there No Is the password correct? chart the implementation scenarios are considered: controlling the alarm (from user's remote is of a new message, the microcontroller sends AT Command that is specified for reading the message. home mobile the to the machine) and alarm notification (from machineThen, to user's remote will mobile) Consequently, microcontroller will save the message in its memory. the message be security compared with other messages that are stored previously. Based on this comparison, the microconDecode the message For the first scenario, the user sends SMS message to the microcontroller. The system troller will decide whichwill output pins havefor to be andmessage. which output pinsishave to be high. The microcontroller then check anylow new If there a new message, the Control the output of the Microcontroller high signal will go to the adaptation circuit and opens the switch causing the machine to work. The microcontroller sends AT Command that is specified for reading the message. received message will be automatically deleted. For the second scenario, the microcontroller input is Consequently, theswitch microcontroller will save thethemessage in its memory. the connected to a switch. The is fixed in the door. When door is opened, the switch Then, is closed Delete the message and there will be an input to[AT+CMGD=1} the microcontroller. The microcontroller check its input andon message will be voltage compared with other messages that are storedwill previously. Based sends alarm message to the as the designerwill hasdecide programmed. Fig. 8 shows a snapshot of the this comparison, theuser microcontroller which output pins have to be low and complete PLC system. Yes

Yes

which output pins have to be high. The high signal will go to the adaptation circuit and opens the switch causing the machine to work. The received message will be automatically deleted. For the second scenario, the microcontroller input is connected to a switch. The switch is fixed in the door. When the door is opened, the switch is closed and there will be an input voltage to the microcontroller. The microcontroller will check its input and sends alarm message to the user as the designer has Figure 8. Snapshot of programmed. Fig. 8 shows a snapshot of the complete PLC system. the PLC system

Figure 8.

Snapshot of the PLC system

Remote PLC system using GSM network

Start Initializing the Microcontroller

Initializing the mobile

[AT+CMGF=1], [AT+CSDH=1], [AT+CSMP=17, 167, 0, 0], [AT+CPMS="ME", "ME", "ME"]

Is there a thief?

Yes

Sent SMS to the user" there is a thief"

No

7 Is there a new Message?

No

Figure 7. The flow chart of the home security system

AT+CMGS

Yes

Save and read the message

No

Is the password correct?

Yes

Figure 7.

Decode the message Control the output of the Microcontroller

Delete the message [AT+CMGD=1}

Figure 8. Snapshot ofConclusions In this paper, we have developed an integrated PLC system. The system is intended to be used in the PLC many applications where the user can monitor and control target machine remotely using GSM system

network. The designed PLC system is based on microcontroller and adaptation circuit connected to various home devices. The electronic circuit design of each design element was described with economical and simple layout. The system was applied to an example of home security notification to monitor and control the home door alarm. The system has been implemented in laboratory and proved to be feasible by experiments. References Woodward, B. Istepamian, H. and Richards, C. (2001) “Design of a Telemedicine system using a mobile telephone”, IEEE Transaction on Information Technology in Biomedicine, Vol 5, No 1, March .

Kugean, S. Krishnan, S. Chutatape, O. Swaminthan, S. Srinivasan, Wang, N. (2002) “Design of a mobile telemedicine system with wireless LAN”, International Conference on Circuits and Systems, APCCAS’02, Asia-Pacific, Oct.

Conclusions

Sang, H. Lin, C. Youn, Z. (2004) “A wireless Internet-based measurement architecture for air quality monitoring”, IEEE Conference Instrumentation and Measurement Technology, IMTC 04, May.

In this paper, we have developed an integrated PLC system. The system is intended

Aranguren, G. Nozal, L. Blazquez, A. and Arias, J. (2002)“Remote control of sensors and actuators by GSM”, IEEE 2002 28th Annual to beConference used inof the many applications where the user can monitor and control target Industrial Electronics Society IECON 02, Vol. 3, Nov.

machine remotely using GSM network.

The designed PLC system is based on

Al-Ali, A. Al-Rousan, M. and Al-Shaikh, M. (2003) “Embedded system-Based Mobile Patient Monitoring Device”, The 16th IEEE Symposium on Computer-based Medical Systems, CBMS’03, May.

The flow chart of the home security system

Related Documents

Gsm Network
November 2019 17
Gsm Network
April 2020 14
Gsm Network
December 2019 17
Gsm System
June 2020 4

More Documents from ""

Data Encoding
July 2020 15
Why Wireless Hart
July 2020 9
Table Parameter
July 2020 17