30m PSK-31 Beacon

Finished Circuit Board

The original goal of this project was to create a simple VHF beacon to send up as a payload on a high altitude balloon, launched by a local ham radio club. However, I started my design process late and ran into quite a few problems, so I missed the launch date. No big deal: I instead decided to convert the project into a HF stationary beacon.

Choosing an operating mode:

When talking about beacons, the first modes that comes to mind are WSPR and CW. WSPR wouldn’t have been difficult to implement with an arduino and a Si5351, but many such WSPR beacons have already been built by others. Additionally, WSPR requires time synchronization to global time, which would increase the complexity of the project. A CW transmitter, similar to what I did in my fox transmitter, would have been a bit too simple to entertain me. I ended up choosing PSK-31 (my favorite digital mode) as it has good weak-signal performance, is resistant to fading, has narrow bandwidth, and is not too difficult to implement.

Generating Baseband Signals:

PSK, or phase shift keying, uses phase inversions of a carrier to represent bits of information. A 0 bit is represented by a phase inversion, and a 1 bit is represented by no phase inversion. PSK-31 transmits these bits at a baud rate of 31.25 Hz. This is equivalent to a bit being sent every 32 ms.

The usual way which PSK-31 is generated is through a modulated audio frequency waveform. (from your PC soundcard) The PC can generate the phase inversions in the audio carrier, as well as apply waveform shaping to the signal. This is then fed into a SSB transmitter to be brought up to radio frequency.

Waveform

However, the microcontroller I’m using (ATMega328p) doesn’t have an true audio/analog output. Hence, I decided to just let the uController switch the state of a pin (from high to low, or from low to high) to represent phase inversions. This will later be XOR’d with the RF carrier to make phase inversions.

The first part of the arduino sketch converts your message’s ASCII characters into varicode, ones and zeroes that represent phase inversion or no phase inversion. (The table used for this conversion is from F4GOJ’s library of digital mode beacons.) Then, every 32 ms, the selected output pin’s state is flipped IF the current bit to be transmitted is a 0.

Modulating the RF:

The RF frequency that the beacon is transmitting on is generated by a Si5351 clock generator, controlled by the ATMega328p. The phase inversions are generated by XOR’ing the baseband signal with the RF carrier. I used a SN74LVC2G86DCTR dual XOR gate for its fast switching speed, and 24mA output capability (compared to 8mA for traditional HC logic devices). Even though the power for the XOR gate was supplied with 5V, it accepted the 3.3V output of the Si5351 without issue.

XOR Output Note that the Si5351 and XOR gate are not really restricted in frequency range. The Si5351 works up to 200MHz, and I tested the XOR gate up to 60MHz without issue. The only frequency dependent parts of the build are the amplifier and the low pass filter.

Power Amplifier:

I wanted the power amplifier to be efficient, so it wouldn’t require a large heatsink. Additionally, this amplifier does not need to be linear, and only needs to work at one specific frequency. So I chose to go with Class E for its efficiency. I was targeting an output power of 1-2 watts.

I took inspiration from N7VE’s presentation on QRP Class E amplifiers, and used two small 2N7002 mosfets as the switching transistors. They’re cheap, have fast switching times, and operate with logic level inputs. I then used this class E calculator to design an amplifier for 10.140 MHz, a 9V supply voltage, and a 2W output.

Class E Amplifier Circuit

Since I used a dual XOR gate and I had to drive 2 mosfets, I just connected one XOR output to each mosfet. This made more sense than tying the 2 logic outputs in parallel, which may not be good for the XOR gate. The 2N7002 mosfets switched on well with 5V, (and I tested, they also switch on well with 3.3V).

Testing the amplifier I built, it initially did not work well at the frequency I intended (~10.140 MHz). The class E amp seemed to be tuned more towards 8 or 9 MHz. I fixed this by unwinding turns off of L2 (the inductor in the series LC) until it worked well at 10.140MHz. I verified that the voltage waveform at the drain of the mosfets was correct, according to Fig. 6 from this paper. The output power varied between 1-2W depending on the supply voltage, 7-10V. The simulated efficiency in LTSpice was around ~85%, and in reality it turned out to be around 80%. The small smd mosfets remained cool in operation.

This image shows the voltage waveforms of the voltage at the source (in blue) and the output waveform without filtering (in yellow).

Voltage Waveforms

You can see the phase inversion in the RF signal as the uController flips the state of the phase controlling pin:

RF Phase Inversion

You may have noticed the output waveform is very messy and rich with harmonics. This is typical of switching amplifiers like Class E. So I designed a low pass filter to filter the harmonics, and simulaneously change the ~20 ohm output impedance of the amplifier to 50 ohm output. You can see the filter cleaned up most of the harmonic content at the output (it’s still not perfect though):

Cleaned Up Signal

Unfortunately the filter seemed to have decreased the efficiency of the amplifier. You can see the voltage waveform at the drain changed. The mosfets began getting hot, so I put a small heatsink on them. I am not sure why this happened. Perhaps using a broadband transformer to do the impedance transformation would have helped.

Waveform Shaping:

If a carrier wave is instantaneously flipped in phase, this generates an splatter in the frequency spectrum, increasing the signal’s bandwidth. This can be avoided by lowering the amplitude of the wave leading up to the flip, so that the phase flip occurs when the amplitude of the wave is zero. Then the amplitude is brought back up. The ideal amplitude waveform to do this with is a raised cosine (it decreases like a cosine before the flip, after the flip increases like a sine). Usually this is done by your PC, modulating the audio that comes out of your soundcard. However, since the Class E amplifier I used is not linear, this amplitude modulation must be done by modulating the voltage supplied to the amplifier.

How did I make the raised cosine type waveforms to modulate the amplifier? Well… first I tried letting the uController make the waveforms with PWM. This vaguely made the right waveforms, but failed because the uController was not able to accurately control the length of the pulses.

Failed Pulses

Then I tried to make half sine waves by rectifying a sine wave. The sine wave was generated by filtering square waves generated by the uController and rectified by an opamp full bridge rectifier. However, trying to get all the filtering, DC biasing, and amplification right ended up being too hopelessly complex. (See the circuit I designed in LTSPICE). This picture shows the best that I could make this circuit work:

Best I Could Do

I ended up, instead of using sinusoidal-like waveforms, using trapezoid-like waveforms. This was done fairly simply by using an opamp integrator to generate ramps up and down. The uController sets the input of the integrator low to ramp up voltage at the output (the integrator is an inverting configuration) and vice versa, creating triangle/trapezoid waveforms. The R and C values needed in the integrator were estimated by the fact that Vin x 16 milliseconds / RC should equal the value of Vcc. (where Vin is the difference between bias voltage and input voltage- in this case 5V-2.5V = 2.5V). Potentiometers were added and adjusted to make the trapezoids symmetrical, and reach (near) zero at phase switching time.

Trapezoidal Waveforms

This trapezoid wave from the output of the opamp is fed into the base of a TIP31 transistor configured as a voltage follower. (Collector connected to Vcc, emitter connected to the voltage input of amplifier along with some decoupling capacitors to ground)

Putting it together:

The circuit was built on a 7cm x 10cm single side copper clad board. A dremel was used to etch islands on the copper to place components. I designed an enclosure for the project in FreeCAD, which was 3D printed in clear PETG. This enclosure has space to fit 2x3AAA battery holders, a power switch to switch between external power and battery power, a 0.5 amp fuse, a BNC connector, and the circuit itself.

Circuit and Enclosure

Testing, lessons learned, additional notes:

I first verified that the PSK data being generated by the uController was working by transmitting into a dummy load. My radio, right next to it but not connected, tuned into the TX frequency, could hear it, and FLDIGI was able to decode the signals. Looking at the waterfall in FLDIGI, it is not a perfect PSK signal that looks like a set of railroad tracks. It has some splatter, which I suspect is a result of the trapezoid shaped modulation rather than the phase flips.

After tuning my 30m dipole, I put the beacon on air on August 3rd, transmitting on 10.148MHz. Its 1-2 watt output could (barely) be heard by someone in Plano, and likewise could barely be heard by websdr stations in Arizona and Utah. I will need to test again for actual signal reports sometime. Maybe with more power or a better antenna.

Overall, this project was a bit frustrating because it took much longer than I had planned, but I learned quite a few valuable lessons which may be of interest to the reader:

  1. The Arduino uno/nano/ATMega328p’s timers/interrupts are not fast enough to be used accurately for making analog waveforms with PWM. I suspect the Raspberry Pi Pico is better at this.

  2. It was neccesary to store the ASCII –> varicode conversion table in the uController’s program memory instead of RAM. Otherwise, the uController would run out of RAM and the sent characters would be corrupted.

  3. Rail to rail output opamps DON’T neccesarily have rail to rail inputs. I did not know this while attempting to use a TL974IN quad opamp to do the waveform shaping… leading me to wonder why the circuit didn’t work.

  4. Use IC sockets, especially for the microcontroller. Every time I wanted to reprogram the microcontroller I just pulled the IC out and put it into the IC socket of my Arduino Uno to program it.

  5. At the beginning of the project I used a P-channel Mosfet to build a simple reverse polarity protector (Fig. 5) on the voltage supply “rail” of my board. This saved my board at least twice when I accidentally connected power backwards.

Hope this article was useful if you want to homebrew a similar beacon. You can download my arduino sketch and enclosure stl’s here.