0% found this document useful (0 votes)
125 views

Ee 549 Undergraduate Project Ii: "Voip To PSTN Converter"

The document describes an undergraduate project to design and build a Voice over Internet Protocol (VoIP) to Public Switched Telephone Network (PSTN) converter. The converter allows a normal PSTN phone to make and receive VoIP calls by connecting to an Ethernet network. The key components used include an IIM7010A Ethernet controller, PIC18F452 microcontroller, TP3057B PCM codec IC, CM8870 DTMF decoder, and LCD for displaying information. When a PSTN phone dials a number, the DTMF decoder identifies the digits and the microcontroller encodes the analog voice signal to PCM format before sending over the Ethernet network as VoIP. This allows the PSTN

Uploaded by

Obaweya Seyi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views

Ee 549 Undergraduate Project Ii: "Voip To PSTN Converter"

The document describes an undergraduate project to design and build a Voice over Internet Protocol (VoIP) to Public Switched Telephone Network (PSTN) converter. The converter allows a normal PSTN phone to make and receive VoIP calls by connecting to an Ethernet network. The key components used include an IIM7010A Ethernet controller, PIC18F452 microcontroller, TP3057B PCM codec IC, CM8870 DTMF decoder, and LCD for displaying information. When a PSTN phone dials a number, the DTMF decoder identifies the digits and the microcontroller encodes the analog voice signal to PCM format before sending over the Ethernet network as VoIP. This allows the PSTN

Uploaded by

Obaweya Seyi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

FACULTY OF ENGINEERING UNIVERSITY OF PERADENIYA

EE 549 UNDERGRADUATE PROJECT II

VoIP to PSTN Converter

Supervised by Dr. B.G.L.T. SAMARANAYAKE

WICKRAMASINGHE M.A.S.C. WIKRAMASINGHE W.J.L.D.I.

E/04/332 E/04/337

CHAPTER 1 INTRODUCTION

1.1 BACKGROUND
Embedded system is an intelligent system that has the capability of processing, monitoring and controlling. It may comprise of Coders, Telephones, Microcontrollers, FPGA, ASIC, etc. It typically has a specialized function with programs stored on ROM. Examples of embedded systems are automatic environmental systems, security systems, and entertainment systems. An added feature in any embedded system is its ability to communicate. The communication can be via Bluetooth, WI-FI, GSM, or Ethernet cables. The TCP/IP protocol is a widely used standard for modern digital communication. The project we have undertaken is VoIP to PSTN Converter. It includes the three concepts we discussed earlier viz. embedded systems, UDP/IP communication, DTMF decoding and Pulse Code Modulation. It provides real time voice data to remote locations through a network.

1.2 OBJECTIVE
Main objective of our project is designing and fabricating a Voice over Internet Protocol (VoIP) to Public Switched Telephone Network (PSTN) converter. When a normal PSTN phone is connected to the Ethernet LAN through this convertor the phone will be identified as a standard SIP phone by a VOIP service provider such as a soft switch or an IP-PBX system. The PSTN phone will be detected automatically by the VoIP phone system. By using the phone keypad User will be able to dial other VoIP clients .The calling party and the connection status should be displayed on the display of the converter.

1.3 OUTLINE OF THE PROJECT


The system designed in our project applied to convert analog voice signals in normal PSTN (Public Switched Telephone Network) phones to VoIP (Voice over Internet protocol). Voice signals came from the phone is sampled, quantized and encoded to standard PCM and direct them to the VoIP switch through the Ethernet network.

The PIC18F452 microcontroller is used to process data and the IIM7010A is used to connect the microcontroller to the LAN. User can dial the destination number using the push button number pad and the DTMF (Dual-Tone Multi frequency) signals coming out from the phone according to the pushed button are decoded by the CM8870 DTMF decoder. The microcontroller can identify the dialed number by the DTMF decoder output. The LCD displays necessary information such as dialed number, call duration in operating mode and system configuration data in configuration mode.

The PCM Codec IC TP3057B samples the analog voice encodes it and feed to microcontroller and decodes the sampled voice data into analog voice.

The encoded voice data is converted to VoIP using IIM7010A Ethernet controller and sends to destination. The converter is automatically detected by the soft switch configured in the computer network when it plugged.

Fig1.1: Simplified Diagram of Component Interconnections

CHAPTER 2 LITERATURE REVIEW

2.1 HARDWARE COMPONENTS USED


Our project comprises of following hardware components:

IIM7010A Ethernet controller PIC18F452 microcontroller PCM Codec IC (TP3057B) DTMF Decoder (CM8870) 2W/4W Converter (MH88500) LCD (LMV202D)

2.1.1 IIM7010A Ethernet controller


IIM7010A is the network module that includes W3100A (TCP/IP hardwired chip), Ethernet PHY (RTL8201BL), MAG-JACK (RJ45 with XFMR) with other glue logics. It can be used as a component and no effort is required to interface W3100A and PHY chip. The IIM7010A is an ideal option for users who want to develop their Internet enabling systems rapidly.

Fig 2.1: IIM7010 Ethernet Controller Block Diagram

Features
Hardware Internet protocols included: TCP, IP Ver.4, UDP, ICMP, ARP Hardware Ethernet protocols included: DLC, MAC Internal ICMP responds to PING commands Protocol processing speed: full-duplex 4~5 Mbps Intel/Motorola MCU bus Interface I2C Interface Internal 16Kbytes Dual-port SRAM for data buffer Wide operating voltage: 3.3V internal operation, 5V tolerant 3.3V IOs

2.1.1.1 Stack Modules


Following are some of the stack modules and API used. a. MAC (Media Access Control Layer): The Ethernet hardware doesn't understand IP addresses; it has its own addressing scheme based on a unique six-byte address for each network adaptor manufactured; this is generally called the media access and control (MAC) address.

b.

IP (Internet Protocol) The first software layer above the network drivers is IP and its partner

ICMP. Above these, there is a split: connection-oriented applications use transmission control protocol (TCP), whereas connectionless applications use user datagram protocol (UDP). An IP packet is known as a "datagram. IP is a protocol for routing packets through a network from origination to destination. A packet of data is equipped with an IP header, which contains information about the originator and the destination address. The data packet with the IP header is known as an IP datagram.

c.

TCP (Transmission Control Protocol) TCP is connection oriented and reliable protocol. TCP helps to do

several jobs at once. It initiates a connection between two nodes and sends data bi directionally between those two nodes. It handles the network failure, network datagram loss. It closes the connection between those two nodes as well.

d.

UDP (User Datagram Protocol) UDP is connectionless unreliable protocol. Unlike TCP, UDP provides

no acknowledgment functionality. Therefore, no guarantee exists that anything sent from an application that uses UDP will actually get to the desired destination.

Fig 2.2: UDP Header e. RTP (Real-Time Transport Protocol) It provides network transport services required for the support of realtime applications, such as voice and video. UDP does nothing in terms of avoiding packet loss or even ensuring ordered delivery. RTP, which operates on top of UDP, helps address some of these functions. For example, RTP packets include a sequence number, so that the application using RTP can at least detect the occurrence of lost packets and can ensure that received packets are presented to the user in the correct order. RTP packets also include a timestamp that corresponds to the time at which the packet was sampled from its source media stream. The destination application can use this time stamp to ensure synchronized play-out to the destination user and to calculate delay and jitter.

Fig 2.3: RTP Header

f.

SIP (Session Initiate Protocol) SIP is a signaling protocol that handles the setup, modification, and

teardown of multimedia sessions. SIP, in combination with other protocols, is used to describe the session characteristics to potential session participants. Although, SIP is written such that the media to be used in a given session could use any transport protocol, the media will commonly be exchanged using the Real-Time Transport Protocol (RTP) as the transport protocol.

Fig 2.4: An example of a SIP Call

2.1.2 Microcontroller (PIC18F452)


We could have used different microcontroller such as 8051, AVR but we opted for PIC family of microcontroller. It has the following advantages 10

1. It has high memory space. 2. It has built in AD Converter 3. It is developed using nanoWatt TECHNOLOGY that reduces power consumption during operation.

Fig 2.5: Pin Configuration of PIC18F452

The PIC18F452 has 5-ports. They are A, B, C, D, E. Port A, B, C, D are of 8-bits in length but port E is of only 4-bits length. All these ports are in digital I/O besides A6 and A7. The oscillator is connected to these pins. The analog input pins are in A0,A1,A2,A3,A5,E0,E1,E2,B0,B1,B2,B3,B4. The serial port data to the computer is transmitted from C6 and received form C7. The serial data to the Ethernet chip is transmitted from C5 and received from C4. If pin no. 1 is set to low the data memory of microcontroller will be reset.

Features Operating frequency Program memory Temporary data memory(Ram) Permanent data memory(EEPROM) I/O Ports Serial communication

PIC 18F452 PIC18F452 DC up to 32MHz(HS PLL) 64kb 1536bytes 256bytes Ports A,B,C,D,E MSSP,USART 11

10-bits A/D Module Instruction sets SPI module HS PLL

8 channels 75 instruction 10Mhz 4X local oscillator

Table 2.1: Features of PIC18F452 There are three types of memory in PIC18 Enhanced microcontroller devices: Program Memory Data RAM Data EEPROM As Harvard architecture devices, the data and program memories use separate busses; this allows for concurrent access of the two memory spaces. The data EEPROM, for practical purposes, can be regarded as a peripheral device, since it is addressed and accessed through a set of control registers.

2.1.3 PCM Codec IC (TP3057B)


PCM is the most commonplace coding technique used today. It is a waveform codec and is the coding technique that is used in circuit-switched telephone networks all over the world. PCM has a sampling rate of 8,000 Hz. If uniform quantization were to be used, then the signal levels commonly found in speech would be at least 12 bits per sample, leading to a bit rate of 96 Kbps. Non uniform quantization is used, however, with 8 bits used to represent each sample. This quantization leads to the well-known 64 Kbps rate.

12

Fig 2.6: Nonlinear Quantization Levels of PCM A-Low

Features
Complete CODEC and filtering system including: o Transmit high-pass and low-pass filtering o Receive low-pass filter with sin x/x correction o Active RC noise filters o A-law compatible Coder and Decoder o Internal precision voltage reference o Serial I/O interface o Internal auto-zero circuitry 5V operation Low operating power - typically 50 mW Power-down standby mode - typically 3 mW

13

2.1.4 DTMF Decoder (MT8870)


DTMF, or Dual Tone Multi Frequency, is a method of sending and receiving control information over a communications channel. The reader is probably most familiar with DTMF tones as heard on a modern push-button telephone. Each digit on the keypad is encoded as a DTMF tone, which is then transmitted over a medium, and decoded at the receiving end. A keypad as shown in following figure is usually used to generate the required DTMF tone. Each key has associated with it a row frequency, and a column frequency. When a key is pressed, the encoding circuitry mixes together these two frequencies, and transmits the result. The receiver then decodes the tone back into its two respective frequencies, and then the processing circuit will act accordingly.

Fig 2.7: DTMF key pad

Description of MT8870
The MT8870 is a complete DTMF receiver integrating both the band split filter and digital decoder functions. The filter section uses switched capacitor techniques for high and low group filters; the decoder uses digital counting techniques to detect and decode all 16 DTMF tone pairs into a 4-bit code. External component count is minimized by on chip provision of a differential input amplifier, clock oscillator and latched threestate bus interface.

14

Fig 2.8: Functional Block Diagram of DTMF Decoder MT8870

Features
Complete DTMF Receiver Low power consumption Internal gain setting amplifier Adjustable guard time

2.1.5 2W / 4W Converter (MH88500)


The separation of transmit and receive signals in the analog line interface (subscriber loop interface circuit) at Central Office is known as hybrid function. It is actually a 2-to-4 wire & 4-to-2 wire conversion or simply referred as a 2W/4W conversion and conventionally performed by a hybrid transformer in public switched telephone network. Two wires are used between telephone set and analog line interface to minimize telephone line cable costs for hundreds of thousands subscriber loops. Therefore, transmission and reception occur in the same two wires of the local loop.

15

Four wires are used for longer distance trunks between Exchange Branches to isolate the transmitted and received signals, because repeaters (i.e. signal amplification) are usually required for long distances and to facilitate the transmission of both digital data and voice.

Description of MH88500
The Mitel MH88500 Subscriber Line Interface Circuit provides a complete interface between the telephone line and a speech switch requiring only single bidirectional switch per cross point. The functions provided by the MH88500 include bidirectional differential to single ended conversion in the speech path, line battery feed, ringing feed and loop and dial pulse detection. The device is fabricated as a thick film hybrid in a 20-pin single-in-line package allowing optimum circuit board packing density.

Features
Differential to single ended conversion No transformers required Minimum installation space Off-Hook detection and LED indicator drive Dial pulse detection Voltage surge protection

2.1.6 PSTN Phone

Fig 2.9: Block Diagrm of Normal PSTN Phone 16

How telephone works


A telephone uses an electric current to convey sound information. When the two people are talking on the telephone, the telephone company is sending a steady electric current through the telephones. The two telephones are sharing this steady current. But one person talk into telephone's microphone, the current that his telephone draws from the telephone company fluctuates up and down. These fluctuations are directly related to the air pressure fluctuations that are the sound of his voice at the microphone. Because the telephones are sharing the total current, any change in the current through his telephone causes a change in the current through others telephone. Thus as one person talk, the current through other's telephone fluctuates. A speaker in that telephone responds to these current fluctuations by compressing and rarefying the air. The resulting air pressure fluctuations reproduce the sound of the voice.

2.2 SOFTWARE COMPONENTS OVERVIEW


Our project comprises of following software components: 3CX Phone System C language

2.2.1 3CX Phone System


3CX Phone System is a software-based IP PBX that replaces a traditional PBX and delivers employees the ability to make, receive and transfer calls. The IP PBX supports all traditional PBX features. An IP PBX is also referred to as a VOIP Phone System, IP PABX or SIP server.

Calls are sent as data packets over the computer data network instead of via the traditional phone network. Phones share the network with computers and separate phone wiring can therefore be eliminated.

With the use of a VOIP gateway, you can connect existing phone lines to the IP PBX and make and receive phone calls via a regular PSTN line. The 3CX phone system uses standard SIP software or hardware phones, and provides internal call switching, as 17

well as outbound or inbound calling via the standard phone network or via a VOIP service.

2.2.2 C language with Micro-C compiler


The C language compiler used by us was the MICROC of microelectronica. The IDE used by us was the Microc IDE of microelectronica.

Components of the C language such as comment definition, constants definition, variable definition, function declaration, operators usage, program control statements, arrays, strings, pointers, structures, and unions are similar to the ANSI C standards.

Some of the keywords used in the MCC18 language are shown in table.

_asm _endasm Auto Break Case Char Const Continue Default Do Double Return

Extern Far Float For Goto If Int Long Near Ram Volatile While

Short Signed Sizeof Static Struct Switch Typedef Union Unsigned Void Else Enum

Table 2.2: Keywords of Micro-C

The processor-specific library files contain definitions that may vary across individual members of the PIC18 family. This includes all of the peripheral routines and the Special Function Register (SFR) definitions. The peripheral routines that are provided include both those designed to use the hardware peripherals and those that implement a peripheral interface using general purpose I/O lines. The functions included in the 18

processor-specific libraries include Hardware Peripheral Functions and. Software Peripheral Library.

Advantages of C language in embedded systems: 1. It is easier to code and requires less effort. 2. It has many built in functions

Disadvantages of C language in embedded systems: 1. It occupies more memory space. 2. It is inconvenient for time critical applications.(We managed to solve this by

redefining the TCP/IP functionality of our device.)

19

CHAPTER 3 METHODOLOGY

20

3.1 HARDWARE DESIGN IMPLEMENTATION

3.1.1 LCD interfacing

Fig 3.1: LCD Interfacing with PIC18F452

The MCC18 functions are designed to allow the control of a LMV202D LCD controller using I/O pins from a PIC18 microcontroller. The LCD could be used in 4 bit or 8 bit mode. We used the 8 bit mode and display the Phone number, configuration data such as IP, port numbers in configuration mode.

21

3.1.2 Ethernet chip Interfacing

Fig 3.2: Interfacing Ethernet controller Circuit was designed using IIM7010A Ethernet controller, PIC18F452 as MCU and 3.3 V power supply which is designed using LM317.

3.1.3 DTMF Decoder Circuit Design


The DTMF decoder was designed using MT8870 IC as shown in Fig 3.3. DTMF signal output of the PSTN phone is feed to DTMF Decoder. Received DTMF signal is decoded and gives to microcontroller.

22

Fig 3.3: DTMF Decoder Circuit Diagram

3.1.4 Subscriber Line Interface Circuit (SLIC) Design


The following shows the Subscriber Line Interface Circuit designed using MH88500 IC

Fig 3.4: Subscriber Line Interface Circuit Diagram 23

3.1.4 Complete Circuit Design

Fig 3.5: Block Diagram of Complete Circuit

Final design of VoIP to PSTN Converter is shown above. Normal PSTN phone is connected to Converter using RJ11 port. Then the phone is powered by power supply and ring generator. DTMF output of the PSTN phone is decoding using DTMF decoder circuit and fed to Microcontroller. For AD and DA conversion of voice, the 4W/2W converter separate receive and transmit signals. AD and DA conversion of voice is done by using PCMA codec circuit. Sample and quantized digital voice gives to microcontroller. Microcontroller sends that sampled voice data through the network to the destination VoIP client using IIM7010A Ethernet controller and received data is fed to PCM codec circuit for decoding.

24

3.2 PCB DESIGN AND IMPLEMENTATION

Fig 3.6 Top Silk plate of the Converter Units We have used Eagle software for routing and optimizing the PCB design purposes.

25

Fig 3.7: Soldered PCB circuit units

3.3 Output Test Results


The testing of the system was done in two stages. At the first stage each module was tested for their output. DTMF detector was tested for DTMF signals for dialing number. Incoming DC voltage of the telephone during the DTMF signal transmission is 7.0 Volts.

26

The written Mikro-C code was compiled and program to Ethernet controller, which is configure to transfer the SIP and UDP packets to the Computer with 3CX VoIP server. Then sent and received packets were analyzed in a client computer using the Wireshark network analyzer software tool. The following shows the output.

Fig 3.8: Captured SIP packets using Wireshark software tool Power supply unit was designed to get +3.3, +5, -5 and +24 Volts, and supplying to Ethernet controller, all the ICs, Codec IC and PSTN phone respectively. Measured output voltages are within 0.05 V. The voltage levels of the each output pin of the DTMF receiver IC were measured when dial the push buttons in normal PSTN phone. The values were within +3.6V to 5.0V. The second stage of the testing was focused to the system compatibility and performance when adding all the units to the main control unit.

27

CHAPTER 4 PERORATION

28

4.1 PROJECT TIMELINE


The project passing through the phases: Research, Analysis, Design (Simulation and Hardware), Testing and Maintenance and Documentation. The Gantt chart of our project is shown below.
Week Number ( 26-01-2009 --- 09-08-2009 )
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

1 Submit Project Proposal 2 Initial Literature Survey 3 Cost Estimation 4 Acquiring Components 5 Project Design & Simulation 6 Project Implementation 7 Testing 8 Error Handling 9 Develop a Finish Product

Fig4.1: Gantt chart: VoIP to PSTN Converter

4.2 PROJECT COST ANALYSIS

Item Computer Centre and LAB usage Component cost Cost of professionally skilled persons (Rs 250 Per hour) Cost of supervisor (Rs 2000 per hour) Total cost

New Year Vacation

Cost Rs. 31 500.00 Rs. 10 000.00 Rs.90 000.00 Rs. 28 000.00 Rs. 149 500.00

29

4.3 PROBLEMS FACED


Some major components of our project were not avialable in the local market so it needed to get them from the manufacturers abroad. Also the cost of buying each component was far too behind our budget. Because in course of our working process the probability of getting components damaged cannot be ignored. And also that it cannot complain the manufacturer if components are received with damages. Time was another important factor. It needs to order components by keeping adequate time margin for successful completion of our project. The code for microcontroller was to be written using C language. But the working environment of MICRO C was quite different and we do need to work bit to get familiarize with. There is no way to test our codes on PC using simulation because of components such as IIM7010A Ethernet controller is not available in simulation software. So the hardware module could result in the destructive effects because of continuous usage for testing. So it needs to have proper simulation software for that purpose. But to get the relevent and reliable simulation software which provide the facility of simulating our components and that to free was really a tough job.

REFERENCES
1. 2. 3. 4. 5. 6. IIM 7010A Data Sheet W 3100 Data Sheet

Carrier Grade Voice over IP Second Edition - By Daniel Collins ITU-T Recommendation Q.23, Q.24 & Q.25 Series Data and Computer Communication (8th Edition) by William Stallings
Papers about Telephone ringing circuits and Telephone line audio interface

circuits by Tomi Engdahl (1996-2001)

30

You might also like