Spark image

Coding and decoding

We usually communicate with each other using words, but they only mean anything if we understand the language. Imagine trying to explain the ideas of Physics to your pet guinea pig or telling your cat about the origins of the universe. They are probably not going to understand you. However you may have taught the cat to understand some simple words such as "no", "mouse" or "fish" spoken in a special way.

Now think about talking to someone in another country whose language is not English – you will have a similar problem to the cat although the brain of the other person will be much better than that of the cat and so you will both be able to learn to understand words in each others language.

However what of you want to be able to communicate with only selected people – you will need some sort of code that only you and they understand. We will now have a look at a few simple codes.

The simplest if probably to replace letters with numbers, two example are given:


A B C D E F G H I J K L M
1 2 3 4 5 6 7 8 9 10 11 12 13
                         
N O P Q R S T U V W X Y Z
14 15 16 17 18 19 20 21 22 23 24 25 26



A B C D E F G H I J K L M
26 25 24 23 22 21 20 19 18 17 16 15 14
                         
N O P Q R S T U V W X Y Z
13 12 11 10 9 8 7 6 5 4 3 2 1


or letters by letters


A B C D E F G H I J K L M
Z Y X W V U T S R Q P O N
                         
N O P Q R S T U V W X Y Z
M L K J I H G F E D C B A


Or how about letters by symbols:



There are some very clever codes that change each time you use the letter.

One invented for the resistance workers in World War II used the lines of a poem such as the two examples shown below.

The love that I have is all that I have
And the love that I have is yours
The love that I have of the life that I have
Is your and yours and yours.

This is the morning I will not forget
For then we stood in awe
And saw the world created in a day


The letters of the poem were put into a grid in order, using each letter only once. When the end of the poem has been reached any letters not used are added to complete the grid. (Z and V occupy the same square). The grid is then used to encode the message.
The message is encoded and decoded by taking the letters in pairs from the grid and replacing them with the letters at the opposite corners of the rectangle formed by the two original letters.

For example in the grid for the second poem shown here the letters DS would be encoded as FE.

T H I S E
M O R N G
W U L F D
A B C J K
P Q X Y V


So for the example of the second poem:

HOW ARE YOU TODAY would be first written as
HO WA RE YO UT OD AY and coded as
OH AW IG QN WH UG PJ

Find out something about the Eureka machines developed by the germans in World War II and how the code used by them was broken at Bletchley Park in England.

Electronic encoding and decoding


Electronic devices such as computers use the binary system of numbers to "communicate" with each other. If we use an LED module with four lamps we have a variety of possible combinations of output, 16 in fact.

These are:
0000 0100 1000 1100 0001 0101 1001 1101 0010 0110 1010 1110 0011 0111 1011 1111


Therefore you can only send a message of 16 different "words" if you only have four LEDs as your output.
As an example of this consider the following sentence:

Four output lights can be used to transmit up to only sixteen pieces of simple information.

If each word is represented by a set of ones (1) or noughts (0) starting with 0000 the sentence could look like:

0000 0001 0010 0011 0100 0101 0110 0111 1000 0110 1001 1010 1011 1100 1101 1110

If so what does this set of data mean:

1010 0010 0011 0111

 
A VERSION IN WORD IS AVAILABLE ON THE SCHOOLPHYSICS USB
 
 
 
© Keith Gibbs 2020