16
Department of Electrical and Computer Engineering 332:428 Communications Capstone Design Spring 2013 Senior Project Final Report Brien Range Daniel Townsend Prince Mingle Wyatt Borden January 30, 2012

Senior Project Final Report

Embed Size (px)

DESCRIPTION

Rutgers School of Engineering Electrical Computer Engineering Senior Project TDMA Network Final Report

Citation preview

Page 1: Senior Project Final Report

Department of Electrical and Computer Engineering

332:428 Communications Capstone Design Spring 2013

Senior Project Final Report

Brien RangeDaniel TownsendPrince MingleWyatt Borden

January 30, 2012

Page 2: Senior Project Final Report

Contents

1 Introduction 1

2 Technical Specifications 1

2.1 System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2.2 Modem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.2.1 Level Shifter [1] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.2.2 Modulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2.3 Demodulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3 Modem API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3.1 Multiplexing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3.2 Demultiplexing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3.3 TDMA: Multiplexing Transmitters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Cost Analysis 10

4 Future Work 10

5 Roles of Each Member 11

5.1 Brien . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5.1.1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5.1.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5.2 Dan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5.3 Prince . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

5.4 Wyatt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

A Equipment Cost 13

Page 3: Senior Project Final Report

1 Introduction

The goal of this project was to create a multiple access data network. A two sender-one receiver sys-

tem model was implemented by manually constructing three amplitude-shift keying modems with a carrier

frequency of 400 kHz and coding a multiplexing scheme in the C programming language. Each node in the

data network was a laptop connected to a modem board via an RS232 to USB adapter, allowing serial data

to be modulated to the carrier frequency. The goal was to connect the system to a power line to enable low

speed data transmission between devices. However, this was not achieved within the allotted time.

2 Technical Specifications

2.1 System Overview

The structure of the system centers around a single receiver node and multiple transmitter nodes. Each

transmitter and receiver node has its own modulator and demodulator. In the receiver, the modulator is

used to synchronize the two transmitters, and the demodulator is used to recover the data sent by the

transmitters. In each transmitter, the modulator is used to send data to the receiver, and the demodulator

is used to receive a timing signal from the receiver. The system was designed with two senders and a single

receiver in mind as shown in Fig. 1, but with more resources, the transmitter count could have been increased

quite easily.

Figure 1: The block diagram representing the system design.

The two colored lines in the block diagram represent the timing wire (green) and the data wire (red).

Since there was some loading effect being caused by the modulators, attenuating the received data signal,

it was decided to separate both the timing and data wires. Each pair of modulators and demodulators are

1

Page 4: Senior Project Final Report

Figure 2: The circuit used to interface the RS232 and TTL logic types of the system [1].

connected to a laptop through a circuit known as the level shifter, that converts TTL voltage levels to RS232

voltage levels. The laptops connected to the transmitters send data to the receiver laptop, and the receiver

laptop sends timing signals to the transmitter laptops. Each transmitter has the capability to multiplex with

the other laptops as well as multiplex data from individual programs on the laptop. This enables multiple

programs or users on each device to access the channel and send information to the receiver.

2.2 Modem

Every device in the system is connected to a modem, and each modem consists of three parts. Each of

the three parts of the modem – level shifter, modulator, and demodulator – are outlined and explained in

the subsections below.

2.2.1 Level Shifter [1]

The level shifter is a circuit used to invert and shift the digital signal coming and going to and from the

RS232 ports on the laptops. This is required because the output levels of the RS232 adapter are between

−6 V and +6 V, and the required voltages of the designed modulator and demodulator are between 0 V and

5 V. For the level shifter to work both pin 2 and 3 of the RS232 port need to be connected to the circuit,

otherwise the required voltage levels can not be achieved.

The conversion from RS232 to TTL works by turning the NPN transistor on and off. When the base

voltage is high (+6 V at the RS232 transmit), the NPN transistor turns on, which sets the TTL output to

ground. When the base voltage is low (−6 V at the RS232 transmit), the NPN transistor turns off, which

sets the TTL output voltage to 5 V.

The conversion from TTL to RS232 relies on the negative voltage supplied by the RS232 receive to

2

Page 5: Senior Project Final Report

Figure 3: The circuit diagram for the modulator circuit. The CD4016 is a CMOS switch which allowsanalog signals to be sent through based on an input command.

be stored inside of a capacitor. When the base of the PNP transistor is low (0 V at the RS232 input), the

transistor turns on which allows the 5 V to travel to the RS232 receive. When the base of the PNP transistor

is high (+5 V at the RS232 input), the transistor turns off which allows the −6 V inside the capacitor to

show up at the RS232 receive.

Through these methods the conversion circuit applies a voltage shift and an inversion to the incoming

and outgoing signals which suits the needs of our system perfectly.

2.2.2 Modulator

The modulator circuit consists of very few components, which perform the modulation of the device

quickly and reliably. The main component in this setup is the CD4016 CMOS Bilateral Switch.

The CD4016 integrated circuit has four separate switches. Each switch has an input, an output, and a

control. When pin 13 is high, pin 1 is connected to pin 2, and when pin 5 is high, pin 3 is connected to

pin 4. To ensure that either the connection between pins 1 and 2 or the connection between pins 3 and 4

are shorted at all time, and neither are shorted at the same time, the data signal is sent to pin 5 and an

inverted data signal is sent to pin 13 . Since pins 2 and 4 are connected, a high voltage will produce a zero

volt output, and a low voltage will produce a 400 kHz sine wave. Through this switching an OOK signal is

generated.

The last stage of the modulator is the amplification circuit. This is simply an inverting operational

amplifier gain circuit which gives a theoretical gain of ≈ 30. In practice, this gain circuit does not produce a

gain of 30, because the operational amplifier has a frequency response of its own and attenuated our OOK

signal..

3

Page 6: Senior Project Final Report

Figure 4: The circuit diagram and block diagram for the demodulator circuit.

2.2.3 Demodulator

The demodulator circuit consists of several steps, each outlined in the diagram shown in Fig. 4. The

first stage of the demodulator is the high pass filter. This circuit was originally designed to filter a second

frequency in a FSK modulation scheme; however, it proved useful to filter out low frequency noise from the

channel. A majority of the channel noise was focused around low frequencies around 100 kHz.

The second stage of the demodulator is necessary because although the LF347N Operational Amplifier

advertises a bandwidth of 4 MHz, it actually attenuates frequencies above 300 kHz. Therefore the OOK

signal needs to be amplified again, which is why the second stage is present.

The third stage of the demodulator is a very important step in demodulation. This stage takes the

filtered OOK signal and recovers the outline of the signal, meaning where the amplitude of the OOK signal

is high, the output is high, and then the amplitude of the OOK signal is low, the output is low. This is

accomplished by using a diode connected to a RC circuit whose time constant is designed so that the output

does not return to zero during a high. A sample input output reading for this stage is shown in Fig. 5.

The fourth stage of the demodulator takes the noisy envelope detected in the previous section and creates

a more square like shape for the final stages of the receiver which is also at the required TTL voltage levels

(0 V to 5 V). This device is known as a Schmitt Trigger.

The schmitt trigger consists of a comparator, a voltage divider, a feedback resistor, and a pull up resistor.

The comparator inputs are the envelope detector output (at the negative terminal), and the voltage divider

which provides the reference voltage (at the positive terminal). The feedback resistor provides hysteresis by

4

Page 7: Senior Project Final Report

Figure 5: A sample of the waveform before the envelope detector (yellow) and after the envelope detector(blue). The data rate of the system is 58600 baud/s in this oscilloscope screenshot

actually changing the reference voltage. The pull up resistor allows the output to be set to 5 V when the

collector inside the comparator is open.

2.3 Modem API

2.3.1 Multiplexing Data

Program Access to Modem

The system is capable of multiplexing up to 5 separate applications at one time. Each application is

manually assigned one of five names, null, audio, messaging, misc1, and misc2. These application channels

differ only in these application strings and the headers assigned to them; in other words, there is no require-

ment that only audio applications be sent over the audio channels. These applications use only two functions

to interact with the system: modem read() and modem write(). No other functions are transparent to the

user applications. The function modem read() allows the user application to read from a shared buffer, and

modem write() allows the user application to write to a shared buffer.

5

Page 8: Senior Project Final Report

Figure 6: The separation of individual programs within a computer and how they access the data buffer.

Modem Object

A modem client was created to manage requests to send data over the modem. Upon initialization of

the modem object, two static buffers are created for each application. One is created to maintain data to be

sent to the modem, and the other is created to maintain data to be received from the modem. These buffers

persist whether the applications tied to them are running or not.

Figure 7: Flow Chart for how senders transmit data.

6

Page 9: Senior Project Final Report

Figure 8: Packet sent over serial port

After initialization, two software threads are started: one to monitor the modem’s serial port for received

data, and another to monitor the transmit buffers for data ready to be sent over the serial port’s transmit

line.

Multiplexing and Transmitting Data

The modem object monitors the five transmit buffers in a round robin, using the function RR read write().

If there is data for the current application, and that data is greater than seven bytes, the algorithm to package

the data is initiated. Otherwise, the next application is checked.

Each application name has a corresponding header associated with it. This header is prepended to the

seven bytes, and the completed packet is then transmitted over the serial port.

At the serial port level, a standard baud of 57600 was chosen. At the next standard baud, 112500, there

was significant data loss over the modulated channel. Because the same serial port is used for both transmit

and receive directions, this baud pertains to both.

2.3.2 Demultiplexing Data

Receiving and Demultiplexing Data

The modem polls for any data written to the serial port from the demodulator and writes it to a large

temporary buffer. It then reads bytes from the buffer, and if a header has not yet been read from the

buffer, these bytes are then discarded. If the byte read is one of the five headers, then the header byte is

stripped away, and any subsequent bytes are written to the shared read buffer that has the application that

corresponds to the acquired header.

Figure 9: Bitsream read from serial port

In a separate user process, the user applications can read from these shared read buffers using the function

modem read().

7

Page 10: Senior Project Final Report

Figure 10: Program Data Demultiplexing

2.3.3 TDMA: Multiplexing Transmitters

This system has 2 transmitters and 1 receiver sending data at a carrier frequency of 400KHz. In this

scheme, the algorithm that is being used allows for data to be sent for the duration of a slot that lasts T

seconds. A buffer time u, a function of serial baud rate, exists such that u << T . This u exists to guard

from collisions between one round and the next.

Prior to the setup of our transmitters, Sender 1 and Sender 2 will be allocated a slot N, where N is either

0 or 1. The single receiver is master controlling node, sending a timing pulse to the two transmitters. The

transmitters will wait for a jamming signal from the receiver with a length of a byte before either sender

begins any transmission. However, each sender will be transmitting at a different slot. Sender 1 will first

send from t1 = u→ t1 = T − u. Sender 2 will then send from t2 = T + u→ t2 = T + T − u.

Sender 1 and 2 will then transmit again for another round, for M rounds. Such that tMN = tM−1N + 2T .

Below is the formula in general form.

(2M + N) + u < tMN < (2M + N + 1)T − u

After the specified M rounds, the transmitters will wait for another timing signal.

As the original intent of the system was to transmit voice data, it was decided to not have any type of

packet acknowledgement. This choice greatly simplifies data transmission, and allows for much higher data

rates than a system with packet acknowledgement.

8

Page 11: Senior Project Final Report

Figure 11: The timing diagram of how two devices access the single channel.

9

Page 12: Senior Project Final Report

Figure 12: Multiplexed Signals from Sender 0 and Sender 1

3 Cost Analysis

The parts listed in the appendix below ranged from several amplifiers, resistors, capacitors which all

together cost $49. The competion price is typically $130 per node for a wireless sensor network which means

that our system will be cheaper to implement [2].

Based upon electronic markups being normally 80% of total cost, the price of $49 that we paid would

actually cost $9.80 (20% of 55dollars). If we were to manufacture this project, we would have it on one

printed circuit board that would consist of all of the parts in the Appendix below with the exception of the

RS232 cable. If we were to obtain a prototype from an external vendor such as Silvers circuits, the cost for

a prototype would be $75 [3]. However, given that the markup cost is 9.80, we would either attempt to do

it ourselves or find a cheaper alternative.

4 Future Work

Currently the implementation relies on the lab’s power supplies to create the supply voltages for the

amplifiers and ICs. It also relies on the lab’s function generators to supply the 400kHz signal. A shippable

product would require a DC power supply which gives the 5V used by the logic circuits and the ±20 V used

by the amplifiers. The project would also require its own 400 kHz oscillators circuits.

Each modem requires different physical channels for their transmit and receives lines, as the group was

unable to solve the loading problem as discussed in the System Overview section. By properly increasing

the impedances of the modulators, they will not draw as much current away from the demodulators. Then,

the signal will be strong enough to recover data.

Some applications may have different quality of service requirements than others. Neither guaranteed

10

Page 13: Senior Project Final Report

bit rate nor timeliness were considered during the implementation. However, both should be considered if

or when this project is visited once more..

If another device is added to the network, the code to accommodate a new transmitter must be added

manually. A better product will sense a new modem on the network and adjust accordingly. During

initialization, the device can request serial numbers from any connectected members from some time period,

and then respond with a maximum N value (as described in the TDMA section) and a specific N value for

each serial number.

The large buffer time of 28, 612 µs greatly reduced the data rate achieved (24.6kbps), but given the time

constraints, it was quickest way to ensure there were no collisions. A better implementation would have a

smaller buffer time and less rounds between time signals to ensure no drifting.

Another aspect to view for future work is the applications that would be valuable to use a power line

sensor network. For example, this network could work in conjunction with a wireless sensor network to help

detect unwanted presence as used in home and office security systems.

5 Roles of Each Member

5.1 Brien

5.1.1 Hardware

I designed the original BPSK modulator circuit that Dan Townsend modified to suit our OOK imple-

mentation. I also designed the level shifter circuit that translated voltages between the RS232 logic and the

CMOS logic.

5.1.2 Software

I created the RS232 interface that would directly communicate with the modem. I designed and imple-

mented the Modem API that allowed the multiple programs to interface with the modem concurrently. I

also designed and implemented the network’s TDMA scheme. Although audio was eventually dropped from

the project, I implemented and tested mu-law compression software.

5.2 Dan

I designed the demodulator portion of the modem. I worked closely with Prince in the lab to actually

create the hardware used. I came up with a compact layout for each component on the breadboard so all

three components could fit on a single breadboard. I breadboarded the three individual modems. I worked

on many Multisim simulations for the project including a simulation of the now defunct FSK modem and

wall adapter.

11

Page 14: Senior Project Final Report

5.3 Prince

I was in charge of constructing the modulator that we used to supplement the demodulator that was

being built by Dan. When using both components together, it eventually will be known as the modem.

While working closely with Dan on figuring out design layouts to place on the breadboard, this portion of

the modem was built to convert the data that was coming out from the RS-232 cable, which is connected

to a sender node, into a digital output that would be sent over to the demodulator for it to be converted

back into an RS-232 signal at the receiver node. I also built the wall adapters, and worked with Dan on an

attempt to measure and observe the noise characteristics within the walls of the EE building. The purpose of

that was to gain an understanding of how the randomness of the noise through the wires that run within the

walls of the building would affect our ability to get data sent over the powerlines as we originally intended

for this project. Unfortunately, this attempt was not successful and with time constraints we were never

able to understand why.

5.4 Wyatt

When this project originally started, my role was to get a sampled audio signal connected to the modem.

The original plan was to use a raspberry pi along with a Gobbler Pi Kit and ADC chip to produced a

digitized signal that was sampled at 10 khz. However, it was evident based upon the microphone purchased

that it had a sampling rate of 8 kHz which satisfy the Nyquist Criterion.. However, due to time constraints,

the audio was not successfully implemented and I spent the remainder of the time helping with the RS-232

connections from the laptops to the transmitters.

12

Page 15: Senior Project Final Report

A Equipment Cost

Part Name Quantity Cost per Unit Total Cost

Sabrent CB-RS232 1 13.10 13.10

IN3904 NPN Transistor 1 0.05 0.05

IN3906 PNP Transistor 1 0.05 0.05

IN4148 Diode 1 0.75 0.75

IN914 Diode 1 0.75 0.75

LF347N JFET Operational Amplifier 2 2.00 4.00

CD4016 CMOS Quad Bilateral Switch 1 0.30 0.30

LM7404 Hex Inverter 1 0.85 0.85

LM 393 Dual Differential Comparators 1 0.20 0.20

82 pF Capacitor 5 0.30 1.50

10uF Capacitor 1 0.25 0.25

1 Kohm Resistor 8 0.40 3.20

6.2 Kohm Resistor 2 0.40 0.80

6.8 Kohm Resistor 2 0.40 0.80

8.2 Kohm Resistor 2 0.40 0.80

12 Kohm Resistor 1 0.40 0.40

30 Kohm Resistor 1 0.40 0.40

39 Kohm Resistor 2 0.40 0.80

Total 29.00

13

Page 16: Senior Project Final Report

References

[1] ”TTL to RS232 Adaptor Explained.” Hobby Microcontrollers and Electronics. (mu)C Hobby, n.d. Web. 01

May 2013. <http://www.uchobby.com/index.php/2007/06/11/ttl-to-rs232-adaptor-explained/>

[2] Beigl, Michael, Albert Krohn, Till Riedel, Tobias Zimmer, and Christian Decker. ”Parts: Low Cost

Sensor Networks at Scale.” Karlsruher Institute of Technology,Web. <http://www.teco.edu/~cdecker/

pub/beigl-uparts.pdf>

[3] <http://www.custompcb.com/>

14