A Simple FM Stereo Transmitter using ATTINY12 microcontroller

The parts to the right of the green capacitor are the FM radio transmitter. The parts between the 8 pin DIP and the transmitter are the resistor matrix. One capacitor, C5, is mounted on the back of the board, and one other capacitor, C11, had not yet been installed. It was later installed just below the 560k resistor. The connector in the upper-left is the unregulated power input. The connector in the lower middle is audio input. ATTINY12, ATTINY25, and AT90S2323 were tested on this board while the ATTINY2313 and AT90S2313 were tested in another breadboard.

Simple FM Stereo Transmitter using avr
Photo 1. In the picture above,The parts to the right of the green capacitor are the FM radio transmitter.The parts between the 8 pin DIP and the transmitter are the resistor matrix.One capacitor, C5, is mounted on the back of the board, and one other capacitor,C11, had not yet been installed. It was later installed just below the 560k resistor. The connector in the upper-left is the unregulated power input. The connector in the lower middle is audio input. ATTINY12, ATTINY25, and AT90S2323 were tested on this board while the ATTINY2313 and AT90S2313 were tested in another breadboard.

Overview

I had been fascinated with the idea of making an FM stereo encoder. Not that stereo means much  to me away from the computer. I use an FM broadcast transmitter to relay the output of my computers to FM radios in the kitchen, the bedroom, the driveway, and  out in the garden. Under those circumstances, I find that mono is plenty, whether it is music or radio programs from over the internet, since I am primarily occupied with something else anyway. When on my hands and knees in the garden, all the way up to my elbows in planting a bush, the music really doesn’t seem any more sweet when its stereo. But that didn’t stop me from being fascinated with the idea of making a stereo encoder.
Stereo always seemed like a lot of circuitry and bother for the slight benefit that came with it. That is, until a few weeks ago.
The traditional or classical method     -What it says in the textbooks.
traditional or classical method

Figure 1. Filters have been omitted from this design.
A proper encoder includes some carefully designed filters.

A composite stereo signal, as transmitted by FM radio stations, is composed of at least three parts: A base band mono signal, a double sideband channel difference signal, and a pilot carrier. The signal composition is somewhat analogous to an NTSC composite color television signal. I said “at least three parts” because some stations transmit other things such as data and background music that our normal FM receivers do not decode.

The base band signal falls between 30 Hz and 15 kHz. This is the part of the audio signal that comes out of the speaker on a mono receiver, In the classical  encoder, it is made by simply adding the Left and Right channel audio signals together, and is often referred to as “L+R.”
A double sideband channel difference signal, often referred to as “L-R” is also transmitter. The information in this signal is the difference between the signals in the Left and Right channels. In the classical  encoder, the channel difference signal is made by subtracting the Right channel’s audio signal from the Left channel’s audio signal. The channel difference signal is then combined with a 38 kHz carrier in a balanced modulator to form a double sideband signal centered at 38 kHz.
The third signal, a pilot carrier at 19 kHz, exactly half the frequency of the carrier used to generate the 38 kHz double sideband signal. The 19 kHz signal is used to regenerate the missing 38 kHz carrier in the receiver and this 38 kHz carrier is used to demodulate the double sideband signal.
The three separate signals are not intended to affect each other. Careful filtering can minimize undesirable interactions, most of which would be some kind of beat between the 19 kHz pilot signal and the Left and Right channels and their products.
I fiddled with the classical encoder on paper a number of times over the years.  The designs always had all sorts of neat blocks – an oscillator and frequency divider, a balanced modulator, one or more summing amplifiers and a few of filters. In all, something that would not result in a home project that would be easy to duplicate. The 38 kHz oscillator could be made with a 74HCT60 oscillator/counter chip and a 38 kHz crystal. The balanced modulator could be made with a Giblert cell multiplier for something nice, or a set of transmission gates switching complimentary audio signals, or ever with resistor networks being switched by micro controller I/O pins.

The L+R function could be achieved with a pair or resistors and the L-R signal by a simple op amp circuit. If an op amp were to be used to sum all the signals together, it would have to be quite good – passing the 38 kHz and its sidebands and maintaining phase with respect to the baseband L+R signal. I had bought some pretty nice op amps in anticipation of using them, until I finally understood the simpler method, described below.

A simpler approach

I came across a very simple and robust stereo encoder project on Harry Lythall’s website. Harry’s amateur radio call sign is SM0VPO, and he can be readily Goggled.  The circuit was simple, it was elegant, and I didn’t have clue as to how it worked. After coming back to his project several times, I realized that I had seen a write-up of this technique, but I had not understood it well enough to appreciate what I was looking at.

Harry Lythall’s projects can be found at: http://www.sm0vpo.com/audio/stereo_enc.htm.
The technique that lends itself to such an elegant implementation is explained at:
http://web.archive.org/web/20060214011755/http://transmitters.tripod.com/stereo.htm <== This will open a new window. The original link, http://transmitters.tripod.com/stereo.html, stopped working within days of the first publication of this web page, and I am grateful to Internet Archive for making it available to us.
What I added to Harry’s encoder was a slight twist. That of using an AVR micro controller to replace the oscillator/counter and the analog transmission gates. And that is what this circuit does. A cheap micro controller, an NPN transistor and a handful of passive components is all that it takes to make a simple stereo FM transmitter.

This “simpler” approach calls for simply switching the audio channel between the Left and Right inputs. Each channel is sequentially connected for one half cycle of the 38 kHz carrier. That produces both the 38 kHz double sideband signal and the baseband signal. A low pass filter reduces the “splatter,” resulting from harmonics of the switching, on adjacent radio channels. I understand that this is how one of the low cost single chip encoders works. It makes sense, this method relies on matching of components and no precision circuitry. Its nearly fool proof.

Switching in this way generates a 38 kHz double sideband signal and passes both L and R through the baseband. L and R have opposite polarities in the decoder because L is allowed through to the transmitter on one half of the 38 kHz cycle and R is allowed through on the other half. When L and R are equal, the two signals average out to zero over each cycle. It could not be simpler.

sidebands

Photo 2. I just had to look.  It really makes DSB.
Spectrum analyzer display of signal across C4 in schematic (figure 4).
Here, the Left channel was driven by a 1 kHz sine wave. Notice that the circuit
really produced 38 kHz double sideband with the carrier suppressed by 22 db. When
I jumpered the Left channel to the Right channel, the sidebands disappeared.

The only tricky part is achieving the 2:1 analog multiplex function with a micro controller. This needs to be done without switching the DC level of the signal, because that would cause the 38 kHz carrier to feed through. CMOS Micro controller I/O ports can switch between high impedance and low impedance states. But when in the low impedance state, the pin can only be at either ground (logic low) or at the positive power supply (logic high). That means that the switching action must take place by mixing the Left and Right signals resistively, then basically shorting out one, then the other in alternation. To maintain the condition that the switch not changing the DC level of the signal, the signal will have to be centered around ground or the positive power supply. I chose ground since the input signal would be referenced to ground.

What the data sheets do not tell us is that the FET that drives the output pin low, an N-Channel FET, is pretty good a sinking current from signals above ground and sourcing current from signals below ground. Let me say that last part again: The N-Channel FET that drives the output pin can shunt signals below ground to ground.  It is very much like a low value resistor that can be turned on and off. When the I/O port is in a high impedance state, if the signal tries to swing too far below ground, either the ESD protection device on the I/O pin or the parasitic diode that is intrinsic to the FET will conduct, clipping the signal. In this circuit, noticeable clipping at the I/O pin starts at several hundred millivolts below ground.
Since the FM transmitter in this circuit only needs a few tens of millivolts to attain satisfactory modulation, there is no need for amplification of the output of the multiplexer. There is more about modulation sensitivity in the part of this section that deals with the transmitter circuit.
To perform the switching between high impedance and low impedance to ground, the firmware zeros to the corresponding port registers registers, then at appropriate times, it clears the corresponding data direction register bits to make a given pin a high impedance, and at the appropriate times, the firmware sets the corresponding data direction register bits to make the a given pin a low impedance to ground.

For more detail: A Simple FM Stereo Transmitter using ATTINY12 microcontroller


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top