PLL FM Transmitter using LMX1601, ATtiny2313 AT90S2313
Here's a PLL FM Transmitter using LMX1601, ATtiny2313 or AT90S2313 microcontrollers. The common characteristic of all of the previous low power FM transmitters I've built over the decades, is that their operating frequency is determined by an LC resonant circuit. Some of them had excellent stability, some of them didn't, but I had always wanted to make one that is crystal controlled. Various schemes had been considered from time-to-time, including the direct approach of modulating the load capacitance of a a crystal oscillator, a whimsical phase modulation scheme involving a phase shifter, some balanced modulators, and limiting amplifiers, and at times, the down-to-earth and sober approach of modulating a VCO within a phase locked loop (PLL). While browsing Digikey's online catalog, I found the LMX1601 frequency synthesizer chip and thought: "Just maybe, the PLL approach is finally within my grasp."
The LMX1601, which apparently was designed for use in cell phones, includes everything need to make two phase locked loops except for the VCOs. More importantly, one of the PLLs, specifically the "AUX" PLL, is specified to work in the FM broadcast band. The LMX1600 and the LMX1602 were also considered, but the LMX1601 was selected because it has a "500 MHz option", meaning that it can work down to about 50 MHz.
An LMX1601 Phase locked loop, a discreet FET VCO, and an AVR micro controller combine to make a stable, easy to use monophonic FM transmitter that includes a an audio activated switch that turns the transmitter on only when its being used.
With the LED lit blue to indicate the transmit mode, the transmitter's user interface is clean and simple. Two push buttons step the frequency up and down. The transmitter comes one when audio of sufficient amplitude is applied, and stays on for five minutes after the audio drops below the threshold. The LED flashes red briefly to show when audio is detected, so I know if the volume of the audio signal is high enough. A small hole under the LED is for the piezoelectric transducer, whose main job is to produce key clicks when the frequency increment and decrement buttons are pressed. The buttons do not provide tactile feedback.
The painful part was dealing with the packaging of the chip. The lead centers of this 16 pin package are only 0.65 mm apart. Dealing with the fine printed circuit board features that would be needed to mount this chip was the most daunting aspect of using the chip. I had only experimented with the laser printer toner etch resist method of making PC boards a few months earlier, with some success. As it turned out, the laser printer toner etch resist method could be pushed to make a board that supports this chip. But just barely.
Fig 1. Click on the image to see the larger size version.
This board uses layout accomodates both the DIP, using inches,
on the same board as the LMX1601's TSSOP, which is specified
millimeters. There were some compromises. The artwork only includes
the AT90S2313, LMX1601, and the minimum components needed to make
the LMX1601 operate. Artwork was generated using a paint program.
The Phase Locked Loop
In order to function, the LM1601's registers need to be loaded. In particular, they need to be loaded with the divide ratios for the reference and signal (VCO in this case) counters, and to set some control parameters. To load the registers, I used a Atmel AT90S2313. It could have been any microcontroller with 3 I/O pins, but I had chosen the AVR processor, and I still have a lot of AT90S2313 chips left over from another project. To the best of my knowledge, the ATtiny2313 can be substituted without changing the source code. The 20 pin DIP appears monstrously large compared to the diminutive LMX1601. The size difference is an indication of the passing of the three of four decades that elapsed between the introduction of these two packages.
The LMX1601 has a reference divider, which I used to divide the 4 MHz clock from the micro controller's crystal oscillator, down to 12.5 kHz reference frequency. The feedback divider, referred to as "16 Bit AUX N Counter" in the data sheet, is proceeded by a divide by 8 prescaler. These factors determine the channel spacing for the phase locked loop. 8 X 12.5 kHz = 100 kHz. The AUX N register contains the divide ratio for the feedback divider, and the phase locked loop tries to make the VCO operate at a frequency equal to the value written to the AXU N register, times 100 kHz. I say "tries" because the actual frequency of oscillation depends on the range of the VCO itself. This means that the center requency of the resulting frequency modulated oscillator can be set with 100 kHz resolution, enabling it to be set either on or between allocated FM broadcast channels throughout most of the world.
If a value of 1000 is written into the AUX N register, the PLL will try to run at 100 KHz X 1000 = 100 MHz. The math isn't so hard, and I skipped the hard math -the loop gain and bandwidth calculations- so this should be an easy project, mathwise.
In the firmware, an 8 bit count is used as the "channel" number. The highest frequency, which occurs when the channel number is 255, is set to 108 MHz by adding an offset of 825 to the channel number. I did this because the part of the spectrum just above the FM broadcast band is used for aviation communications in most, if not all, parts of the world. When the frequency increment and decrement buttons are pressed, the channel number increments or decrements, respectively. The button increment and decrement routines that limit the channel number to those that correspond to frequencies between 88.0 Mhz and 108.0 MHz.
After the channel number is changed, the microcontroller waits for 30 seconds before writing the channel number to EEPROM. EEPROMs are only capable of a limited number of cycles, and the 30 second timer prevents the EEPROM from being written to each time a button is pressed. Going from 100 MHz to 108 MHz requires pressing the increment button 180 times. That's not really that much work, considering that it would normally only have to be done a few times in the life of the transmitter.
The actual frequency of the oscillator depends on the microcontroller crystal oscillator. I am using this with a couple of radios with digital tuning, and one of them has a pretty narrow detector, so for low distortion, I needed to have the transmitter very close to the frequency the receiver expects it to be. In other words, the transmitter, and therefore the microcontroller crystal oscillator had to be accurate. I solved the problem in my case by selecting a 4 MHz crystal this is close, and then adding a small capacitor in series with it to drop the frequency by a few more parts per million.
The oscillator I chose for the VCO is the same one used in the Band Switched Test Oscillator project because I know from experience, that it can tune through the entire FM band, even with a 3 volt tuning voltage, and also because it is quiet enough to use for this sort of thing. I had listened to the basic oscillator plenty on an FM radio while working on the Band Switched Oscillator project.
The voltage-to-frequency transfer function of the 2N5485 VFO.
The tuning range during the test, with a 3.05 volt power supply, was from
84 MHz (tuning voltage = 0 VDC) to 115 MHz (tuning voltage = 3.05 volts).
The average sensitivity of the VCO is approximately 10.4 MHz per volt.
The oscillator inductor is 8 turns of #22 enameled wire with 1/8 inch inside diameter initially wound closely-spaced, then stretched only a little to obtain desired turning range. When I wound the coil, I first stretched a length of wire a little bit with a pair of pliars - that made it so that it would keep its shape after winding. Then, I wound the wire on the smooth part of a 1/8 inch drill bit, slid the coil off, trimmed the leads the proper length, and tinned the leads.
The VCO was built dead-bug style on a small piece of copper clad board that was soldered onto the printed circuit board with thin copper strips. Noise, and in particular hum from the power supply and spikes from the microcontroller were a problem. The 3 volt power supply, made from a TL431 shunt regulator with an external series pass transistor, gives some power supply ripple rejection, but I added a 7805 regulator ahead of it to give an additional 60 db or ripple rejection. This was enough so that there was very little 50 Hz, or 60 Hz -I worked on this on two different continents - to be heard in the signal. The 7805 being ahead of the TL431 circuit also handles a wide range of input voltages, which along with the varistor, gave me some peace of mind.
With the approximately 100 db of power supply ripple voltage rejection, and the power supply hum all but inaudible, a musical tinkling sound was heard through the speakers. This was noise from the microcontroller getting into the VCO circuit through the power supply. This was stopped by adding a 330 uf decoupling capacitor to the VCO.
The two transistor LED driver circuit drives a red/blue common cathode LED. If only one LED is used, both drivers may be eliminated and an LED in series with a resistor can be connected directly to pin 9 of the microcontroller, provided that an LED with sufficiently low forward voltage requirements is used. Extensive use of Berg style connectors was used so that the circuit board can be completely detached from the enclosure, facilitating repairs and modifications.
Referring to the schematic in figure 3, the circuit in the upper left corner is the audio detection circuit, which operates in a maner similar to that of a voice operated switch, or VOX. Pins 12 and 13 of the AT90S2313 are the inputs to an analog comparitor. The 50k, 1k, and 100k resistors connected to these pins provide bias to that forms the threshold for the detection of the audio signals coupled through the 10 uf capacitor. The 47 uf capacitor keeps voltage on the comparitor input on pin 12 of the comparitor from changing with the incoming audio signal. Whenever the comparitor's output changes state, it causes an interrupt. The interrupt resets a 5 minute timer and blinks the LED from blue to red for a short period of time. The two 4700 pf capacitors from pins 12 and 13 are chip capacitors that have their other ends soldered directly to the ground plane, to keep the FM oscillator signal from tripping the comparitor when 5 minute timer times out and the oscillator shuts off.
Even with these RF bypass capacitors in place, sometimes, the comparitor would trip when the oscillator shut off, thereby turning the oscillator back on again. Eventually, I added code to the subroutine that turns off the oscillator, so that interrupts would be ignored for about a second after the oscillator was turned off. This has finally solved the problem.
AT90S2313 Pins 17. 18. and 19 are drive the three line Microwire interface to the LMX1601. Pins 13 and 14 have internal pullups and are connected to the two pushbuttons, the other end of which are grounded.
The output of the crystal oscillator on the AT90S2313 drives the oscillator input of the LMX1601. The accuracy of the synthesizer's output is the same, in PPM, as the accuracy of the 4 MHz oscillator. You could select or trim the capacitors from pins 4 and 5 of the AT90S2313 if your 4 MHz crystal is close enough, or if you have several crystals to choose from, you could do as I did, which was to go through a pile of 4 MHz crystals until I found one that was within a few Hz of 4 Mhz in this circuit.
While on the subject of the microcontroller, I used an AT902313-10, which is specified to operate wtih a power supply voltage of 4 to 6 volts. I am lucky that this chip works at 3 volts, though I suspect many do. If you don't what this element of risk in your version, I suggest that you use either the 4 MHz version of the AT90S2313 or an ATtiny2313. Both the 10 Mhz and 20 MHz versions of the ATtiny2313 will operate from the 3 volt power suppply.
LMX1601 pin 7 is the phase comparitor output, which is a current pump. A .0047 uf and a 22 uf capacitor make up the loop filter, creating a voltage that is supplied to the left end of the 10k resistor. The right end of the 10k resistor connects to the varactors in the VCO through a low pass filter, to control the VCO's oscillation frequency. Also connected to the right side of the 10k resistor is a 50 k resistor that is in series with a 20k resistor paralleled with a .01 uf capacitor. This is where AC coupled audio is mixed with the VCO frequency control voltage. That's how the oscillator's frequency gets modulated.
The combination 50k, 20k, and .01 uf sets both the modulation sensitivity and the frequency response of the audio signal. I started with a 75 microsecond time constant in this circuit, which is the standard pre emphasis in Europe, but the signal sounded too tinny, so I raised the time constant to one that sounded better, and limited the amount of boost to about 3:1 with the resistor ratio. What I have sounds ok for the kind of audio material I listen the condition of my hearing. You might want to experiment with other time constants and ratios.
The audio input is through a stereo jack. The left and right signals are summed in the two 150 Ohm resistors, and the voltage swing at the point the signals are summed is limited to two diode drops peak-to-peak, or about 1.2 volts peak-to-peak. That might be a nice thing to do, as it could keep the FM signal from splattering all over the VCO's range if the audio input signal is cranked up too high, but I really put the diodes there to protect the LMX1601's phase comparitor output from electrostatic discharge. While in the early stages of this development, I "frapped" the phase comparitor output, and both the decision to replace the chip and the actual act were both unpleasant, and this clipper is meant to avoid future accidents.
The VCO is a modified Clapp oscillator, and by making both capacitors varactors, the oscillator can tune across the entire 88Mhz to 108 MHz FM broadcast band. The left-most 2N5485 JFET is the oscillator transistor. Its source resistor is the collector load of the 2N2222. When the 2N2222 is no biased on, the oscillator does not oscillate. When it is biased on, the oscillator does oscillate. That way, I can switch the oscillator on and off without having to switch the 3 volt power supply on an off.
A second 2N5485, the right-most JFET, buffers the sine wave on the gate of the oscillator JFET. This signal is much lower in harmonic distortion than the signal on the drain. The 130 and 50 Ohm source resistor form a divider that reduces the amplitude of the oscillator's output to within the range specified on the LMX1601's data sheet, and this signal across the 50 Ohm resistor is AC coupled to the LMX1601's Fin Aux input, where is conditioned and applied to the divide by 8 prescaler and then to the AUX N divider, to complete the phase locked loop.
The larger signal on the source is capacitively coupled to an RCA connector, to which a small antenna may be attached, if needed. The two 1N5711 Schottky diodes limit the voltage on the source to between one Schottky diode drop below ground and one Schottky diode drop above the 3 volt power supply. It is my expectation that in the event of an electrostatic discharge into the antenna terminal, most of the discharge current will go into the ground or the power supply, rather than into the buffer, or even worse, through the source resistor, and into the LMX1601.
The piezoelectric transducer serves to make button clicks when the button contacts close. It also beeps for a moment when power is first applied and when a new frequency selection is written to the EEPROM. The piezoelectric transducer and its drive circuit can be eliminated if you don't want it. If you do use the transducer, and if it sounds too quiet, you can find the place in the assembly code that adjusts the tone frequency to get a frequency closer to your transducer's peak. There is a comment in the code, so it won't be hard to find.
Total current drawn from the circuit while the oscillator is on, is only 30 to 35 milliamps. This means that it can be operated for a while from a 9 volt transitor radio battery, which I did occasionally during tests.
The LED, or "Status LED" as it is referred to in the code, has two die inside. One red, and the other blue. The LED indicates the following conditions:
• Dark: No power is applied to the circuit.
• Steady red: Power is applied and oscillator is off.
• Steady blue: Oscillator is on and a audio signal is not detected.
• Blue, occasionally blinking red: Oscillator is on and an audio signal is being detected.
You can leave the LED off altogether, but the audio signal detection is very helpful in adjusting the volume of the audio signal. The LEd could also just be a single color LED, in which case, a singled LED would be connected such that it is on when the oscillator is on, and blinks to dark when audio is detected. If you can view QuickTime files, you might want to see the somewhat cheesy demonstration of audio detection by clicking on the image below.
The VCO, which was built on a separate piece of copper clad circuit board was soldered onto the PLL PCB using thin copper strips to assure a low impedance connection. The PLL printed circuit board was mounted on a piece of punched phenolic board with one pad per hole. The phenolic board which includes the power supply, audio circuit, and the LED and piezoelectric driver circuits, was mounted in the plastic box. You can see from the enlarged version of Photo 2 there are some air circuits -where components hang in the air between points.
Wire harnesses and
connectors were used so that the circuit board could be completely detached
from the enclosure. Liberal use was made of heat shrink tubing to
assure that wires would not break off at their solder points. The
piezoelectric transducer is glued to the cover with cyanoacrylate
(Super glue), with its output aperture centered over the hole in the cover.
The red connector shown at the top of Photo 2 is the antenna connector. A length of insulated wire is attached to it. If, and this is a big "if". the power cable and the audio cable provided a suitable ground image of the radiating element, an optimum length for the antenna wire would be 1/4 wavelength, or 75 cm at 100 Mhz. It might well be that your won't need an antenna at all. If you are going to use this within a few meters of the receiver, then don't bother with an antenna. There is no point in your neighbors fully appreciating your taste in music or audio programming.
The phenolic board was hand wired point-to-point, mostly on the back. There are some colored wires on the top of the board that connect the LED, piezoelectric transducer, and audio circuits to the microcontroller, and that is because its only a one-sided board with no holes.
The colors of the wire are merely a function
of which workbench I sat at while putting
them in place.
One thing to remember while building this, is to keep the circuit board and your soldering iron grounded to the same point.
User Interface (How to use it).
Here are the rules of operation - a way to describe how the microcontroller controls the transmitter and how the user interacts with the microcontroller. In the description that follows, when the oscillator is on, audio signals applied to the audio input will be transmitted.
It is important to press the frequency increment button, hold it down, then hold down the frequency decrement button right after POWER IS APPLIED FOR THE FIRST TIME and BEFORE AN ANTENNA IS CONNECTED. This sets the transmit frequency to 100.0 MHz. Before this initialization, the frequency could be outside the FM broadcast band.
When power is first applied, the oscillator is turned on and the LED illuminates with blue , and it will remain on for 5 minutes, even is no audio is applied. If audio of sufficient amplitude to trip the comparitor is applied, the LED will wink red on audio peaks and the 5 minute time will be reset. Audio applied to the audio input will be transmitted on the transmit frequency that was last saved in nonvolatile memory. This is the typical mode of operation.
After 5 minutes without audio of sufficient amplitude to trip the comparitor, the LED will turn red and the oscillator will turn off.
If audio is applied after the oscillator is shut off, the oscillator will turn on again and the LED will turn blue, and it will blink red occasionally to indicate that audio of sufficient amplitude to keep the 5 minute timer from time out is present.
When the frequency increment button is pressed, the transmit frequency will increase by 100 KHz, unless the transmit frequency is already 108.0 MHz.
When the frequency decrement button is pressed, the transmit frequency will decrease by 100 KHz, unless the transmit frequency is already 88.0 MHz.
When either then frequency increment button of the frequency decrement button is held down, then the other button is held down, the frequency will be reset to 100.0 Mhz.
When 30 seconds elapses after a button depression, during which period another button is not encountered, the then current transmit frequency will be stored in nonvolatile memory.
Now, with this crystal controlled transmitter, I can use a wireless headset to listen to internet audio feeds while in a large city, where the band is completely jamed with both legitimate and the occasional bootleg radio stations. This low power transmitter can be nestled in a reasonably quiet slot between the competing behemoth signals, and since its crystal controlled, I know it will be in the same place, day after day. Similarly, using the LED indicator, I can set up the transmitter in my workshop and be confident that I will find it on the assigned frequency, with the right modulation level, when I switch on the radio on the front porch.
A note after using this transmitter for four months: The transmitter is connected to the audio output of my main desktop computer, and it has been this way for four months. This means that I listen the alert sounds as well as the rest of the audio from the computer through an FM radio. The transmitter comes on fast enough that I catch the system beeps, etc. One of the nicest aspects of having this transmitter is that if I have to leave the room - go to the bedroom, kitchen, or even outside - while listening to an internet radio program (a important source of English language news and entertainment where I live), I just pick up a battery operated FM receiver and take it with me. This is one of the most useful projects I have made.
There are some simpler FM transmitter circuits on this web site. You may wish to click HOME to where you can find the other transmitters in the RF and Communications section of the index.
One other note - in the United States, low power FM transmitters operating under Part 15 are only allowed emissions within the band 88.0 MHz to 108.0 MHz. If the crystal oscillaor is exactly 4 MHz, setting the frequency to either 88.0 or 108.0 MHz is ok, but adding modulation would create sidebands outside the band. Just to stay on the safe side, avoid setting the transmitter to either 88.0 or 108.0 MHz. Perhaps a future version of the firmware will clip the available frequency range accordingly.
Remember - this circuit radiates radio signals. Its your responsibility to determine whether it is legal to operate this transmitter where you would be using it, and you are also responsible for taking any steps necessary to assure that this, or any transmitter you operate, is operated in full compliance with applicable laws.
PLL FM Transmitter using LMX1601, ATtiny2313 AT90S2313