Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact

Online coding site: Ancient Brain

coders   JavaScript worlds


CA170      CA2106      CA686      CA686I

Online AI coding exercises

Project ideas

Physical Layer

  Analog v. Digital

Errors: General problems with signals

Manchester encoding



Phone lines

Coaxial cable

Fiber optic


Power line communication


Analog v. Digital

  1. analog
    • Continuously variable signal.
    • Small fluctuations in the signal are meaningful.
    • Lot of errors with noise over long distance.
    • Used for phone call: A certain number of errors may not matter much with speech.

  2. digital
    • Only n values (e.g. just 2 values).
    • Small fluctuations in the signal are not meaningful. Analog signal is quantised. Any signal close to a particular value will be interpreted as that value.
    • Less errors with noise over long distance.
    • Used for computer data: A single bit wrong would be disaster.

2.1 Changing voltage (or other analog property) on a wire

This is applicable primarily to:
  1. Phone line
  2. Broadband phone line
  3. Coax cable
Some different but similar issues with:
  1. Fiber optics
  2. Wireless

Changing voltage to represent digital 0,1

X-axis is time.
Y-axis is voltage.

Any 2 separate values will do (to map to 0,1).
Don't have them too close so hard to measure at other end.

Higher frequency means higher bandwidth

Can send more 0s and 1s in shorter time.

Period - repeats every 1/n sec.
Frequency - n Hertz (n per sec).
Here: Frequency = rate of change of voltage.

Sines or cosines alone would just encode 010101..

Any single sine function:
A sin(B*x) + C
or cosine function:
D cos(E*x) + F
can only represent one pattern:
Strict alternating 010101...

Adding sines and cosines to represent any pattern

Fourier showed you can approximate any reasonably behaved continuous periodic (arbitrarily long period) function with a combination of sines and cosines:


+ b1 sin(c1x)
+ b2 sin(c2x)
+ b3 sin(c3x)
+ ...

+ d1 cos(e1x)
+ d2 cos(e2x)
+ d3 cos(e3x)
+ ...

We want to send some data pattern (e.g. 000010011110100010000011). This is always of finite length. We just imagine it as a repeating pattern of period this length. (Only going to receive the pattern for a finite window.)

The more terms used the better the approximation.
We won't go into detail of what the terms are here.


Modulator (converts digital to analog signal) actually does do an addition like this.

n oscillators (inside the modulator) change voltage on their separate output lines with different f's, periodic.
These n output lines are combined and in the combination the voltage is summed. Summed voltage is output from modulator.


This nearly (but not quite) encodes 0 (start at x=6) 110 0100 (then repeat).
Not there yet. Need more terms.
i.e. encode 0110 0100 in small interval (ASCII char "d").

Higher frequencies means more accuracy in shorter time.

Better example

Transmitting 01100010 (ASCII char "b").

As we go down, we're using higher frequencies (along with the low ones).

Higher frequencies means more accuracy in shorter time.

Errors: General problems with signals

Signals have problems with long distance and random errors.

  1. Attenuation - Signal loses energy with distance. Different frequencies lose energy by different amount, so the actual signal is distorted.

  2. Delay distortion - Different frequencies propagate at different speeds in the wire, so over long distance the signal is distorted.

  3. Noise - Thermal noise in a wire. Interference from other wires. Spikes in power.


For problems 1. and 2.:

For all of them:

Limited f

Each cable has a hard limit on the frequencies it can transmit.
Usually, from 0 to some cut-off point n Hz will be transmitted with little distortion.

This is a limit on bandwidth: On the amount of data that can be represented (and hence transmitted) accurately in a short time.


Bandwidth of a medium = The range of frequencies that pass through it with minimum attenuation.
It is a physical property of the medium.
Usually from 0 Hz to n Hz.

Bandwidth also used to refer to data-carrying capacity of the medium in bits-per-second (bps).

High f bandwidth means high data bandwidth.

De-modulator (Samples / sec)

At the receiving end, the receiver (the Demodulator) samples the line n times per second to read the signal.

Nyquist–Shannon sampling theorem: For any given bandwidth (i.e. range of frequencies) it is pointless to sample the line more than some constant times per second, since the higher f's such sampling could recover have already been filtered out.

4.3.2 Manchester Encoding

Problem: Sender and receiver running at different speeds. Receiver sampling speed not quite the same as sender output speed. Get out of synch about where the bit boundaries are, especially after long run of consecutive 0s or long run of consecutive 1s.
e.g. 106 1s in a row read as 105 1s, or 107 1s.

Solution: Manchester Encoding. - (b) below.
Each bit covers 2 time slots.
1 bit: Voltage high in first slot, low in second.
0 bit: Low, then high.
Every bit period has a transition in the middle - making it easy to spot them.

Differential Manchester encoding - (c) above
1 bit: No transition at start of interval.
0 bit: There is a transition.
In both cases, there is transition in middle as well.
Better noise immunity.

Manchester encoding used in Ethernet. You use it every day. I am using it now (in lecture).

2.2 Transmission media

  1. Guided - Copper wire, Fibre Optics
  2. Unguided - Wireless

2.2.1 Magnetic Media

Removable media - Magnetic tape, CD-RW, recordable DVD

Magnetic tape - IBM offers systems up to 5 petabytes.

You would never use these to move information about in your network, would you? Copy to removable media and just drive it across in a van??
A. Maybe yes.
In book, he gives example of a company that wants to back up say over a terabyte of data to another city, or even just another machine.
A machine 1 hour away by road can be backed up at in effect 400 Gbps.
Even 1 continent away (FedEx) can be backed up at in effect 20 Gbps.
Cost 3 cents per gigabyte.
No network can match this high speed or low cost.
(Though fiber optics are getting there. If have single dedicated leased line.)

Obviously, you can't use these for real-time interactive (on-line) network.

2.2.2 Phone lines

2.2.3 Coaxial cable

2.2.4 Fiber optic

2.3 Wireless

Power line communication

Power line communication


Li-Fi: Transmit information using subtle high-speed changes to visible light.
Cannot penetrate walls. Only within a single room.
But a number of advantages. (And lack of penetration of walls is also an advantage from the security view.)

2.5.4 Multiplexing

On telephone backbone.
  1. Frequency Division Multiplexing - Frequency spectrum divided into bands. Each user has exclusive possession of a band.

  2. Time Division Multiplexing - Users take turns. Round-robin. Each gets entire bandwidth for short burst of time.
    e.g. T1 line (a popular leased line).

  3. Wavelength Division Multiplexing - FDM on a fiber optic cable. Up to 1 T bps.

2.5.5 Switching


What route through the network does my data take?

  1. Fixed routing (e.g. shortest path).

  2. Virtual circuit - path fixed for duration of session from A to B.
    • B receives messages in order.

  3. Dynamic routing - messages assigned whatever paths are free. When traffic jams, traffic flows down duplicate paths.
    • Often goes longer physical distance but that doesn't matter if avoids routing bottlenecks (queues on an overloaded machine are what slows messages down).
    • B may receive messages out of order - has to reassemble them.
    • Can survive total loss of a node. Traffic routes around, automatically adjusts.
    • e.g. Internet.
    • Note because Internet is only partially-connected (variable-resolution), sometimes there may not be alternate routes. i.e. Fixed routing for some of journey, dynamic for rest.

Q. What is the shortest route?

  1. Model the network as a mathematical graph. Shortest route is the one with the least number of nodes/links?
    Not necessarily. Depends on bandwidth, traffic and machine loads on route.
    Might be better to send it on roundabout route (through more machines) if gets there quicker.

  2. Model the network on geographical distance. Shortest route is the one that travels the least geographical distance?
    Not necessarily. Depends on bandwidth, traffic and machine loads on route.
    Might be better to send it on roundabout route (long distance) if gets there quicker.

As traffic and machine loads keep changing, the answer to what is the best route keeps changing.


Does my communication session own all of the bandwidth on the route, or is it shared?

  1. Circuit switching - Part of network set up as temporary link between A and B.
    • No other site can use this link until call finished.
    • e.g. Telephone:
      • Used to be simple electrical circuit in switching office.
      • Situation more complex now because parts of the path may include fiber or microwave link onto which thousands of calls are multiplexed.

    • Takes time to set up path before call can start. e.g. Could spend 10 seconds hunting for path on long-distance call.
    • Congestion at setup time (sometimes can't establish circuit). Not thereafter (bandwidth reserved).
    • Guaranteed service.
    • Wastes resources of network (circuit reserved, not being used 90 percent of time).
    • Transparent - The 2 ends can use any protocol. Voice, data, fax. The carrier does not need to know.
    • Charging - per minute. In Ireland, local calls were flat rate - until modems became popular!

  2. Message switching - Store-and-forward of arbitrary-size items. Message sent in its entirety to first switching office (router). Then passed on to next. And so on, until gets to destination.
    • Ancestor of packet switching.
    • Problem - A large message could tie up a router-router line for minutes.
    • Solution - packets.
    • Basically store-and-forward systems (e.g. email, usenet) are actually now implemented on packet switching underneath.
    • Not used any more.

  3. Packet switching - Store-and-forward of small, fixed-size items. Each message is divided into small fixed-size packets that (like pages in memory and blocks on disk) "flow" into whatever links can take them to, or just nearer to, the destination.
    • Mixed in with packets from other messages and other sites.
    • No user can monopolise a line for longer than a fraction of a second.
    • Each site routes all incoming packets as best as it can on towards their destination, or to a site which it thinks should be able to send them there.
    • Adjusts to traffic.
    • Packets may follow different routes.
    • Packets may arrive out of order. Message needs to be re-assembled at far end.
    • e.g. Internet, Ethernet, newer mobile phone networks.

    • No congestion at setup time (can send packets straight away). But congestion may occur at any time when packets are sent (bandwidth not reserved).
    • Not-guaranteed service.
    • Doesn't waste resources of network (network used to max).
    • Suitable for non-real-time (email) or not-quite-real-time (web) data.
    • Causes trouble for real-time data (Internet audio, video, radio, TV, Internet phone). Packets arrive out of order. Get delays in the audio/video as wait for packets.
    • Not transparent - The carrier determines the protocol used.
    • Charging - per volume of data carried. ISPs often charge customer flat rate (*) to save admin but ISP itself may be paying by volume of data.
      (*) ISP customer usually limited to max transfer volume per month.

Packet switching

Another comparison. See 5.1.5.

ancientbrain.com      w2mind.org      humphrysfamilytree.com

On the Internet since 1987.

Note: Links on this site to user-generated content like Wikipedia are highlighted in red as possibly unreliable. My view is that such links are highly useful but flawed.