The idea for this project stems from the fact that certain characters sent across a UART serial line combine with the start and stop bits to produce bursts of a square wave at half the baud rate.
These sequences each emit different power at the fundamental frequency (1/2 of the baud rate). In fact, a sequence of 0x55 characters sent across a UART serial line produces a continuous square wave at this frequency - the stop and start bits of subsequent characters are sent with no intervening space. Shown below was an example at 19.2k, producing a 9600Hz square wave. If we crank the baud rate high enough, we can use this to transmit RF signals. The square waves form TTL-level USB-UART bridges also have strong harmonics with which we can reach higher frequencies.
The five different bit patterns each produce their own level of the fundamental frequency and sub-harmonics. You can see the power differences in this capture from GQRX, using a baud rate of 2000000, for an output fundamental at 1 MHz. Each bit pattern was sent continuously for 1 second, with a short space in between.
As expected, the longer patterns have more power. You might expect the 0x55 pattern to bet detected with an AM receiver with an equivalent of around 5x that of the 0xff pattern (5 cycles vs 1 cycle). This 5x amplitude is 25x the power, or around +14dB. This is exactly what you observe in GQRX for the received signal.
Simulating the output spectra using a continuous Fourier transform for the piecewise-linear signal waveforms also predicts this difference. Here are the bit patterns, along with their respective spectra:
You can see from the annotated power levels that the difference in fundamental power between the 0xff and 0x55 patterns is estimated to be 13.9dB, right where we would intuitively expect it.
For our purposes, we'll ignore the sub-harmonics and concentrate on the fundamental and higher harmonics. Of course, this is just an experiment. If you really wanted to transmit anything with this project, you'd need to clean up the emissions by filtering and make sure you're operating in a band and at a power that you're legally authorized to use.
Unfortunately, there does not appear to be a way to easily send a zero-level signal on the fundamental without losing accurate timing of the samples. You can send a break "character" on the serial line, but this has two problems - first, it is not guaranteed to be an exact multiple of the character time, which makes it very difficult to keep an accurate sampling rate. Also, the break is an out-of-band signal from the software perspective, so you can't have an array of bytes with break "characters" intermixed. This slows streaming of data to the UART. So, we are forced to settle for using 0xff as the "carrier off" pattern, accepting only 14dB of dynamic range in the RF signal (but we can use some tricks to achieve more range in the demodulated audio!).
You can also see from the plots that a lot of sub-harmonics are produced for all patterns except 0x55, which is a continuous square wave. In this case, only odd harmonics are generated. If we zoom out in GQRX, we can observe the same thing experimentally:
You can see how the sub-harmonics really drop off with the 0x55 pattern.
How do we use these bit patterns to generate an amplitude modulated radio signal? Or at least a signal that can be received by an AM detector?