e021038.pdf
(
350 KB
)
Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
MICRO
CONTROLLER
Remote Process Control
using a Mobile Phone
for ‘35’ series Siemens mobiles
Design by Prof. B. vom Berg and P. Groppe (Georg Agricola Technical University)
The Short Message System (SMS) of a standard mobile phone can be used
for much more than just exchanging cryptic messages. This application
finds the humble mobile working in a remote site monitoring and con-
trolling external equipment.
38
Elektor Electronics
1/2002
MICRO
CONTROLLER
SMS:
“Pressure: 100 bar”
“Excessive”
“Boiler 5 just exploded”
Process
8 digital OUT
8 digital IN
SMS
ExBo
SMS:
“Close valve 5”
“Target value 50 bar”
– Digital I/O,
– Analo
g
ue I/O,
– Commands,
etc.
se
r
ial
asynchronous
interface
C
system
µ
SMS
ExBo
PC:
Internet-based Free SMS
Process
- Documentation
- Archiving
- etc.
serial
asynchronous
interface
010087 - 12
Figure 1. Remote process control using a mobile and SMS.
This design is the result of collabo-
ration between a technical univer-
sity (TFH Georg Agricola) and the
company of Engelmann & Schrader.
Together they have produced a flexi-
ble, professional remote process con-
troller in the form of an experimenta-
tion card (The TFH SMS ExBo). This
card connects between the process
to be controlled and a mobile phone
and allows the process to be con-
trolled and monitored remotely using
SMS messages.
over the serial interface connector to
the mobile where it will be sent to
any SMS-capable phone worldwide.
Control information in the SMS mes-
sage will for example be
set10
this
will have the effect of setting output
10 on the interface card and switch-
ing on any LED, motor or relay con-
nected to this output. Similarly in the
other direction the SMS chip reads
inputs to the interface card from the
controlled process and generates an
appropriate SMS message that will
then be passed over the serial inter-
face to the remote mobile where it
will be sent out to any SMS-capable
mobile worldwide. The message
may convey information such as
‘Over-pressure detected in tank 3’ or
‘Intruder alert door 5’ or even ‘Holi-
day cottage central heating boiler
on’ the possibilities are endless.
The TFH SMS ExBo (‘Experimen-
tal Board’) interface board is
equipped with a second asynchro-
nous serial interface port and this
allows connection of an external computer or
process controller at the remote site. This
facility gives a higher level of control and
monitoring allowing measured values, vari-
ables and process status information to be
exchanged. With this setup the interface
board will initialise the mobile as before but
it will pass SMS messages unaltered through
to the external computer. This gives the sys-
tem a much greater flexibility with SMS mes-
sages being decoded and generated in the
external computer.
The SMS-Chip
The microcontroller used in this design is the
AT89S8252 or AT89LS8252 from Atmel. It is
based on the 8051 processor and has an
8 kByte Flash program memory together with
a 2 kByte Flash data memory. It is pro-
grammed to act as an SMS chip and essen-
tially performs three basic tasks:
Controlling the process
using SMS
The SMS interface board offers two
levels of control sophistication. At
the basic level it will interpret SMS
messages, check the incoming pass-
word and directly control output
relays or indicators. In the other
direction the SMS chip on the inter-
face card inserts information into an
SMS message which is then sent
– Re-program the mobile and handle commu-
nications with the mobile over the serial
interface.
1/2002
Elektor Electronics
39
MICRO
CONTROLLER
+5V
D7
C6
+5V
1N4148
D6
100n
+5V
+5V
S3
C9
BAT48
K6
10
µ
63V
+5V
15
18
3
+5V
RESET
1
2
BT1
CS1
ALE
+5V
3
4
A0
K5
R5
CR2032
IC6
A0
4
5
14
D0
D1
D2
D3
A1
5
6
LCD
A0
A1
D0
P1
1
2
WR
A1
A2
A3
13
D0
7
8
D1
D1
CS0
3
4
CS1
6
12
D2
9
10
D3
A2
D2
CS2
5
6
CS3
20
20
7
11
D4
11
12
D5
C3
A3
D3
10k
CS4
7
8
CS5
IC2
IC3
D6
13
14
D7
RTC72421
D0
D1
D2
D3
D4
D5
D6
D7
9
10
A0
10
10
RTC
2
8
RD
WR
+5V
CS0
RD
WR
11
12
A1
A2
A3
A4
A5
A6
A7
100n
1
10
STDP
13
14
JP5
15
16
9
17
18
+5V
POWER
+5V
19
20
K3
D
4
21
22
C15
1
5
C2
23
24
µ
9
25
26
RD
C5
JP3
+5V
R4
100n
4
16V
100n
11
8
40
V+
3
10
9
WR
RTC
C12
C1+
20
7
31
14
15
IC2
EA/VP
T0
T1
IC7
1
2
3
12
I0
I1
I2
I3
I4
I5
I6
I7
I8
F0
2
12
9
µ
16V
1
74HCT573
C1–
RESET
R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K4
K5
OUT6
OUT7
X1
X2
12
8
8
12
20
19
X1
18
9
11
11
9
7
13
13
7
5
15
15
5
C7
C8
8
3
17
17
3
8
27p
27p
1
1
8x 330
Ω
8x 330
Ω
JP1
JP2
11,0592MHz
1
1
EN
+5V
EN
8x LED
8x LED
19
19
EN
EN
K1
74ACT240
74ACT240
+5V
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
RE2
RE3
RE4
RE5
20
C4
S1
S2
2
6
2
6
2
6
2
6
IC4
100n
10
9
9
9
9
K7
14
1
8
14
1
8
14
1
8
14
1
8
7
7
7
7
IC8
7805
+5V
F1
S4
D5
1N4002
1A
K8
R3
+5V
D
3
C10
C16
C1
100
µ
10
µ
10V
100n
25V
K2
010087 - 11
Figure 2. The circuit diagram.
40
Elektor Electronics
1/2002
MICRO
CONTROLLER
The two remaining inputs on P1.0 and P1.1
are used for switches S1 and S2.
Table 1. Input/output port specifications
Port
Pin No.
Function
Digital outputs (P2.0 - P2.7)
Outputs P2.0 to P2.7 are buffered by IC3. Four
of the outputs are used to drive relays RE2 to
RE5 and these provide four switched outputs
at connector K2. Two TTL level outputs OUT6
and OUT7 are also available at this connec-
tor. The state of these outputs is displayed by
LED array D2 and again if this feature is not
required jumper J2 need not be fitted.
P1.0
0
INPUT : connection for switch S1
P1.1
1
INPUT : connection for switch S2
P1.2
2
INPUT : TTL level, unprotected
P1.3
3
INPUT : TTL level, unprotected
P1.4
4
INPUT : TTL level, unprotected
P1.5
5
INPUT : TTL level, unprotected
P1.6
6
INPUT : TTL level, unprotected
The Serial Interfaces
There are two serial interfaces supplied on
the interface. K3 connects to the mobile
phone while K4 connects to the serial port of
an external computer.
IC7 (MAX207) converts the voltage level of
the signals on both interfaces (V24) to TTL
levels used on the interface card. A voltage of
approximately 10 V is also produced by the
outputs of T1OUT, T2OUT and T3OUT for the
data cable. Removing jumper J3 will discon-
nect this voltage from the interface (see
Table
2
). Current to charge the battery in the mobile
is supplied from pin 9 of connector K3 when
jumper J5 is fitted. Sub-D connector K4 is
used to connect to an external computer or
process controller where SMS messages can
be sent and received.
P1.7
7
INPUT : TTL level, unprotected
P2.0
8
OUTPUT: connection LED0 of LED array D2
P2.1
9
OUTPUT: connection LED1 of LED array D2
P2.2
10
OUTPUT: Relay Re2; max. 200 VDC, max. 1 A, max. 15 W
P2.3
11
OUTPUT: Relay Re3; max. 200 VDC, max. 1 A, max. 15 W
P2.4
12
OUTPUT: Relay Re4; max. 200 VDC, max. 1 A, max. 15 W
P2.5
13
OUTPUT: Relay Re5; max. 200 VDC, max. 1 A, max. 15 W
P2.6
14
OUTPUT: TTL level from 74AC/HCT240 driver chip
P2.7
15
OUTPUT: TTL level from 74AC/HCT240 driver chip
SMS Chip Hardware
– Receive and decode SMS mes-
sages: monitor and control inputs
and outputs of the board. Generate
SMS messages.
The SMS chip together with some
additional peripherals will produce a
very basic SMS message handling
design but if you look at the circuit
diagram in
Figure 2
you will see that
the TFH SMS ExBo interface card
has been designed to be the basis of
a very flexible platform for SMS mes-
sage development allowing many
connection possibilities. The (DIL)
SMS chip IC1 is clocked by a stan-
dard crystal oscillator configuration
(X1, C7 and C8) and a reset circuit is
provided by R5, S3 and C9. A low
power LED (D4) is driven by output
pin P3.5 indicates that the GSM
phone is ready.
Table 1
shows the
I/O pin assignments.
SMS Chip peripheral circuits
The SMS chip, like all other 8051 processor
derivatives requires a little bit of external
peripheral circuitry. Firstly the address and
data bus need to be demultiplexed at port P0
and this is performed by an octal D type flip
flop (IC2) using the ALE signal. These
address lines are now decoded by GAL IC5
to generate chip select signals for the rest of
the components on the interf
ace
card
. The
addres
s li
nes together with RD/WR, chip
select (CS) along with the supply voltage are
available on pin-strip K5.
The circuit also includes a real-time-clock
and a connector for an LCD both of which are
controlled by the SMS chip.
–Pass messages to and from the
mobile and external computer sys-
tem.
Two 8-bit ports (port 1 and port 2)
are available on this chip giving 16
programmable digital input/output
lines. The chip also has a built-in
Universal Asynchronous
Receiver/Transmitter (UART) that
handles serial communication and in
this application it will pass serial
data including SMS messages to and
from the mobile. A second serial
interface is implemented in software
to communicate with the external
PC or process controller at
9600 Baud.
The interface board also contains
a real-time clock chip with battery
back-up and a connector to fit a dot
matrix LCD to display SMS messages.
Serial commands are sent to the
mobile using standard Hayes
modem (AT commands) sequences.
For more on Hayes modem control
see accompanying text box.
The RTC (Real Time Clock)
An accurate time reference is essential for
some applications so a Real-Time-Clock (IC6)
is included in the circuit. This chip maintains
the correct time of day for the whole TFH-
SMS-ExBo-System. A keep-alive battery (BT1)
is charged via D7 and ensures that the RTC
chip does not lose time if the main power
from connector K8 fails.
Digital inputs (P1.2 - P1.7)
The connector block K1 allows con-
nection of up to six input signals. All
of these inputs connect directly to
the microcontroller port P1. The state
of these signals is displayed on LED
array D1 via buffer IC4. If your appli-
cation does not need this feature or
you want to keep current consump-
tion as low as possible then jumper
J1 need not be fitted and these LEDs
will remain off.
The alphanumeric LCD
An LCD can be attached to connector K6. The
picture at the beginning of this article shows
1/2002
Elektor Electronics
41
MICRO
CONTROLLER
Chatting to the mobile
The SMS chip used in this interface card communicates with the
mobile phone using Hayes compatible command sequences over
its serial interface connection port. Back in the 70’s modems were
curious computer peripherals that just hung around whistling,
waiting for the Internet to be invented. There were many
modems on the market each model offering similar performance
but with incompatible control commands. The pioneering US
company Hayes came up with a set of commands that could be
used to control the modem and it wasn’t long before a modem
was not worth considering unless it was ‘Hayes compatible’. Even
today the command sequences are still implemented in all
modems and mobile phones.
stand. These allow for example access to the telephone book in
the mobile, managing SMS messages, adjusting ring tones and
speaker volume etc.
Connecting a data link cable (Data cable) or using an infrared link
between the mobile and the serial port of a computer means that
it is now possible to control the mobile from a computer key-
board rather than the phone keypad. This is much easier on the
fingers when sending text messages.
In addition to the standard commands each manufacturer has
defined extra commands that will only be understood by their
own mobiles. With the Siemens ‘35’ series (S35i, C35i, M35i)
there are 25 additional commands all prefixed with AT^S. This
diversity creates problems for anyone considering building a uni-
versal SMS interface. It is necessary to study the phone specifica-
tion closely to guarantee success. In this design all of these com-
mands are pre-programmed into the SMS chip so that it can be
directly connected to the Siemens ‘35’ series of mobiles. Hardly
any programming is necessary to develop a remote control appli-
cation and even a second interface is provided at the remote site
so that an external PC can be connected to provide more com-
plex control possibilities. It is of course only necessary to specify
this type of phone at the remote site, communication will occur
over the air with any SMS-capable phone anywhere in the world!
The commands begin with the ASCII characters AT and the actual
standardised commands start with the character string AT+C, all
ending with the ASCII code for Carriage Return. These com-
mands are also known as the ‘AT’ or ‘AT+C’ commands. These
commands have more recently been adopted by the mobile
phone industry and are defined in sections GSM07.07 and
GSM07.05 of the GSM mobile phone specification for the control
of phones over a serial interface. The interface can use V24 signal
levels via a cable or IrDa infrared link. Altogether there are 55 AT
commands listed which all of today’s GSM phones must under-
a four line by 20 character display but most
alphanumeric displays can be substituted
provided that are compatible with the Hitachi
HD44780 controller. Preset P1 allows the dis-
play contrast to be adjusted.
In the second part of this article we
will look closer at the connection
between the mobile and this inter-
face board, the basic configuration
and command sequences of the SMS
chip. We also look at the layout for
the circuit.
The GAL chip
Chip select signals on the circuit are gener-
ated by IC5, a 16V8 Gate Array Logic (GAL)
chip. The GAL chip simply reads the
addresses at its input and generates chip
select signal
s for
the
per
ipheral chips. The six
chip selects CS0 to CS5 are also available on
the pin strip K5.
Table 2. Jumper assignment
J1
Fit this jumper to activate LED-Array D1 (Displays the input status)
J2
Fit this jumper to activate LED-Array D2 (Displays the output status)
Positive supply potential for the Data Link cable:
The power supply
IC8 is a fixed voltage regulator that supplies
+5 V for the complete interface board and
charging current for the mobile. The mains
adapter unit should supply a voltage in the
range of 9 to 12 V with a current of 800 mA,
(including the mobiles charging current) con-
nected to K7 or K8. D5 protects the circuit
from accidental reversal of the power input
leads and LED D3 is the power-on indicator.
S4 is the on/off switch.
J3
This jumper should be fitted when using an off-the-shelf Data Link cable, otherwise
do not fit this jumper.
Controls the charging current to the battery in the mobile (not used on Siemens S35):
Fitted (Low level):
Standard charge with 5 V at 150 mA
J4
Fast charge with 5 V at 400 mA. Only fit this if using a
custom made Data Link cable with charging function.
(See part 2 of this article).
Not fitted (High Z):
Positive charging potential for the battery in the mobile (not used on Siemens S35):
Allows mobile battery to be charged when using a cus-
tom-made Data Link cable (see part 2 of this article).
Jumpers
The finished PCB has several jumper options
and their purpose is outlined in
Table 2
.
(010087-1)
J5
Fitted:
Not fitted:
In all other cases.
42
Elektor Electronics
1/2002
Plik z chomika:
TirNaNog
Inne pliki z tego folderu:
bge.jpg
(23 KB)
detail1.htm
(4 KB)
detail11.htm
(4 KB)
detail10.htm
(4 KB)
detail12.htm
(16 KB)
Inne foldery tego chomika:
1974
1975
1976
1977
1978
Zgłoś jeśli
naruszono regulamin