## Saturday, 20 July 2019

### Encoding Signals

Well, now that we have looked at how we turn sound into numbers, or computer data, lets see the methods that we can use to actually transfer this data from one point to another. Well, when it comes to sound you can shout, but the thing is that there is only a certain distance that the sound can reach before it becomes almost impossible to hear.

Let us use the example of a message. Say we write a message down on a sheet of paper. Now, there are a number of ways we can send that message. Obviously you could hold it up, but that wouldn't be all that good since you will need to be pretty close to be able to read it. Secondly you could throw it, but if you have ever attempted to throw a piece of paper, you probably know how futile a task that is. Well, you could screw it up and throw it, but that would increase the distance only slightly. The next option is to turn it into a paper aeroplane. Well, that might actually increase the distance, depending on a lot of factors such as wind, and whether it is raining. The final method would be folding it up, placing it in a envelope, and putting it in a letter box. From there it gets placed on a motorcycle, and depending on the destination, even on a plane. Well, it looks as if we can now send our message a considerable distance.

You might be wandering why I went through that example, and honestly, I am sort of wandering about it myself, though I do tend to have this ability of rabbiting on about nothing in particular, except that there is a method to my madness. As you can see, a message in its basic form can't really travel all that far, however if we attach it to something else, such as a motor bike, or a plane, then suddenly this message can travel, comprehensively, a lot faster. This is the same when it comes to data. One of the terms used when it comes to attaching data to a signal is modulation, another term is encoding. Actually, encoding is a term used more for digital data, since it is a way of mapping the digital data, that is made up of 0s and 1s, onto a signal, and there are a number of ways to do this.

Actually, encoding will output a digital signal, while modulation will output an analog signal. This usually occurs where the medium that is transporting the signal can only handle analog signals - wires are an example of this. We also have a couple of other things I should mention:

Unipolar: This is where the signal exists in a single state, either positive or negative.

Polar: This is somewhat different, in that the signal changes state based upon the logic value of the data. So, a 1 might be positive, and a 0 might be negative.

Differential Encoding: This occurs where the data bits are represented by changes between the elements as opposed to elements themselves. An example would be where a 1 represents a -ve to a +ve change, which a 0 represents a +ve to a -ve change.

Ratio: This refers to the number of data elements that are carried by a single signal element. The table below should be helpful in this regard.

#### Digital Data, Digital Signals

Now, this is where the fun begins. There are a number of ways to transmit digital data, and we will be looking at a few of them, as well as including a number of diagrams. I think that a list might be better here:

• Return to Zero: There are three voltage levels, +ve, -ve, and zero. The signal returns to zero in the middle of the pulse, and is either high to zero, or low to zero.
• Non-return to Zero: The signal doesn't return to zero in the middle of the pulse, though there are a few ways that it can be done:
• Non-return to Zero Level (NRZ-L): here we have 0 as the high level, a 1 as the low level.
• Non-Return to Zero - Invert on Ones (NRZ-I): Here if the signal is a 0, there will be no change, but if the signal is a 1, then it will invert. This occurs at the beginning of the signal.

With the Non-Return to Zero, both are easy to implement, but the problem is that there is no synchronisation, and there is no error correction. Further, there is a lot of needless changing.

Biphase Encoding
The difference here is that each of the segments has a transition in the middle, which is a means of self clocking and synchronising. The transitions at the period boundary do not mean anything, there are only there to place the signal into the correct state.
•  Manchester: This is a mix of return to zero and NRZ-L. For a zero it transitions from high to low in the middle of the segment, and the opposite for a one.
• Differential-Manchester: This combines the RZ and the NRZ-I. Basically at the beginning of the segment there is no transition for a 0, and a transition for a 1.
The benefits is that they have only two voltages, +ve and -ve, they allow for self clocking. The problems is that once again there is no error checking, there is no functionality for DC (direct current), and the multiple changes require a wider bandwidth.

Bipolar Encoding
Here we have three voltage levels, +ve, -ve, and 0 to represent our bits. There are two forms: Bipolar Alternate Mark Inversion and and Psuedoterenary.
• Bipolar AMI: 0 represents no line, or a zero voltage, while 1 is either a +ve or a -ve. The voltage alternates for successive ones.
• Pseudoterenary: Well, this is basically the opposite to the above.

#### Analog Data, Digital Signals

This is the process of turning analog data into a digital signal, otherwise known as digitisation. The benefits for this are numerous, including that there being no need for an amplifier, but rather a repeater. Amplifiers are problematic since while they can amplify the signal, they also have this habit of amplifying any noise that is with the signal. In fact it allows more efficient use of digital switching techniques, as well as being able to use Time Division Multiplexing as opposed to frequency division (more on that later).

Analog signals are digitised using a system called pulse amplitude modulation, and pulse code modulation is the most common. Samples are taken at around 8000 samples per second, and are usually recorded with an 8 bit depth. This will result in a digital rate of 64000 bps (namely 8 * 8000). For standard voice grade circuits, this is usually done at 3300 samples per second.

Instead of going through all the details, this image probably says it all:

#### Digital Data, Analog Signal

Well, even in our digital age, it is still necessary for us to be able to transmit digital data along analog lines - such as the telephone lines. In fact the NBN requires a digital to analog conversion, since fibre optic only allows analog signals. So, to do this you need to modulate the digital data onto the analog signal, normally by combining the signal m(t) onto the carrier frequency fc, to produce the signal s(t). The bandwidth is usually centered on the carriers frequency.

So, how is this done? Well, there are a couple of ways:

Amplitude Shift Keying
Here, the binary values are represented by two different amplitudes of the carrier frequency. A 0 will be, well, 0, but a 1 might be the actually sine wave - s(t) = Asin(2πft).
It might be better to have a look at it as a diagram:

Frequency Shift Keying
This is another way of doing it, so that while the amplitude stays the same, the frequency changes:
0 = Asin(2πf1t)
1= Asin(2πf2t)

Phase Shift Keying

This is where the phase of the signal is shifted to represent 0s and 1s. Differential phase shift keying shifts the phase relative to the previous transmission as opposed to some reference signal.

0 = Asin(2πft).
1 = Asin(2πft+θ).

#### Analog Data, Analog Signal

Okay, this is the final one, and it is probably still around, if Alan Jones' antics are anything to go by (he is a radio announcer in Sydney, well known for his rather controversial statements that tend to get blown all out of proportion by the media).

There are two types: Amplitude Modulation and Frequency modulation. Basically the data is mapped onto the carrier signal in a way that either leaves the frequency the same and changes the amplitude (AM) or leaves the amplitude alone and changes the frequency.

Once again, pictures probably say a lot more than words.

So, this is amplitude modulation:

And finally, frequency modulation:

Encoding Signals by David Alfred Sarkies is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. This license only applies to the text and any image that is within the public domain. Any images or videos that are the subject of copyright are not covered by this license. Use of these images are for illustrative purposes only are are not intended to assert ownership. If you wish to use this work commercially please feel free to contact me