Pages

Sunday, September 13, 2015

Simple RTTY Transmitter with Arduino



Continuing our quest for a simple transmitter for tracking public transport, I experimented with various modes on the small oscillator that my friend Shashank had made. Finally, a simple arrangement to generate the RTTY is presented here.

By writing simple code and tweaking the a preset, one could generate various digital modes from a very simple circuit.

So, here is the oscillator:

There are two control lines going into this. These are connected to an Arduino. The D10 line controls the bias of the oscillator. Essentially switching in on or off. One could key this from the Arduino to generate CW or QRSS. Try doing that on your own, there is no code for it here.

The D11 line controls the frequency shift. Taking D11 high switches on the D1 diode and adds another 10 pf in parallel to C7, pulling down the frequency of the oscillator. The preset in series with the 10 pf is a crude but effective way to adjust the frequency shift more precisely than is possible with a trimmer. I am quite happy with the way this works.

Building it is quite easy. Download the source code below to an Arduino. The code is pretty simple too. The code is meant to read the GPS location from Han's excellent GPS kit and transmit it through RTTY on 27 MHz band. You can choose any other frequency (try a 14.318 MHz crystal).

If you want, you  can program it to transmit anything else too. My friend VU2MY (Shekhar) is planning to use this to monitor his crops.

Adjustment
The preset needs careful adjustment. Here is how you do it:

  1. Download and install MMTTY on your PC. 
  2. Run it, keeping the FFT view to 1.5 KHz
  3. Switch on this RTTY transmitter and tune it on your receiver.
  4. Watch the waterfall on MMTTY and click to place the two lines representing the 170 Hz spacing over your signal's strong line.
  5. Adjust the preset until the two peaks (presenting the two frequencies with the shift) are aligned to the two tuning lines. 
  6. Watch the RTTY message scroll by.
A Catch
  • Use only CAPS. I am not checking for the lower case.
  • Add the letter 'f' (lower case F) before the start of numbers and follow it with 'l' (lower case L). See the code. 
Final Comments

An primitive oscillator when coupled with a 4 dollar Arduino can make for a very interesting plaything. I am sure one could do several other things. With a few resistors connected to the digital output of the Arduino, the modulation can be take varying voltages rather than the current  on/off arrangement. Such a scheme will open us up to WSPR, JT9 and other modes. 

Code (under GPL 3.0)



#include <SoftwareSerial.h>
#include <gps.h>

/* works 
 * with LSB and diode with a twisted wire for a cap in parallel with 10pf (in series with the xtal) 
 */

SoftwareSerial mySerial(2, 3); // RX, TX
int tick = 0;
long lon, lat;
unsigned long nextUpdate=0;
char letter[33] = "0EnA SIUrDRJNFCKTZLWHYPQOBGfMXVl";
char number[33] = " 3n- b87r#4',!:(5')2#6019?&f./;l";
char buff[100];
char rttyMode = 'L';

#define BIT_TIME 22
#define MODULATION 11
#define TX 10

void setup() {
  // put your setup code here, to run once:
 pinMode(11, OUTPUT); 
 pinMode(TX, OUTPUT);

  Serial.begin(57600);  
  mySerial.begin(9600); 
  digitalWrite(TX, HIGH);
  digitalWrite(11, LOW);

}

void txChar(char ascii){
  int i;
  char c= 0;

  if (isalpha(ascii)){  
    for (i = 0; i <= 32; i++){
      if (letter[i] == ascii)
            c = i;
    }
  }
  else{ 
    for (i = 0; i < 32; i++){
      if (number[i] == ascii)
            c = i;
    }
  }
  
  //start bit
  digitalWrite(11, HIGH);
  delay(BIT_TIME);
  for (i=0; i < 5; i++){
      if (bitRead(c, i) == 1)
        digitalWrite(11, LOW);
      else
        digitalWrite(11, HIGH);
     delay(BIT_TIME);
  }
  
  //stop
  digitalWrite(11, LOW);
  delay((BIT_TIME * 3)/2);
}

/* provides half a second of carrier for the receiver to lock-in before the transmission */
void txString(char *string){
  /* to lock onto the signal */
  digitalWrite(TX, HIGH);
  digitalWrite(11, LOW);
  delay(500);

  while (*string){
    txChar(*string++);
  }
  digitalWrite(11, LOW);
  delay(200);
  /* comment out the below line if the receiver is unable to lock in within half a second */
  digitalWrite(TX, LOW);
}

void loop() {
 unsigned long now;
 char c;
 if (mySerial.available()) {
    c = mySerial.read();
    gps_decode(c);
     Serial.write(c);
    tick++;
  }

  now = millis();
  if (now > nextUpdate){
    lon = (long)(gps_lon * 10000.0);
    lat = (long)(gps_lat * 10000.0);    

    /* this is the text to be transmitted */
    sprintf(buff, "CQ CQ CQ DE VUf2lLCH f%ldl f%ldln", lon, lat);
    
    txString(buff);
    nextUpdate = now + 10000;
  }  
}



Monday, June 29, 2015

A Balanced Tuner




Balanced line with open wire feeders and a doublet makes a very nice multi-band system. I have been using one for years. It consists of three parts:
  1. The doublet : It looks like a dipole but it doesn't act like one. It has two horizontal wires just like a dipole. But they can be of any length. 51 feet long (26-1/2 feet each)  makes for a nice, compact antenna for 80 to 6 meters.
  2. An open wire feeder. I used a multi-strand wire left over from some house wiring job with 1/4-inch PVC ducting cut into 3 inch lengths as spacers. I used copper enamalled wire to bind the cable to the spacers. (see the picture)
  3. A balanced tuner. The balanced tuner must convert the unbalanced antenna input/output of the antenna to a balanced 50 ohms and then drive it through an impedance transforming network to the antenna system's impedance at the end of the open wire feeder.
After using the open wire system for a few years, I had mixed results. The antenna tuner that I used was the common Z-match variety. The Z-match left a lot to be desired. The tuning was very touchy. One of the capacitors was floating and the range was severally limited.

Many of the tuners that we use are not really balanced and as a result, they don't work too well. AG6K wrote an very straightforward article on the trouble with most of the antenna tuners that we use for open wire feeders. They aren't really balanced at all. Here is the full article if you want to read it https://drive.google.com/file/d/0BzRNYeu10K6DX3AtNXVEV2oyNkk/view?usp=sharing. (Warning: I have downloaded this from the Internet and I assume that it is allowable to share it).

With the Minima transceiver's development getting into testing phase, There was a need to spruce up the multiband ops at VU2ESE. I really wanted to try the Balanced balance line tuner. However, the original article required two rolling inductors that were mechanically couple to tune together. I didn't even have one! These are very expensive and not easily available. Hence, this is a simpler version of that famous tuner.

The Circuit

Thanks to DuWayne, KV4QB for the nice drawing!


First order of business is to have a decent way to measure the mismatch between the transceiver and the antenna system. The SWR bridge used in this tuner is resistive. That means that it shows very little variation of in the SWR to the transmitter. This protects the transmitter from high SWR. Often, the QRO tuners can't use such a system as the resistors would dissipate most of the RF energy. Whereas, if we tune at QRP levels, this system works very well. Here is a tip: You can use this tuner for QRO work too. Just tune at less than 10 watts and then switch to high power.

Second part is the balun. I have just stacked up two FT37-43s as I don't intend running more than 10 watts for now. You can build a better balun on a larger ferrite toroid or just wrap turns 10-20 turns of a good quality coax on a large PVC pipe (more than 3 inch diameter). Use anyone end of the coax as the balanced and the other as the unbalanced end, it is all the same

Third part is the matching network. The simplest matching network is an L-network. An inductor between the two ports to be matched and a capacitor between the higher impedance port and the ground. For a balanced line, we need two L-networks : one for each side. The original design of AG6K used a variable inductor. Instead, we use seven switchable inductors in place of each tunable inductor. These inductors are of the value 6.4uh, 3.2uh, 1.6uh, 0.8uh, 0.4uh, 0.2uh and 01.uh. By switching them selectively, we can synthesize any inductance from 0.1uh to 11.9 uh in 0.1uh steps. 

As both sides must tune in step, the inductors are switched in or out with DPDT toggle switches. A broadcast gang capacitor's both sections are used. One for each leg of the balanced line. I used an old broadcast gang capacitor in the output. As the broadcast gang capacitor has two sections. It was easy to use them on the two ends of the balanced line. Note: I suspect that the maximum capacitance of my gang is just 140 pf. Hence, the increase the tuning range, I had to add a 200 pf (actually 100pf capacitors in parallel) that can be switched as needed across the balanced line.

Construction


This was built using copper clad boards as the chassis. The layout was done in a straight line. As a result the tuner is about 9 inches wide and 3 inches high. The hard part was the mechanical work. Drilling all the hole and fitting the connectors, the meter etc. took time.

An old meter from a tape recorder was used. Depending upon the sensitivity of the meter you use, you may have to change the 10k resistor that is in series with the meter. Apart from that 10K resistor, all the other resistors are 100 ohms, 2 watt resistors.

Once all the chassis is ready, the rest can be built in a single evening.

Using the tuner

  1. Setup the tuner: Flip the tune/operate button to Tune (that is, with the return loss bridge in the path). Switch the rig to generate less than 10 watts of power.
  2. Setup the rig: Press key (if you are using CW). or whistle continuously into the mic (on SSB or AM). A neat trick you can try on multi-mode rigs is to just key the AM transmission without modulation that will give you a constant carrier.
  3. Tune up: Keep all the switches open (for maximum inductance). While transmitting, quickly tune across the capacitor's range to watch for a dip. Then going down from highest inductance to the lowest, keep tuning across with the tuning cap to watch for a dip in the meter. It might take you a  minute or two to get a hang of the system as the inductors are arranged in a doubling sequence.  
  4. Note the settings: When you tune on a band for the first time with an antenna, note down the settings of the switch and the approximate position of the tuning capacitor so you can quickly return to it. 
  5. Operate: Once you have a dip in the SWR meter, you can flip the Tune/Operate switch to operate and increase the power (if you have to to). It is easy to forget flipping the switch : you may end up transmitting with less than 1/4th of your full power. Danger: 
If you are operating QRO, you might burn up the resistors of the bridge if you transmit with the switch set to Tune position!

Conclusion

The new ATU in the shack is very smooth. It tunes everywhere on 7, 14 and 21 Mhz (my principle bands of interest). I have loaded it on 3.5 MHz and 28 MHz as well with my 51 feet doublet. A plan is to make a lightweight open wire feeder with 2 inch spacing using copper enameled wire and some lightweight spacers to make a portable station for some backpacking along with this ATU. 

Though meant for balanced lines, there is no reason why this can't be used for unbalanced lines too. You can skip the balun and use just one side to feed a random wire antenna, a dipole or a vertical.

An ultimate version would be to make an Arduino based automatic tuner that replaces the switches with DPDT relays and the tuning capacitor with a set of eight capacitors, making this an automatic tuner. Radio Artisan has a similar system. For now, this is a simple system that works very well.