a maximum input signal amplitude of 200 mV RMS. For
this reason, an attenuator with AC signal coupling is
provided on the audio inputs to the transmitter.
The transmitter has a TEB terminal which is not tied to
a Butterfly digital input in this configuration. It can be used
to monitor the ability of the transmitter’s phase lock loop
to lock in on the desired transmit frequency using the
currently selected transmitter “band.” The transmitter has
four possible bands used to cover the FM radio band from
87. 5 to 108 MHz. In this configuration, the optimal band
is selected based upon the frequency in use.
The NS73M transmits in stereo. It incorporates both
pre-emphasis and a pilot tone without any additional
external circuitry. The amplitude of the input signal
required to give 100% modulation is software selectable,
ranging from 100 mV RMS to 200 mV RMS. Typically,
you’d just plug a patch cable from the MP3 player into
the stereo audio input jack on the transmitter.
The software for the ATMega169 processor was written
in Bascom-AVR Basic. As this dialect of Basic is designed
for this family of processors, incorporates commands for I2C
communications, EEPROM access, and floating point math,
all of the tools are present to bring this project together
easily. You can focus your attention fully on understanding
the datasheet for the transmitter software control, and not on
language and hardware barriers to its implementation.
Neither the transmitter chip’s manufacturer’s nor the reseller’s
websites, nor Goggle turned up any pre-existing software
for interfacing with the chip in I2C mode, or for implementing a user tunable interface. With no working examples to
expand upon, close scrutiny of the datasheets and a little
trial and error were in order. Before long, the transmitter
was live with audio blaring from my nearby radio receiver.
The Basic code for this project is available on-line, and
can be easily ported to other languages. Having a fully
functional version to review will certainly pave the way
for those wishing to follow. A pre-compiled hex file is
also provided for those who do not have Bascom-AVR
available to them.
The transmission frequency is determined by a 14 bit
value uniquely determined for each frequency of interest.
It is used in setting the transmitter’s phase lock loop.
Floating point math is a must for these calculations.
Internally, the transmitter chip divides the FM radio band
into four overlapping sub-bands, which require two
additional bits when programming it. This data is dispersed
across three of the 13, eight-bit registers in the NS73M.
The Butterfly board has a 4 MBit DataFlash memory chip
in addition to the 512 byte EEPROM within the processor
itself. One could certainly calculate the frequency and
band data for each frequency and store them in memory,
recalling them as needed whenever the user selected a
new frequency to transmit on. However, the floating point
math instructions available — coupled with the speed of
the processor — make it easy to calculate the values
on-the-fly. No look-up tables were required.
In designing the software, I chose to use an index
pointing into the FM radio frequency band as the key
parameter. The FM band is divided into 206 steps, each 0.1
MHz, stepping upwards from a base frequency of 87. 5 MHz.
This pointer is a small integer, easily stored in a single byte.
Each press of the joystick simply bumps this pointer up or
down by one, with roll-over to wrap the frequency around at
both the high and low ends of the FM band. The processor
uses this pointer to calculate the actual frequency to be
displayed on the LCD (1 = 87. 5, 2 = 87. 6, … 206 = 108.0).
The frequency is then plugged into the PLL setup equations
to calculate the 14 bit value which generates that frequency.
It is desirable to have the unit power-up on the same
frequency it was last using. This is much more convenient
than retuning the transmitter to a quiet spot on an FM
radio each time it is used. By storing the frequency
pointer, only a single byte of EEPROM memory is required
for this purpose. The pointer method also saves you from
storing over 600 bytes of look-up table information, had
data tables been utilized.
The transmitter’s datasheets elude to using the TEB
signal to measuring the ability of the transmitter’s PLL to
lock in on the chosen frequency. If the PLL is having difficulty locking in and cannot obtain a stable transmission
frequency, one bumps the internal, sub-band selection up
or down until lock is obtained. I instead chose to measure
the frequency range over which the PLL could obtain a
lock while programmed for each of the four sub-bands.
The program selects the optimal sub-band from this
information and loads the correct sub-band selection
whenever a new frequency is selected by the user.
This project was designed with an MP3 player in
■ PHOTO 2. The AVR Butterfly demonstration and
evaluation board, incorporating an ATMega129
processor, LCD, joystick, DataFlash memory chip,
piezo-electric beeper, and coin battery.
May 2008 35