Again, with a real antenna

A project log for Serial Port SDR

Transmit radio signals using just a serial port? You bet!

Ted YapoTed Yapo 12/05/2018 at 18:110 Comments

I used a return-loss bridge to test the dual-band antenna I had started using for the 27MHz RC experiments, and it was very bad.  Luckily I had an old CB antenna around, which is made for 27MHz: it showed a 21dB return loss, so the antenna is quite good.  Using this antenna, I get about 3 feet of range with just the serial port and the LC filter network (no amps).

That's it at the right side of the photo.  It has a magnetic base which attaches firmly to the steel table as a nice ground plane.  If I add the two amplifiers as before, I can control it all the way to the end of the lab - at least 20 feet.  I don't know how much further it would actually work, but that's good enough for me :-)

Replicating the Experiment

I also wanted to document exactly what I did to make this work, so anyone who wanted to replicate the experiment wouldn't have to stumble around like I did at first.  The first trick was finding the right RC toy.  I found the cheapest ones they had - not only to save cash, but because cheap ones are likely to have wide (non-selective) receivers, so the transmit frequency doesn't have to be exact.  A good clue about the one I selected was the "27 MHz" sticker on the box. 

They make different frequencies so you can race.  In the case of this model, there were "27 MHz" and "49 MHz" versions on the shelf.  This is much better than if they had "27.145MHz" vs "27.195MHz" or similar frequencies both in the 27MHz RC band - in that case, the receivers would have to respond only to a narrow band of frequencies which you might not hit with harmonics of the allowed serial port baud rates.

Signal Capture

Here are the GQRX settings I used to capture the signal.  I used an upconverter I built since I was also looking at the lower harmonics and fundamental, but for 27MHz you could use an RTL-SDR dongle directly.

It's just AM demodulation with the normal filter width and shape.  The file gets saved with 48kHz sampling and two channels, but this doesn't matter because the transmitter program resamples to 11025 Hz mono by default.

Signal Replay

To replay the signal, I used code from the GitHub repo - it's the same command used to transmit AM audio signals, except this time the signal is the one we recorded from the RC transmitter.  I used this command line to send the RF signal from the serial port:

./ -p /dev/ttyUSB0 -f 631e3 -l -m pdm recorded_codes.wav

This sends the output to the port on ttyUSB0 at a fundamental frequency of 631kHz using the 'pdm' modulation method.  In my early tests, I found the pdm method to work best, but this may vary with a number of factors.  I should revisit this at some point.  I found the 631kHz frequency by observing the GQRX display while transmitting unmodulated square waves with the other code in the GitHub repo:

./ /dev/ttyUSB0 631e3

I saw that this particular frequency had a harmonic very close to 27.145 MHz (666kHz was a close second).  Once I had captured some codes, it was easy to verify that 631kHz worked best.

Using just a jumper wire as an antenna, the toy truck has to be very close to the transmitter.  Having the antennas touching (even through the insulation) will let you know right away if it's working; then you can experiment with longer ranges.

Up Next

I keep talking about audio output from a serial port; I really need to write it up :-)

I have also made some progress on receiving RF with just a serial port.  I was lucky enough to catch Dominic Spill's talk at Supercon about "Ridiculous Radios" - I don't think it's on youtube yet, or I'd post a link.  Anyway, he covered some interesting radio receivers using digital circuits.  When I get a chance to watch it again, I'll check for clues that might help.

The additional problem I have here is that I can't sample the RX line without a start bit, and that's not guaranteed to happen just from received RF.  I've been playing with pumping in start bits from the TX line, while leaving the RX line free to receive signals during the serial frame.  We'll see how it turns out...I'm getting to use multi-threaded python, anyway, which is fun in itself.