ERV780  Advanced Microprocessor System Design

Preliminary Design

ERV732

Assignment 4

Detailed Design

Yusuf Kaka

        23432692        

2005-04-18


TABLE OF CONTENTS

1.0        Scope        3

2.0        Hardware Design        3

2.1        GSM Modem        4

2.2        Communication Interfaces        4

2.3        Microcontroller        4

2.4        Power Supply        4

3.0        Software Design        5

3.2        System Characteristics        8

3.3        Design and Construction        10


  1. Scope

This Document will specify the detailed design of a GSM Home Automation Controller. The technical requirements for the System will be documented through a series of specifications.  This document includes detailed hardware and software designs of the system.

 

  1. Hardware Design

Figure 1 shows the high level design of the system. The unit, represented by the yellow block comprises of a Microcontroller, a GSM modem and antenna, a power supply and communication interfaces.

Figure 1 Conceptual System Block Diagram

The heart of the system is the GSM modem, which determined the interface requirements to the microcontroller as well as power requirements.

  1. Component Selection

  1. GSM Modem

The Motorola D15 embedded GSM modem was selected because of the availability, price and form factor. The dimensions and layout of the modem played an important role in the PCB layout.

d15 DV DIN Horizontal

Voltage:

3.0 to 6V measured at the I/O connector during the transmit slot  (576us out of 4.6ms)

Current:

<11 mA Stand by

< 150uA off current

300mA avg. in call at power level 5 (max. 350 mA)

1.2 A peak @ 217 Hz at power level 5 (max. 1.8A)

Power out:

GSM – Power levels #19 to 5, 5dBm to 33dBm per ETSI.

DCS – Power levels # 15 to 0, 0dBm to 30 dBm per ETSI.

PCS – Power levels # 15 to 0, 0 dBm to 30 dBm per FCC.

SIM Card Reader:

Options:   1. Internal - chip SIM CR    3/5V SIM

                2. External - Local interface   3/5 SIM

                3. External - Remote interface (DSC interface) 5V only

Interface:

Options

  1. 9 pin RS232 Serial Asynchronous full flow control , 5V logic level (DCE                              flow direction)
  2. 4 pin RS232 Serial Asynchronous using  SoftGSM SW for PC applications,  5V logic levels  (DCE flow direction)
  3. Motorola Proprietary DSC Bus
  4. IRDA communication – In DIN models only. Optional, special order only                          

  1. Communication Interfaces

Several interfaces are required in the system, including:

The Microcontroller modem interface requires a serial connection. The selected modem operates at 5V TTL level, which means that an RS-232 driver chip is not required. However, a second serial port will be required to connect to slave nodes and depending on the type of nodes, these may require RS-232.

Several IO pins are needed to control nodes which are connected in parallel to the system such as normal relays.

  1. Microcontroller

After weighing up all the possibilities, the PIC 16F876 was chosen. Although it only has one serial port, a 2nd serial port can be implemented on normal IO pins by means of software. This serves as an advantage because the aim of the system is to be flexible to many types of slave nodes, using various protocols. Therefore, non serial nodes can still be accommodated for by implementing different software.

Voltage on VDD with respect to VSS ........................................................................................................... -0.3 to +7.5 V

Voltage on MCLR with respect to VSS (Note 2) ................................................................................................0 to +14 V

Voltage on RA4 with respect to Vss .................................................................................................................0 to +8.5 V

Total power dissipation (Note 1) ..............................................................................................................................1.0 W

Maximum current out of VSS pin ...........................................................................................................................300 mA

Maximum current into VDD pin ..............................................................................................................................250 mA

Maximum output current sunk by any I/O pin..........................................................................................................25 mA

Maximum output current sourced by any I/O pin ....................................................................................................25 mA

Maximum current sunk by PORTA, PORTB, and PORTE (combined) (Note 3) ...................................................200 mA

Maximum current sourced by PORTA, PORTB, and PORTE (combined) (Note 3)..............................................200 mA

Maximum current sunk by PORTC and PORTD (combined) (Note 3) .................................................................200 mA

Maximum current sourced by PORTC and PORTD (combined) (Note 3) ............................................................200 mA

Voltage spikes below VSS at the MCLR pin, inducing currents greater than 80 mA, may cause latch-up.

Thus, a series resistor of 50-100should be used when applying a “low” level to the MCLR pin, rather than

pulling this pin directly to VSS.

Port Protection

Crystal Selection

Going for XT ceramic crystal 4Mhz

Therefore I need an ECS-40-20-1 and two 15pF caps

  1. Power Supply

  1. Schematic Diagrams

  1. Microcontroller

  1. Power Supply

  1. Connectors

  1. PCB Layout

The PCB Layout was done in Orcad Layout. A 2 Layer board was deisgned, shown below.

  1. Materials, Processing and Parts

Item Number        Quantity        Value        Description        Part Number        Part Reference

1        1        100uF                        C1

2        1        100uF                        C4

3        2        18PF        CAP 18PF 50V CERAMIC 0402 SMD        TMP-29        C11 C12

4        3        470nF        CAP 50V 390PF AXIAL CERAMIC C0G        TMP-30        C31 C32 C41

5        1        1000uF                        C42

6        1        1N4002        Hi Speed Sw. Diode        TMP-27        D2

7        1        LED 1                        D4

8        1        LED 2                        D5

9        1        LED 3                        D6

10        1        LED 4                        D7

11        1        LED 5                        D8

12        1        LED 6                        D9

13        1        Li-ion Battery & Programming                        J1

14        1        Charger Input                        J2

15        1        GSM Connector                        J3

16        1        Nodes                        J8

17        1        Node Connector                        P1

18        4        3.3K        Normal Resistor        TMP-15        R3 R4 R7 R8

19        4        47K        Normal Resistor        TMP-16        R5 R6 R18 R19

20        6        150        Normal Resistor        TMP-13        R9 R10 R12 R13 R14 R15

21        2        1K        Normal Resistor        TMP-14        R16 R17

22        1        PSS                        S31

23        1        RST                        S32

24        1        SW DIP-4                        SW1

25        1        CLK        Test Point        TMP-22        TP1

26        1        VDD        Test Point        TMP-25        TP2

27        1        5V        Test Point        TMP-23        TP3

28        1        GND        Test Point        TMP-26        TP4

29        1        RXN        Test Point        TMP-20        TP5

30        1        TXN        Test Point        TMP-21        TP6

31        1        RXG        Test Point        TMP-19        TP7

32        1        TXG        Test Point        TMP-24        TP8

33        1        MAX233                        U2

34        1        CS-5203A-5/DD                        U5

35        1        PIC16F873                        U12

36        2        24LC515        microchip ram 512k        TMP-31        U21 U22

37        1        4MHz        4 MHz Oscillator        TMP-32        Y11


  1. Software Design

The software system for the system was designed using the Rational Unified Modeling Language as illustrated below.

Figure 2 Use-case diagram showing local and remote user interaction with system

The diagram classifies users into either local or remote users. The local user has the ability to change passwords like the security password as well as the SIM password. The local user may also need to interact directly with the modem and a “send AT command” use case is added to facilitate this need. Since the modem, computer and port settings may differ on every system, it was necessary to add the “change modem port settings use case” for the local user. The remote user requires use-cases corresponding to every type of command available. These include the use-cases Switch Device On/Off, Switch All Devices On/Off, Implement Timer and Request Status.

It was decided that a simple flowchart be used instead of UML sequence diagrams to gain an understanding of the flow of events [Figure 2]. This flowchart was used to place the methods and routines developed during the incremental design in correct sequence.

Figure 6 Flowchart representation of GSM Home Automation software

5.2 User Interface Design

5.2.1 Cell Phone / PDA Interface

Figure 6 below displays example SMS’s sent to and received from the system. Example 1, sent to the system will switch the appliance corresponding to 1 on, appliance 2 off and appliance 8 on. Example 2 will switch all appliances connected to the system on for duration of 1 hour and 30 min. Example 3 will switch appliance 3 off and request a status report SMS from the system. Example 4 is an example of the acknowledgement SMS received from the system every time an SMS instruction has been successfully carried out. Example 5 is an example of a status report SMS’ed back to the user when a status request SMS is sent to the system.

Figure 7 Cell phone SMS commands, example screenshots

Table 1 shows examples of conceptual SMS commands that may be sent to the system to control appliances.

 

SMS Command

Description

SWITCH_”device id number”_ON/OFF

Switches the device specified by id either on or off.

ALL_ON/OFF

Switches ALL the devices connected to the system either on or off.

TIME_“hours”HRS_“minutes”MIN

Applies the control commands for the specified time and then restores switches to previous state.

STATUS

Requests an appliance status report from the system via SMS.

“Password”

System security password

Table 1 Conceptual SMS command protocol

  1. Performance Characteristics

The System will require a Microprocessor that is capable of handling incoming and outgoing SMS strings. Table 3 shows the structure of a GSM SMS including the size of the SMS. The maximum size of memory required to hold an SMS is therefore 163 bytes. However, more ram will be required for manipulating the data and preparing the response SMS. A minimum of 500 bytes ram should satisfy the requirements for SMS handling.

Field

Size (bytes)

Description

Header

1 byte

Identifies the type of message

Service Centre Timestamp

7 bytes

YYMMDDHHMMSSZZ (ZZ is time zone) Every nibble has to be inverted, so 12 becomes 21

Originator Address

Max 12 bytes

The phone number of the originator

Protocol Identifier

1 byte

Data Coding Scheme

1 byte

User Data Length

1 byte

Length of the message

User Data

Up to 140 bytes

Body of the message.

Table 3 GSM SMS Structure

  1. Effectiveness Requirements

Interaction with the GSM module will occur with the use of “AT” commands. Example commands are shown in Table 4. The AT commands will be sent over a serial link to the module, therefore 1 serial port is needed for processor-GSM interaction with a minimum speed of 9600 baud.

AT Command

Description

GSM Specific Commands

AT+CPIN=”SIM pin number”

Initialise modem with SIM pin number

AT+COPS

Operator Selection

AT+CLCK

Facility Lock

SMS Specific Commands

AT+CMGR=”message number”

Read SMS message

AT+CMGD=”message number”

Delete SMS message

AT+CMGL=”type”

List SMS messages

Standard Modem Commands

ATD “number”

Dial number

ATH

Hang up call

AT

Modem status check

Table 4 GSM Modem sample AT command set