Electronics Tutorial 5 - Digital and Analogue Signals


What is the difference between digital and analogue signals?

We see and hear things in analogue.  The eye can adjust to  any brightness from just about detectable to blinding.  It is estimated that there are 109 different light levels to which the eye can adapt.  Below the range, the light will not be detected; above it, damage will occur.  Colours are in a continuous spectrum as well.  Similarly for sound, the ear can detect an amplitude of about the width of an atom (about 10-10 m) at a sound level of 0 dB up to the 120 dB which is the threshold of pain and will cause hearing damage.  The intensity difference is 1012 times.


A sound signal is picked up by a microphone, which converts the sound levels and frequencies to an analogue electrical signal which can have any value between +VS and -VS.  The picture below shows a typical analogue waveform.


Digital signals are simpler.  They are either ON (1 or HIGH) or OFF (0 or LOW).  In theory it is possible to be an expert on digital electronics without knowing anything about electricity at all, other than the difference between ON and OFF.  In practice, some knowledge does help!  Digital signals come in pulses that are 1 (+5.0 V) and 0 (0 V).  In practice anything below about 2 V is considered to be LOW.  Here is a digital waveform:


It represents the binary number 01001101 (which is 77).


Question 1

What binary number is represented below?



Binary numbers (numbers to the base 2) are essential for digital data processing.  Many years ago, attempts were made at analogue computing, but nowadays all computers are digital.  Computers are adding machines.  They can only add up binary numbers.  They cannot subtract.  Subtraction is done by a process of complementary addition.  Multiplication is done by serial addition.  Division is done by serial complementary addition.  You may be thinking that your computer can do very sophisticated games.  It's all done by binary addition.  The computer can do it at a very fast rate.


Bits and Bytes

Computers use bits and bytes


A bit is a binary digit, i.e. a 0 or a 1.  The binary number 11 is a two-bit number.


Question 2

How many levels can you get from a two-bit number?



2-bit numbers are not much use.  This picture is in 2-bit colour:


The colours in the next picture are 4-bit, so there are 16 different colours:



The earliest computers used 8-bit numbers, which are called bytes.  These are from 00000000 to 11111111 (0 to 255).


Question 3

Show that binary 11111111 is the same as decimal 255



For an 8-bit number there are 256 (28) combinations.  If each number represented a single colour, we would get a colour palette that looked like this:



A 8-bit colour picture looks like this:


It's slightly better than the one before.  But this picture (the original) is a 32-bit image.  A 32-bit number is sometimes called a four-byte word.



Question 4

How many different colours can you get with a 32-bit colour palette?



Modern computers use 64-bit numbers or 8-byte words.  This gives 18446744073709551616 combinations, i.e., 1.845 1019, which is quite a lot.


In the earliest days, memories for computers were in kilobytes (kB).  1 megabyte (1 MB) was considered very large.  Now files of up to 100 MB are routine.  PC games may have a central program which is 1 gigabyte (1 GB) or more.  Hard-disc drives of 1 terabyte (1 TB) are easily available.


File size



Power of 2

1 byte




1 kilobyte




1 megabyte

1 048 578

8 388 624


1 gigabyte

1 073 741 824

8 589 934 592


1 terabyte

1 099 511 627 776

8 796 093 022 208



When looking at internet speeds, these are quoted in megabits per second.  A 1 megabit per second download speed is 131 kB s-1 (not very fast).


Using Binary Numbers

Although you are not expected to know more than 1 - 10 in binary for this syllabus, it's worth mentioning that base 10 is not used in the computing world.  Instead, hexadecimal (base-16) is the counting system that computer experts use.  This table below shows the systems in 4-bit and 8-bit numbers:


4-bit binary

8-bit binary




































































Question 5

Convert the following hexadecimal numbers to binary and decimal:

6; C; 13; 3F




You will have used data-loggers at some stage in your A-level sciences.  In Physics, the obvious sensors are voltmeter and ammeter sensors.  You may have used position sensors, force sensors, light sensors, and temperature sensors.  In Chemistry, you may have used a pH sensor.  The picture below shows an infra-red sensor:



All sensors detect an environmental factor.  These can be any value, so are analogue signals.  This have to be converted to digital signals to be used by the computer.  The picture shows a typical interface box.  This one can be used as a stand-alone data-logger, or it can be connected to a computer:



Analogue to Digital Conversion

Suppose we wanted to convert the analogue signal in the graph into digital signals:


The first thing we need to do is make sure that the voltage is always positive:

We need to represent the voltage as a number of different levels.  This is called quantisation.  1-bit quantisation gives us 2 levels, 0, and 1:



This would not give us a particularly useful signal.  If we decreased the sampling time, we would get the same result, because there is no level 1/2.  Each sample gives out a 0 or a 1.


Question 6

If the sample time is decreased to 1/10 of what is shown above, what is the output?



In your answer above, you will have got a line of 0 and 1.


2-bit quantisation gives us 4 levels, 00, 01, 10, and 11.  4-bit quantisation gives us 16 (24) levels:



We also need to decide the frequency at which we determine the levels.  This is called the sampling rate.  The level is determined to the nearest whole number.  We cannot have a sample that gives us 0110 and a half!  The sampled signal looks like this:



In this case, there are many more levels and the sampling time is shorter.  The term for converting analogue to digital signals in this way is pulse code modulation.


Question 7

Write down the sequence of binary numbers that would form the analogue wave.


Question 8

The analogue wave has a frequency of 512 Hz (C above middle C).  Calculate the sampling time.



This digital output would give a very distorted sound when converted back to analogue.  We can improve the sound by converting to 16-bit samples.  This is sometimes called the bit depth  A bit depth of 16 gives 216 levels which results in 65536 levels.  We can also increase the sampling rate (reducing the sampling time).  The current standards for a CD are 16-bit bit depth and 44 kHz sampling rate.  Improved audio performance can be achieved by increasing the sampling rate.  Audio engineers reckon that the sampling rate should be twice the highest frequency.


The DVD standard is bit-depth of 24-bits.  This gives 16 777 216 levels, resulting in a much higher resolution.  The sampling rate is 96 kHz.



In analogue systems, there is always a certain amount of random and unwanted signals, which are called noise.  They result from the electronic components in the amplifier and are due a number of factors such as temperature, junction reverse breakdown, causing avalanches of electron.  Stray electromagnetic fields, such as those caused by lightning are common sources of noise.


Noise is most commonly heard as an intrusive hiss, especially when an amplifier is turned up.  Poorly shielded mains transformers lead to hum (100 Hz).  Random clicks can be the result of lightning discharges.  If a signal is amplified at several different stages, the noise can become a significant part of the signal.  If the noise is severe, it can detract from the enjoyment of the music.  If the signal is weak, it can make it unintelligible. 


A well-designed analogue amplifier will reduce the noise to a minimum but not get rid of it completely.


Digital circuits have the advantage of reducing the noise, because the additional little waves made by the noise are not quantised.


Advantages of Digital Signals

Digital signals can carry much more information than an analogue signal.  When you use a DAB radio, you tune into one frequency, 225.648 MHz.  On this wave, digital signals from a large number of radio stations are carried using a process of multiplexing.  The precise details are beyond the scope of these notes.  Similarly, huge amounts of digital data can be carried along an optical fibre cable.  The signals in optical fibres deteriorate less than they do in wires.


Digital signals can be cleaned up more easily than analogue signals.


Cleaning Digital Signals

A problem with optical fibres is that the signal tends to get smeared.  The idea is shown below:

By using clipping circuits and operational amplifiers, the distorted waves are converted back into square waves.


The same train of pulses is shown with some noise that it has picked up.  Just because the signal is digital, it does NOT mean that it never gets noise.  Noise is easier to get rid of.

The noise is removed by passing the signal through a filter that removes very high frequency signals.


Data Storage

A major advantage of digital data processing is data storage


The most obvious storage medium for an analogue recording is the LP record.  This is a 30 cm disc made of polyvinyl chloride, onto which a continuous groove is cut.  About 25 minutes of music can be stored on each side.  The record has to be turned over.  It is easily damaged by scratches and dust.  A poor quality player can also damage the track.  However vinyl LPs have recently made a come-back, because many people think they sound better.


An alternative is ferromagnetic tape.  The trouble is with tape is that there was noticeable hiss. To get a decent recording, the tape has to move past a recording head at a considerable speed.  Studio quality reel-to-reel tape decks are very expensive.  The cassette deck that your parents would have had as teens did not allow for high quality recordings, even though a hiss reduction system (Dolby) was present in good quality machines.  The cassette was never intended to be a high quality recording medium.  It was developed for dictation machines in offices.  Often the tape from the cassette could end up inside the machine all chewed up.  The cassette deck is now a museum piece.


Your parents will also have used a video cassette recorder to record TV programmes off-air.  For video recorders to work, the speed of tape moving past the head had to be several metres per second.  In the VCR, this was achieved by an ingenious system of a rotating head.  However this could mistrack and the results could be unwatchable.


For digital data storage, ferromagnetic media have been used since the earliest days.  In the nineteen seventies Edinburgh University bought the largest possible hard-drive - 100 megabytes.  In the earliest days of home computers, programs could be stored on cassette tapes.  I even remember programs being broadcast on channels targeted at young people - they sounded like a swarm of angry bees stuck in a glass jar.


In your computer, you have a hard-drive of anything from 500 GB to 2 TB.   CD media can store up to 700 MB, while DVDs can store 4 GB


Solid state drives have been around  for many years in the form of pen drives, which can hold 64 GB of data.  The picture below shows a variety of hard-drives:


The one on the left is the HDD from and old computer.  The one in the middle is an external HDD that I use to back up my data (I am paranoid about losing my data) and the pen-drive on the right is the one I used for the resources I used for teaching.


Digital media are not indestructible.  CDs can mistrack, or even get stuck.  Data can be corrupted.  It only takes a 1 to become a 0 in a vital place for the data to be meaningless.  There are ways that computer manufacturers have devised to check and repair data, but they may not work in every case.   Hard disc drives like the ones above can be easily damaged by heat or by dropping onto a hard surface.  Sometimes they just fail. They are complex and precision-made devices.  It is a good idea to have your data backed up, so that if the worst happens, you do not lose them.