# 1. Physical Layer
This layer is responsible for the actual physical transfer of data between devices via cables or other mediums using switches, routers, etc..

This layer also converts the data into a bit-stream of 1's and 0's. 

The signal convention must be the same on both devices. (Meaning of a 0 and a 1)

## In depth
Information on computers is stored in a digital format. To transmit this information we have to convert the information to signals.

Physical layer is responsible for this conversion. The Physical layer deals with the actual physical transmission of electrical signals.

You could say the physical layer is a bridge between real life and software.

## Waves
Waves, like you would see on a lake, or in electrical cables are made when a physical quantity changes in the form of a moving ridge.

Waves by them self store no real information.

## Signal
A signal is a wave (carrier) that holds information. (wave + data = signal)

The carrier is a type of wave we add our information to. In most cases a sine wave is used as a carrier wave,

![[encoder.png]]

A encoder converts analog or digital information in signals that can be transmitted across different [[Comminucation Mediums]]

The process of adding data to a carrier wave is called Modulation

## Modulation
Adding data to carrier waves is called modulation.

This can be done in 3 different ways.

### Amplitude
![[modulation-amplitude.png]]

Amplitude or the strength (height) of a wave changes over time.

### Frequency
![[modulation-frequency.png]]

Frequency is the amount of waves that pass a fixed point in a given amount of time.

### Phase
![[modulation-phase.png]]

Phase specifies the location or timing of a point within a wave cycle of a repetitive waveform.

![[modulation-phase-2.png]]

## Analog
**Analog Signals** can have a infinite number of possible values in a range.

For example: 0.0 <-> 1.0
- 0.1436367436473......
- 0.54454764654765......

**Analog data** is continuous and have continuous values. 
Values in analog data are always changing.

A good analogy for analog data is like a physical (analogue) clock with hands.
The hands on a clock like that are always moving (continuous) and do not have a specific value.

## Digital
Digital data is information represented as a string of discrete symbols each of which can take on one of only a finite number of values from some alphabet, such as letters or digits.

For example:
- a
- b
- 1
- 0

These values are specific and are not changing.

## Transmitting Impairments

Signals most often have to deal with problems during transmission. Problems like this are called transmission impairments.

Important transmission impairments are:

### Attenuation

Attenuation is the strength or amplitude of a signal is decreasing over time and distance. 

A good analogy for this would be the loss of volume you would hear from a speaker the further you are away from it.

![[attenuation.png]]

This makes is more difficult to correctly capture the signal on the receiving end.

We can solve this issue by dividing the communication line up in smaller segments and amplify the signal between segments.

### Distortion

![[distortion.png]]

Distortion is the change that occurs in a signal that affects how the signal looks.

For example talking to someone while behind a thick glass pane changes how you sound on the other side.

We can solve this by using a lower bit rate. Bit rate is kinda like the information per second. This way the signal is less susceptible to distortion.


### Noise

![[noise-signal.png]]

Noise is when data is added to a signal and therefore changing the data itself.

Analogy for this when you are listening to someone talk and somebody else is talking at the same time trough your conversation.

We can solve this by using a stronger signal (bit like talking louder).
This will reduce the impact noise has on the signal.

This is also called signal to noise ratio (SNR)

## Transmission Media
These signals are send through a transmission medium.  A transmission medium is a physical object that can carry the information from source to destination.

Transmission mediums are often space (air), metallic cable or fiber optic cables.

Transmission media are divided in 2 groups.

### Guided media
Guided media like cables provide a conduit from one device to another.
I like to think of it as you can steer the signal by moving the cable for example.

Coaxial cable, twisted pair cable and fiber optic cables.

![[type-cables.png]]

### Unguided media
Unguided media transport electromagnetic waves without using a physical conductor.

This is called wireless transmission. (Technically using the air around you as a conductor)

Signals are broadcast tough space and thus available for everyone to pick up.