As promised here are the circuit diagrams for the colour decoder and a quick run-through of how it all works. Please accept my apologies for any errors and omissions; I'm still doped up on codeine after an operation.
The circuit diagrams in the article can all be downloaded as higher resolution png files in the attached zip. If you want them in other formats then please do send me a message. They were created using KiCad.
This has turned into a bit of a mammoth post, so you might want to brew a cup of tea, or even better get a couple of bottles from the fridge before starting...
Introduction
The aim of this experiment has been to see if it is possible to possible to transmit full colour NBTV pictures in a single analogue sound channel. The aims were:
- be backwards compatible with NBTVA "club" standard (32 lines, 12.5 fps, missing frame sync pulse, etc)
- fit into a 20kHz or less bandwidth
- not require exotic components
- be transmissible by entirely analogue means
NBSC = NBTV + NTSC
After some basic experimentation (in software only) it was decided to use a simple NTSC like colour encoding scheme with some simplifications and alterations to suit the narrow bandwidth of NBTV.
Systems such as PAL and SECAM were avoided because they require delay lines to function correctly and their advantages rely on aspects of the picture geometry and timing that are not that applicable in NBTV (for instance PAL's automatic hue correction produces very noticeable hanover bars due to NBTV's low resolution).
Idiot's guide to NTSC
[The (idiot) author has to admit to having little knowledge of the NTSC standard or how it worked up until a few weeks ago any corrections or comments welcomed - it is hoped that this hopefully gives a quick and simple guide to how NTSC works]
There have been many attempts at producing colour television over the years, and it is beyond the scope of this article to go into the pros, cons, politics and comparative theology of the various competing analogue and digital colour systems – the author just picked the one he understood and stuck to it!
The human eye contains two types of cells for detecting colour, rods and cones. Rods are sensitive to a wide range of colours and are more sensitive than cones - effectively giving is black and white only vision when it is dark. The cones come in three varieties that sense red green and blue light. So to make a television picture that looks like full colour we need to present our eyes with three separate red, green and blue signals at the same time, which can vary independently.
However, we don’t have room for all these extra signals – remember we want to keep the b&w signal AND fit everything in the same bandwidth! So, a method needs to be found to reduce this number of signals if possible. One way to do this is to send three signals:
- Code: Select all
Y = R + G + B
U = B – Y
V = R – Y
Here Y is the original black and white signal which is an admixture of the red, green and blue signals. U is the difference between the blue signal and the Y signal, and V is the difference between the Red and the Y signal.
These signals are mixed together at the camera end and at the receiver end , if the receiver is black and white then only the Y signal need be recovered. However if the receiver is colour then some simple addition and subtraction can be performed to recover the RGB signals:
- Code: Select all
R = Y + V
= Y + (R – Y)
= R
B = Y + U
= Y + (B – Y)
= B
G = -(U + V + Y)
= Y – B + Y – R – Y
= Y – B – R
= R + G + B – B – R
= G
In the real world a black and white signal is not made of red, green and blue signals in equal proportions as the eye has a different sensitivity to each of the colours so a different set of proportions is actually used (however the sums still work similarly), see the Wikipedia article on YUV in the further reading section for more information.
The image above shows how all the colours (well almost all) that we can see can be mapped onto a pair of U and V coordinates as a simple map.
In the NTSC scheme two slightly different signals I and Q are used when the signals are created, they are not exactly related to red and blue but instead to slightly different colours to which the eye is more sensitive – see the Wikipedia article on YIQ. However, most television receivers (including the one in this article) use YUV when decoding the signal as the circuitry is simpler.
Modulation
We still have three separate signals that need to be fitted into the same space as the original black and white signal AND still be understood by an existing black and white receiver.
To accommodate the existing black and white receivers the Y signal (along with the usual sync pulses etc) is transmitted as normal – this on a black and white receiver gives a nice black and white picture.
Now what to do with the U & V (or I and Q) signals. What was decided in the NTSC (and PAL) systems was to use Quadrature Amplitude modulation. This very grand title in fact describes a very nice neat and simple (if difficult to describe!) system.
In amplitude modulation a carrier signal, at a high frequency is modulated (made large or smaller in sympathy with) by a lower frequency signal, such as sound.
In quadrature modulation two separate carriers are used, both at the same frequency but at a phase difference of 90 degrees. Each of these is modulated by the U or V signal in such a way that when the U or V signal is zero the output is also zero and if the U or V signal is negative then the carrier is modulated “upside down”.
Because the carriers are sine waves and the two signals are out of phase by 90 degrees when one carrier is at its maximum or minimum the other is at zero. So, if the two carriers are modulated and added together the original modulating signals can still be retrieved by sampling the signal when each of the carriers would be at its maximum or minimum, as the other carrier would be zero at that point hence no information would be present for the other signal.
This signal is called the Chroma, Chrominance or C signal.
The signals can also be recovered by multiplying the signal by a square wave or sine wave that is in sympathy with the original carrier, because a sine wave averages out to zero over a full wave, if this recovering wave is at the same phase as the carrier then the signal will be recovered (averaged over a cycle) whereas the other signal being 90 degrees out of phase will not.
The image above shows what happens when a signal comprising a black, grey, white, red, green, blue colour sequence is transmitted.
The bottom trace shows the actual colour to be transmitted, the Red, Green and Blue components show the intensity of red, green and blue in each colour. The Y, U and V traces show these signals rearranged into our three Y, U and V signals.
The next two traces show the in-phase and quadrature carriers, i.e. the carrier and the 90 degrees out of phase carrier, the signals above show these two carriers modulated independently with then U and V signals and then the QAM modulated signal (Chroma) shows these signals added together.
Superimposed on the colours at the bottom is a trace of the actual signal that would be transmitted, this is simply the Y signal with the QAM signal added. On a black and white receiver this will look like a normal picture with the colour parts looking like a light grey with a patterning superimposed - produced by the QAM signal.
Decoding
The decoding process is shown in the top four traces. At the colour receiver the Chroma signal can be separated from the Y signal by using high and low-pass filters or notch and band-pass filters.
A pair of square waves (that’s how it works in this simple receiver in analogue NTSC receivers usually sine waves would be used) is generated in sympathy with the original in-phase and quadrature carriers. These square waves are then multiplied against the extracted Chroma signal to give the top two traces, if these are low-pass filtered to average the signal out over a full wave of the carrier (pink-superimposed traces) then a signal similar to (but of diminished quality to) the original U and V signals can be obtained.
Once the U and V signals and the filtered Y signal are available they can then be added together (as per the formulas above) to re-create the original R, G and B signals
Problems and “dodges”
There are some problems introduced by this scheme though:
Colour patterning: The Chroma signal superimposed upon the Y signal appears as a patterning on black and white receivers, this must either be lived with or filtered out. On most Nipkow disc receivers the size of the apertures effectively filters most of this patterning out, but some is still apparent.
To reduce the impact of patterning there are various “dodges” that can be used when choosing the sub-carrier frequency. One is that the frequency should be an odd multiple of half the line frequency. If this is done the patterns are opposite in phase on each line and so a stationary “checkerboard” pattern is produced.
Another dodge is to also add a small increment to the frequency that is half the frame rate, this then makes each frame have a pattern that is opposite to the last. On black and white receivers, if the frame rate is high enough they will cancel each other out and disappear. Unfortunately we cannot use this dodge on NBTV because the frame rate is quite low and this just produces a very annoying checker board pattern that flashes quite alarmingly!
Low bandwidth colour: The U and V signals used to modulate the colour subcarrier must have a much lower bandwidth than the carrier frequency (in this system the U and V signals are filtered to 2.5kHz for a 15kHz subcarrier). This is not as drastic as it might seem. The eye and brain are more sensitive to fast changing black and white signals and are forgiving if the colour signal is a little “smudged” for this reason the low colour bandwidths are not the end of the world but any improvement would be worthwhile.
NTSC, as mentioned before, uses I and Q signals that are slightly different to the simple U & V signals described in this article. This is so that a wider bandwidth can be placed on the orange-cyan colours (to which eye / brain is more sensitive). To take full advantage of this receivers need to be slightly more complex in design and so have been skipped in this first attempt.
Cross-colour: This is where there are signals contained in the Y signal which can are at the same frequency as the sub-carrier. These signals get picked up by the filter that extracts the Chroma signal and confuse the U and V demodulators and tend to appear as speckles or at the edges of sharp transitions of light to dark. This is especially noticeable at the right hand edge of pictures produced by this receiver where the high-frequency components of the sync-pulse give rise to a constant pattern.
The dodge to get round this is to filter any signals near the subcarrier frequency out of the Y signal using a notch filter. However any filtering tends to mar the quality of the original Y signal. The author has conducted some simple experiments on this and had some success – as these are improvements at the transmission end however they will not be pursued further in this article.
Subcarrier reconstruction
One item mentioned above that was brushed over, was how the receiver makes a copy of the original in-phase and quadrature carriers. This is one of the more tricky aspects of the NTSC system: not only must the subcarriers at the receiver be of the same frequency but also of exactly the same phase. With the use of quartz crystals we can ensure very accurate matching of frequencies at the transmitter and receiver but we also need some way of maintaining our carriers in phase.
To achieve synchronisation, a system known as “colour burst” is used. In this at well defined times during the transmitted signal a burst of colour is transmitted of a known (0 degree) phase and amplitude: i.e. a burst of the in-phase carrier signal. This signal can then be compared with the local carriers and if they are out of phase they can be adjusted as necessary.
In the receiver described later this is achieved by slightly speeding up or slowing down the master oscillator depending on whether the demodulated V signal is positive or negative during the colour burst – as the V signal is 90 degrees out of phase if the master oscillator is correct then the V signal should be zero when the colour burst is being demodulated if the phase is “perfect”.
In normal NTSC signals this colour burst occurs at the start of each line for 10 cycles – however there isn’t room for this in the NBTV signal so instead the colour burst happens once per frame, taking up the whole of the first line.
Older NTSC receivers suffered from all sorts of problems caused by the local subcarrier oscillator being slightly out of phase with the transmitter (caused by all sorts of reasons). For this reason older sets are fitted with a “hue” control which can be used to manually adjust the matching up of the colour burst with the local oscillator. As this hue control is adjusted the phases of the subcarriers are changed with respect to the colour burst slightly and this gives an effect where the colours all change slightly from where they should be – as if the U-V map included above had been rotated about its centre.
For this reason NTSC (which actually stands for “National Television System Committee”) is often know as “Never Twice the Same Colour”, as the user needed to manually adjust the hue control to get the right colours. Modern sets (and other colour standards such as PAL and SECAM) have come up with various other “dodges” to either hide or correct the problems. In the simple receiver and standard presented here a Hue control is used!
NTSC Parameters
A simplified version of NTSC was chosen with the following parameters and changes from specification. (Note: these parameters are all subject to change and were just picked as a reasonable starting point - any comments or suggestions would be good!)
- Code: Select all
Subcarrier Frequency: 15,000Hz
Modulation: Quadrature modulated I&Q supressed carrier
I bandwidth: (2.5kHz)
Q bandwidth: (1kHz)
Colour burst: whole of first line after missing sync 15% modulated at black level
Further Reading
YUV – Wikipedia article
YIQ – Wikipedia article
Quadrature Amplitude Modulation
The circuits
In this section each components of the colour decoder will be described in turn – the sync separator, motor control and LED driver circuits will not be covered as they are covered better elsewhere.
This circuit is presented in the hope that it will be useful as a starting point, stimulate debate, criticism, improvement – it is not expected to be a brilliant example of circuit design and certainly not the best or only way of decoding the signal!
Overview
The picture above shows an overview of the colour decoder board.
The inputs to the decoder are the power supply at +12V, the video signal, as output by Klaas’s sync separator board (P3) and the frame pulse as output by Klaas’s sync separator board (i.e. active high for the last half of the first line of each frame). The video fed to the board should still have sync pulses present and be between 0.5Vpp to 3V pp
The outputs are positive R, G and B signals at levels of roughly 3V for black and 11V for full modulated (the offset for each channel can be adjusted independently in the matrix). These signals have no gamma correction applied and can be fed direct to most LED drivers (if you require smaller signal swings or to implement a “contrast” control the video input can be attenuated by about 3-4 times and the system works ok, below a certain amount you will need to change the gain of the colour burst amplifier).
The potential divider at the top left is used to provide a dummy split-rail for the operational amplifiers – the mid-point was chosen at 4V as this proved to make certain parts of the circuit easier to design (in particular cropping off the sync pulses).
Each of the four building blocks at the bottom will be discussed below. The interconnections between them are as follows:
+12 – the +12V supply voltage
0 – the chassis / ground / signal ground voltage
mid – the split rail mid-point voltage (roughly 4V above 0)
video – the input composite video signal
Frame pulse – the input frame pulse signal
SC clock U – a square wave in-phase subcarrier
SC clock V – a square wave quadrature subcarrier
Y- – the Y or luma signal (inverted)
U+, U- – the decoded U and its inverse
V+, V- – the decoded V and its inverse
Vburst – the V signal switched by the Frame pulse (i.e. sampled during the colour burst)
R – Red output
G – Green output
B – Blue output
Luma and Chroma Separator
This part of the circuit is fairly simple and is a pair of simple filters to extract the Y and Chroma signals from the combined video input signal. For future improvements more thought will be given to the form of the filters used to better preserve and isolate the two signals: reducing patterning and cross-colour and improving luminance bandwidth.
The first op-amp buffers the incoming video - the contrast can be set with the potentiometer -and sets the black level to be just above the “mid” level (with a simple diode clamp)
The top-right op-amp forms a notch-filter which filters out frequencies around 15kHz from the video signal (extracts luminance) and inverts the signal giving the Y- signal.
The bottom op-amp forms a band-pass filterand amplifier which extracts signals centered around 15kHz, the potentiometer can be used to set the colour saturation (colour control).
UV Decoder
This is the heart of the decoder, the Chroma signal is demodulated using two colour switches to produce the U and V signals (and also inverted versions of U and V needed for the colour matrix)
To demodulate the U signal the chroma signal is fed (via the analogue switch 4053) for the first 180 degrees of the in-phase subcarrier (SC clock U) to the non-inverting input of the op-amp and for the remainder to the inverting input. The signal is then low-pass filtered via the resistor capacitor combination (again better filtering could be applied here) before being sent out to the colour matrix.
The V signal is demodulated similarly but using the quadrature subcarrier (SC clock V).
[The 4053 analogue switch connects the X input to X1 when A is high and to X0 when A is low, similarly with Y/B and Z/C]
The 10k resistors at the outputs of the switches pull the outputs to “mid” when the switch is off (otherwise the outputs float and noise can be picked up).
The V signal is sampled during the frame pulse (via the third analogue switch channel) to produce the Vburst signal – which is fed to the subcarrier oscillator circuit and used to adjust the phase of the subcarrier clock – if all is well then this signal should be zero (i.e. at a voltage of “mid”)
SC Oscillator
This has proved to be the most involved part of the circuit to get working. As a crystal oscillator is used it can only be “pulled” a few parts per million in either direction, this means that the source of signals has to be transmitted at a near “perfect pitch”. The author struggled to get this circuit to work until he realised that his £7 crappy CD player was playing back very slow thus the circuit could not achieve “lock”.
The top-right part of the circuit is a VXO (variable frequency crystal oscillator) running at 6MHz +/- about 140ppm (i.e. +/- 840Hz). The frequency is varied by changing the voltage at the junction of the two varicap diodes. This voltage is the combination of three signals – a coarse setting (which sets the general frequency range of the VXO – a trimmer on the circuit board) – a fine setting (or Hue control) which sets the nominal frequency but a much finer grained user control and the Vburst signal.
If all is running well and the signal source is perfect then the oscillator would be set using the coarse and fine controls to be running at exactly 6MHz. The Oscilaltor would then be sped up or slowed down by the Vburst signal during the colour bursts to bring the generated sub-carrier signals into perfect phase alignment. However the user may intentionally offset the frequency a little using the hue-control and this will mean that to bring the circuit into balance a small phase error must be present on Vburst to achieve a “zero” signal at the output of the Burst amplifier.
The signal is then picked off from the transistor oscillator and passed through two NAND gates to make it into a more perfect square wave.
This signal is then passed through a pair of 4-bit clock which divide the frequency by 100 to give a 60kHz signal.
This 60kHz signal is further divided by two twice (using two JK flip-flops configured as T-flip-flops) to produce the in-phase 15kHz square wave. This SC clock U signal is then fed through a D type latch which is clocked by the 60kHz signal, effectively delaying it by 90 degrees to give the SC clock V signal.
The final stage is to take the Y-, U,U-,V,V- signals and add them together in the correct proportions to give correct red green and blue outputs.
The resistor values used are not “perfect” but were chosen to be close to the correct values whilst using common resistor values (the 345k and 235k resistors can be made up using 330k + 15k, 220k + 15k).
The proportions in which signals are added together are those outlined in the YUV Wikipedia article.
Conclusions
As an experiment to find out whether analogue colour “can” be applied to NBTV signals and fit into a single audio channel, this has been a success. The pictures produced are convincing and with some more “tweaking” it is hoped will provide real value.
Cheers
Dom