Marzo 2015

I fixed my radio transmitter

(This was originally posted on Google+.)

Well, I finally looked carefully at the signal coming out of my antenna and, yes, it turned out that most of the energy was being spent outside of the frequency I wanted to transmit on. However, it wasn't because of images and spurious transmissions that took most of the energy... It was because I was actually transmitting on the wrong frequency!

Keep reading because it wasn't just a case of "herp, derp, turned the knob to the wrong position."

In Software Defined Radio we work with quite basic transceivers whose mission is to receive a radio signal and transform it into a form a computer can process, and vice versa. To do that, a lot of mathematics are used in the computer, using something we call "complex numbers". Those complex numbers have two components: a real part and an imaginary part (the name "imaginary" was given to it when mathematicians didn't understand complex numbers yet, so they thought those numbers were less "real" than the numbers they had been using up to that point, but I digress).

So an SDR radio receiver takes a radio signal, does some electronic manipulations, and generates two signals that are converted into complex numbers by the computer. One of those signals, called I, will become those numbers' real parts, and the other signal, called Q, will become the imaginary parts.

When it's time to transmit, the computer takes the complex numbers' real parts and generates an I signal, and also generates a corresponding Q signal from the same numbers' imaginary parts. Those two signals go to the SDR transmitter, undergo some electronic transformations, and become a radio signal.

The problem with my setup was that the wires for the I and Q signals were crossed in the transmit path.

The effect of this is that the signal went out on the wrong frequency. Generally I had my "center frequency" set to 14.080 MHz and my transmit frequency set to 14.097 MHz. However, as I and Q were crossed, the transmitter took the real part as imaginary and the imaginary part as real, which mirrored the transmitted signal around the center frequency, and my transmission went out on 14.063 MHz. Oops!

Fortunately for me, I was transmitting with a small magnetic loop antenna, which has limited bandwidth (I explained this yesterday), so it is likely that only a very small fraction of this out-of-frequency signal actually went on the air, and the rest was converted to heat in the antenna.

Now, I don't know if I've mentioned this, but my signals had actually been received three or four times in the past two weeks. Also, when I used a shortwave radio to listen to my transmissions, I could hear my signal clearly on the right frequency. It's natural that you'd ask how this would be possible, if the signal was going out on the wrong frequency.

The answer is simple: before the complex numbers coming out of my computer get into the transmitter, they first go through a sound card, where they get turned into the I and Q electrical signals, and then they travel to the transmitter through audio cables. Stereo audio cables, to be precise, that have three wires: a ground wire, a wire for the left speaker, and a wire for the right speaker. In this setup, one of the speaker wires carries the I signal, and the other carries the Q signal. When you have two wires running in parallel carrying alternating currents, they induce small currents on each other, which causes a little bit of crosstalk.

So, with this crosstalk, by the time the signals arrive at the radio transmitter, the wire for the I signal will also carry a little bit of Q signal mixed in and vice versa, and when it's finally transmitted, there will be a tiny signal in the originally intended frequency. I could hear it on my radio because it was very close to the antenna, and it was sometimes heard farther away because I was using WSPR (pronounced "whisper"), a digital mode intended for low-power signals, so the people who received those signals were already listening for very faint transmissions.

After fixing this issue I sent another transmission through WSPR. This time, four stations heard me at once; the farthest of those stations was in Alaska. My second signal was heard in New Zealand. Both were transmitted with 1 watt of power. I think it is safe to say that both my transmitter and my homemade antenna work correctly now :)

And now I have a 50-watt amplifier to fix.

Improving my homemade amateur radio antenna

(This was originally posted on Google+.)

Yesterday I worked a bit on my magnetic loop antenna. More properly called a "small magnetic loop antenna" (or SMLA for short), it basically consists of a long loop of wire connected to a variable capacitor. The loop of wire forms an inductance, which together with the capacitance forms a resonant circuit. So by wiring it appropriately, you can use a SMLA to receive and transmit signals in the SMLA's resonant frequency, which you can change by turning a knob to vary the capacitance.

As you might guess, the more resonant the antenna is, the better it works: the signals in that frequency are amplified more. Also, when the antenna is more resonant it has narrower bandwidth: the energy in the antenna is concentrated into a smaller band of frequencies. The amount of resonance is given by a number called "quality factor" (or Q, for short). Q is affected by the values of the inductance, capacitance, and resistance in the SMLA. In particular, the lower the resistance, the higher Q is. So if you make an SMLA you need to reduce the electric resistance as much as you can to get the best value of Q.

There is another reason why it's important to reduce the electric resistance if you want to make a transmitting SMLA: the antenna's radiation resistance is very small, in the order of milliohms, so any additional resistance reduces the antenna's efficiency dramatically.

People like me, who are used to dealing with continuous currents, would think that it would be enough to use wide-gauge wiring, solder all connections to reduce contact losses, etc. A couple of weeks ago I measured my SMLA's resistance as 50 milliohms, which doesn't sound so bad; however my antenna's Q factor seemed quite low and my transmissions were heard by nobody.

What I'd missed is that alternating currents (and radio waves in a cable are alternating currents) don't travel along the full section of the cable, like continuous currents: there's a phenomenon called "skin effect" by which those currents only travel on the surface of the conductor. The higher the frequency, the shallower the skin: for example, in copper, at 14 MHz, most of the current is concentrated at a depth of less than 17 micrometers.

The first consequence of this is that the resistance of a wire doesn't go down with the square of the diameter of its section as for continuous currents, but linearly with the diameter. So using wide gauge wire doesn't help much. What you need to use instead is flat ribbon or, even better, copper braid: braid has a lot of surface area for its volume, so it should present a low resistance to alternating current.

The second consequence is that you should avoid solder joints: since the current travels on the surface, spots where the surface is tinned will have a lower conductivity than the bare copper surface.

So yesterday I remade the connections between the loop and the capacitor in my SMLA, replacing the 10-AWG wires with copper braid ribbons. I fastened them using screws and washers so that they were pressed against the terminals on the ends of the loop and the capacitor, making sure that as much surface area as possible touches.

This change has apparently raised my SMLA's Q factor: I can work on about 40kHz before having to retune, while before I could use some 60kHz. I hoped that transmit performance would also be improved, but, alas, nobody heard my transmissions the whole day today. I guess my antenna is not good enough yet.

There may be another explanation for this failure to be heard, though. Using a shortwave receiver I could hear spurious signals around the signal I wanted to transmit. Using an RTLSDR dongle I could see the spectrum around the frequency my transceiver was tuned to, and there were lots of spurs and images on transmit. I don't know if it's a fault in the particular transceiver kit I'm using, or whether it's a drawback of the design itself. In any case, this suggests to me that perhaps too much energy is being wasted on those spurs. That's certainly something I'll need to look at again and more carefully.

Why a radio signal carrying Morse Code is called Continuous Wave even though it's turned on and off

(Originally published on Google+.)

As you may know, lately I'm into amateur radio. In this world, Morse code is still alive and well, though it is not necessary to learn it to get a license. When two operators use Morse code to communicate, quite often they use a mode called "Continuous Wave", or CW for short.

For quite a while I thought that CW was quite an odd name for a way to transmit Morse code. There's certainly a wave: that's the radio wave on which the Morse code is modulated. What I didn't see so clearly was the reason for the "continuous" adjective. After all, the wave is being turned on and off all the time: that's precisely how you can send Morse. If it's being turned on and off, it's not continuous. What's the deal?

Well, the deal is that before we had continuous waves, we already had Morse code on the radio, transmitted with a different kind of radio wave: the Damped Wave.

A Continuous Wave is a sinusoidal wave with a precise frequency. Nowadays it's very easy for us to produce precise and stable sinusoidal waves using pretty cheap electronics. However, in the early days of radio it wasn't so: there weren't good enough electronic oscillator circuits that could produce a quality continuous wave. So radio stations used a different mechanism to produce a different kind of radio waves.

This mechanism was the spark-gap transmitter. The general idea is that a high voltage across a gap produces an electric arc (a spark). The transmitter contains a circuit that, when an arc starts, produces a "ringing" oscillation, like the sound of a bell being struck once by a hammer. This oscillation is fed to an antenna to transmit it as a radio wave, which is called a "damped wave" because it loses amplitude with time, just like the sound of a bell stroke.

As the damped wave only lasts for a tiny fraction of a second, the spark gap is set up so that those sparks are extinguished almost as soon as they start, and a new one starts almost immediately, which produces another damped wave. In this way, lots of damped waves are produced and transmitted every second, like a school bell ringing seemingly continuously because its hammer strikes the bell several times per second.

The problem with spark-gap transmitters is that they are very inefficient and produce a prodigious amount of interference, so a lot of effort was spent in discovering a good way to generate a "continuous wave" that doesn't lose strength with time so you only need to produce the one wave and turn it on and off as needed.

Eventually, several systems were developed, like high-frequency electric generators, electronic oscillators, etc. As those became commonplace, the old spark-gap transmitters and the damped waves they produced were retired and then banned worldwide (so big was the interference problem).

And that's why a radio signal carrying Morse Code is called Continuous Wave even though it's turned on and off.