Thursday, September 23, 2010

A long time ago......

In a basement not too far away.....

My friend Dave, KM3T, runs a very cool website called Liveatc.net. Dave has volunteers all over the world with VHF aircraft band receivers that stream live air traffic control traffic to his website. You can select any number of frequencies to listen to. In addition to the normal VHF traffic, Dave has an aircraft HF audio feed. The receiver is a Yaesu FT-817, which I am a proud owner of two. He mentioned to me casually that he changes frequency throughout the course of the day to follow propagation. Now, that intrigued me; how did he change the frequency remotely? Well, it turns out that the Yaesu rig supports CAT commands which is an rs-232 control protocol to change frequency  and modes, etc. Dave used hamlib, which is a set of libraries for linux to provide a common programming interface to various receivers and transceivers.

The concept of having a remotely controlled receiver really caught my attention, and shortly afterwards I started to talk with Jay, AB1II, about how we could do something similar. I quickly set up the streaming audio server on my home linux server and began listening to it remotely from work. The issue of changing frequency and mode was going to take some work, so I asked Jay if he could take a look at hamlib and see if we could come up with some basic utilities to change freq and mode. Jay is a programmer by trade, and within a short period of time he wrote the  utilities to control the receiver remotely via command line!

This was great! Being able to listen to HF while at work was a big bonus, especially when you need to put your headphones on and dig into a project (Coding for Jay, a spreadsheet for me).

Now, at that point we could have been happy and just walked away, but I figured we should push forward and keep adding features. The first feature was fairly obvious; make a web interface so we didn't have to ssh into the machine and have to remember command line arguments. I had been looking for an opportunity to learn PHP programming, so I decided to take this task on. After beating my head against the wall for a bit I had an interface up and running that allowed you to change the frequency via a text input box, as well as change mode.

The original FT-817 interface with shortcuts to well known frequencies
Wow, this is cool!

Some time lapsed and a few new folks started to use the receiver. I had been very busy with other projects and let this project fall by the wayside. Pretty soon I started to get the itch to continue with the project, but I wasn't really sure which direction to move in. I was also thinking at the same time that a Yaesu FT-817 is an awfully nice radio to be relegated to just being just a receiver. I use my other FT-817 on my 10GHz microwave rig. I decided the FT-817 would be replaced with the very nice AOR AR-5000 receiver that I had picked up last year, and hardly used at all. The AR-5000 would receive everything from 10khz up to 2.6GHz.


The AOR AR5000+3 capable of all modes from 10k to 2.6GHz
Ok, that makes sense, it's a receiver that's been sitting on a shelf for over a year, lets give it some use! But what a waste it would be if it were to only be used for HF! Wouldn't it be great if we could switch back and forth between several different antennas and maybe take advantage of the VHF/UHF side of the receiver as well?

Over the years I've been collecting multi-position RF relays for microwave projects, or switching IF lines for my microwave transverters.

6 position RF relay, 28v coil and 5v TTL to switch position
These relays are fairly simple, most of them require +28v @300ma to close the coil and switch to one of the positions. The relay shown in the picture is slightly different, it takes +28v @300ma at the coil plus 5v TTL to switch the position. Now, what would I use to switch positions? I had been poking around on the web and had been seeing lots of information about an open-source micro-controller available called the Arduino. I started looking closer at it and it turns out that it would be fairly simple to get the Arduino to interface with the relay. The Arduino board that I used was called a Duemillenove which has 14 digital I/O pins (TTL), plus 6 analog I/O lines. But.....It would require some software to be written! Now, I didn't exactly write the most elegant PHP code when I did the web interface for the radio, I wasn't sure my programming skills were up to the task to take on this micro-controller.

The Arduino, thankfully, has an extremely easy to use programming language. So, I ordered one and took the plunge. To my extreme amazement, I was able to write a working program in about 30 minutes from knowing absolutely nothing about the language to finish! Ok, proof of concept partially complete.

The Arduino Duemillanove mounted in a Hammond aluminium enclosure


Next, how to send data from the linux machine over to the Arduino? The Arduino has a built in USB-serial chip that you use as the main programming interface, but it can also be used to communicate directly with the processor as well. There are some basic serial commands in the programming language that allow you to send and receive data. I found a little command line utility that let me send data over the USB-serial connection, and before long I could now switch antenna positions from the command line.

Next, I discovered there was actually a serial PHP class that would allow me to access the serial port from within my PHP script. Cool!

So, now the web interface allows you to change frequency, mode and now Antenna. Of course, I've been so busy getting the code working I now need to make up a number of cables to the receiver can have access to array of receive antennas on my roof.
Remote control app with antenna selection

In a future post I'll send a URL for my code, once it's been cleaned up.

In the end, I'm amazed at how easy it was to accomplish the task of interfacing a relay to the web interface. Working with the Arduino is very easy, and it's really opened a number of doors for me. Two other projects that I plan on doing are making a beacon keyer for my future 10m beacon, plus it should be simple to make a basic electronic keyer! I just read about a MP3 shield that is available now for not much money, so I could also think about building an external voice keyer.

The options are endless with this little board.....

System Schematic

No comments:

Post a Comment

Post a Comment