Sunday, March 14, 2010

Well YES, actually, this IS rocket science...

OK, maybe not exactly rocket science but close enough. Ever since I started working satellites back in the early nineties I've dreamed of having a fully automated setup. A computer aims the antennas and tunes the radio to compensate for the doppler shift and all I have to do is sit back and make contacts. Doing everything manually during a pass and trying to log contacts at the same time can sometimes be reminiscent of the proverbial one-armed paper hanger, especially when it is a fast moving LEO bird like VO-52!

Learning the code...

No, not THAT code. I'm talking about the kind of code that computers understand. I taught myself to program in BASIC as a teenager back in the early 1980's. My Radio Shack TRS-80 Level II had a whopping 4K of RAM and, for it's time, could do amazing things. A decade later I decided to dust off my old programming skills and write a Windows program that would handle the doppler tuning for my satellite receiver, a Yaesu FRG-8800 with a built-in UHF converter. Much to my dismay, it was only AFTER I took the shrink wrap off my brand new copy of Visual Basic 3.0 that I found out only the much more expensive Visual Basic Professional version included the trivial ability to talk to a serial port! Dejected and thoroughly ticked off, I ended up doing the project in QuickBasic under MS-DOS by starting with a version of G3RUH's PLAN13 tracking software and adding in code to calculate the doppler shift and send the frequency data to the radio's CAT port. That worked pretty well and eventually, when the first version of ZL2TPO's WiSP came out I did finally find a way to use VB 3.0 with a serial port and wrote a little Windows application that tuned the radio based on tracking data passed from WiSP via the Windows DDE interface.

Garbage in, garbage out...

So automated doppler tuning was never that big of a deal but the real holy grail was automated antenna tracking. Back then there were a several options available (most notably the legendary Kansas City Tracker board) but they all had one thing in common. They all assumed that the operator was using a Yaesu G5500 az/el rotator setup. Pretty safe bet because I'll bet that 99% of stations were and still do use that rotator combo to this day. Now it was pretty easy to adapt the control boards to any rotators that used a 0-5V position feedback system and that was central to my problem. Expensive rotators (and for that matter, expensive computer control boards!) have always been a bit too pricey for my budget and I've always gotten by with cheap TV antenna rotators that have no positive feedback. Getting a $50 TV antenna rotator to turn a huge VHF/UHF antenna array is a tricky business and I've always figured that if it died on the job, at most I'd only be out fifty bucks to replace it. But unless I could find a way to get accurate position feedback I'd be out of luck for an automated tracking solution. In the wind and cold there was just no way to predict how far the antennas would actually turn and the indicator on the control box was almost always out of sync.

The light bulb comes on...

When I built my new satellite antenna setup last year, one of my stated goals was to find a way to automate the station. CX6DD's WiSPDDE software was quickly put to use to handle doppler tuning the TS-2000 but since I used yet another cheap TV antenna rotator I was still at square-one for automated antennas. Well, almost at square-one. One of the nifty devices I had come across in my travels was the LabJack U3. This dandy little device would plug into a USB port and provided a plethora of analog and digital inputs and outputs for interfacing to the real world. I knew the moment I saw it that this was the gizmo to solve my antenna interfacing problems. My new antennas were using an old TV dish actuator arm for elevation. This had a little slotted wheel inside between an LED and a photoresistor and when the jackscrew turned it would send pulses down the wire to the control box. Looking at it reminded me of the insides of a computer mouse and that's when I started to get an idea of how to make this all work together. If I took some parts from an old computer mouse and somehow hooked the wheel up to the antenna mast with a belt it would send pulses as it rotated in azimuth just like the elevation jackscrew. All I would need to do is brew up some software to talk to the LabJack, throw in a few relays and I'd have it made.

Inspiration...

The LabJack unit and pieces of an old mouse sat in a little box near my desk for a long time waiting for the moment when I would figure out how to physically put it all together in a way that was mechanically sound and operational in all-weather. In the meantime, I made do with manual tracking and the unreliable position indicating. Things actually worked pretty well over the summer, hence the somewhat low priority on the project. Once winter came, however, the situation deteriored. The azimuth rotator would often stick and turn sluggishly in the cold. I missed most of the EME contest because I couldn't accurately point the antenna in overcast when I couldn't see the moon. Working satellites wasn't as much fun because I was always losing the bird at some point during the pass when the indicator got out of sync. In fact, for the two coldest months (December and January) I didn't even bother to put up the antennas. It wasn't until a 'warm' spell in early February that I finally put up the antennas again. I was thrilled to work the new HO-68 satellite. Finally we had an amateur satellite with an AO-7 sized footprint and a strong, multi-mode transponder. I worked the east coast of the USA and a UA0 on the same pass! Not exactly AO-13 but still pretty cool! It also had a digital BBS mode as well. I was a big fan of the pacsats back in the old days and couldn't wait to give the packet mode a try. Unfortunately, the warm spell ended and with the thirty-below weather came all the old problems again. I decided that I had to get moving on my automatic tracking project. It was time!

Back to BASIC...

After stuffing the mouse parts into a weatherproof electrical box and rigging up a little pulley and drive belt, the next step was software. Fortunately, Microsoft now has a freeware version of Visual Basic. Unfortunately, after downloading and installing it I found another 'gotcha': Visual Basic 2008 doesn't support DDE! According to Microsoft, DDE is an antiquated way of doing things and by now all applications that need to pass data back and forth should be using some sort of COM thingys. That's nice, Bill, but all the satellite tracking software out there still uses DDE! After some Google searching I found out that I wasn't alone in my quest for DDE and there were a couple of solutions out there. The one that worked for me was a standalone DDE library written a number of years ago as an improvement on the DDE built into VB. Now that DDE is written out of VB it is quite an improvement indeed! The author has since passed away and the support group seems to have dried up three years ago but it works! Within an hour of downloading it from the dormant web site I was pulling tracking data from Orbitron into the first draft of my program.

The Mad Scientist...

With the azimuth indicating lashup ready to go, the alpha version of the software written, and the LabJack mounted in a box with the relays and power supplies, the next step was to put it all together with the antennas. Surprisingly, the elevation part of the software worked right out of the gate. A few hours of tweaking the code and testing and it was good enough to move onto the azimuth part. This was where things started to go off the rails. The biggest problem was the belt driving the little pulley connected to the optical encoder. It was a good theory but the rubber O-ring I was using got very stiff in the cold and started to crack. Furthermore, I couldn't get the tension set properly. The belt would be almost too tight at one postion and then too loose and slipping at another. Turns out that the mast is not quite centered on the carrier plate. I spent many hours and hundreds of trips up and down the ladder trying to find a solution that would work reliably. No matter what I did the belt (now a toothed microdrive belt) would still slip. I finally determined that not only was the belt slipping, but the lashup with the old mouse board was also somehow skipping pulses. By the time I figured this out I had been going at it for several days in a row. I commented on my Facebook page that I was beginning to understand how a regular scientist turned into a mad scientist! The final straw came when I accidentally broke the mouse board trying to make adjustments to how it mounted in the box. I walked away from the whole thing and decided to just leave it alone for a couple of days while I decided what to do.

A New Approach...

After pondering the situation I decided to abandon the idea of using an optical encoder. It originally seemed like a good idea and, like all ideas, it would have been fine if it had worked. In situations like this you have to know when the time is right to cash in your perseverence, admit defeat, and start looking for a new plan. In this case, I didn't need to look too far. I decided the best course of action would be to replace the encoder with a potentiometer and just do it the same way the rotator manufacturers did. Not finding anything appropriate in my junk pile I pulled up the DigiKey catalog and ordered a nice 10-turn 1K ohm pot. It took less than two weeks to arrive (no UPS in this neighborhood!) and once it was installed in place of the optical encoder things came together quite rapidly. After a couple of hours of mental gymnastics working out the math in the program to deal with the fact that my antennas drive from 180 degrees to 179 degrees (instead of the more usual 0 to 360 degrees) I was ready to give it a try.

The Holy Grail...

When it comes to writing software, eventually the eureka! moment arrives and you find that last tweak did the trick and for the first time it actually works. I had the satisfaction of standing outside and watching the antennas moving incrementally in azimuth and elevation to follow a satellite across the sky. An hour later HO-68 came up and I made my first satellite contacts ever without having to manually adjust the antenna pointing. I still have a bit of calibration to do on the elevation drive and of course the software needs some polishing but for the moment I'm going to stand back and just bask in the glory of completing a complicated project. Once this island thing is wrapped up I might even find the time to do some more work on my KW VHF amplifier...

No comments: