7MHz Transmitter with AVR Soft-keyer

In my last post, I went over the design of a Colpitts crystal oscillator design that put out a moderately clean 7 MHz signal. In order to match the output impedance to 50 Ω, an NPN feedback pair (at least that’s what I’m calling it) was designed. While meeting the specs for driving an ADE-1 mixer, it consumed an unnecessary amount of current. I’ve been designing a tremolo effect recently (which I should be making on post on as well in the future) where I used a BS170 MOSFET to amplitude modulate an incoming audio signal. Without going into too much detail, I decided to adjust the DC bias point of an emitter-follower to sit at the threshold voltage of the BS170 to prevent from having to have a DC block immediately followed by another DC bias point. While looking at different transmitter designs on Homebrew RF Circuit Design Ideas, I came across a class C amplifier that used a similar technique to what I was doing in the tremolo effect combined with a Pierce oscillator. I did some experimentation and came up with the following circuit.

To be fair, this schematic is revision B, and it hasn’t been built yet. Revision A, however, is pretty much the same thing except R1 is omitted and the drain of Q3 connects to the source of Q6. The ATTiny85 takes the single-throw switch as the only input. When you turn it on, the switch acts like a standard on-off keyer for banging out morse code. If you hold the key down for 5 seconds, it changes to a beacon mode and starts tapping out my call sign. Holding the key down again changes operation into pulse mode with a frequency around 1 kHz. In pulse mode, you can actually pick up the signal on a standard AM receiver as seen in the demo video. The transmitter itself puts out 28 dBm running on a 12V supply and is around 82% efficient.

The PCB layout came out pretty quickly. It was the first time I have ever done double-sided PCB etching. Overall, I think it came out pretty well. There was small offset as you can see from the placement of the drill holes, but no harm, no foul. Performance was even a little better than the prototype. I mounted the board inside a Hammond 1590A enclosure and made a short demonstration video. It’s extremely simple, but I think it will be a useful piece of a larger project that I’m working on. It can also be easily adapted to a number of frequencies using a different crystal or loading Q2 to act as a frequency multiplier. I did experiment with this somewhat and was able to produce fairly strong second and third harmonics at the output. That’s about as far as I got though since I got distracted making theremin type sounds on my shortwave radio receiver.

#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

#define CTL 0         // TX enable pin
#define SW  3        // input switch pin
#define N   10      // N periods in monopulse mode

bool            sw = LOW; 
bool            trig = LOW;               // monopulse trigger status
bool            tx = LOW;                // flag for TX enable
bool            keyer = LOW;            // flag for start of key press
int             mode = 0;              // modes: 0 => Key mode (default), 1 => ID mode, 2 => Monopulse
int             dit = 50;             // delay time for dit in ms
int             dash = 150;          // delay time for dash in ms
unsigned long   hold = 5e6;         // max hold value in microseconds
unsigned long   pause = 1e7;       // max pause between IDs in microseconds 
unsigned long   start = 0;        // start time in microseconds
unsigned long   last = 0;        // time of last ID;
long            c = 0;          // count variable for mode change



void setup() {
  pinMode(CTL,OUTPUT);
  pinMode(SW, INPUT);

  cli(); 
  /*--- TIMER1 CONFIG ---*/  
  TCCR1  = 0b01101000;
  GTCCR  = 0b00100000;
  
  TCCR0A = 0b00100000;
  TCCR0B = 0b00001011;    // last 3 bits set prescalar for Timer0

  cbi(TIFR,OCF1A);
  sbi(TIMSK,OCIE1A);
  OCR1A = 128;
  sei();

/* --- interrupt enable
    GIMSK = 0b00100000;     // turns on pin change interrupts
    PCMSK = 0b00001000;    // turn on interrupts on pins PB3
    sei(); 
*/
}

void loop() {  
  /*
    if (sw == LOW) { 
      start = micros();
      if (keyer == HIGH) {
       modeChk(); 
      } else {
       keyer = HIGH;
      }
    } else {
     keyer = LOW;
    }
  */
  // perform function based on mode
  switch(mode) {
    case 0:
      if (sw == LOW) {
        digitalWrite(CTL, HIGH); 
      } else {
        digitalWrite(CTL, LOW);
      }
    break;
    
    case 1:
      if (last == 0) {
        id();
      } else if ((micros() - last) > pause) {
        id();
      }
    break;
    
    case 2:
      if (sw == LOW) {
        pulse();
      }
    break;
  }

  trig = LOW;                 // monopulse trigger reset  
}

ISR(TIMER1_COMPA_vect) {
    sw = digitalRead(SW);
    if (sw == LOW) { 
      if (keyer == HIGH) {
       modeChk(); 
      } else {
       start = micros();
       keyer = HIGH;
       trig = HIGH;
      }
    } else {
     keyer = LOW;
    }
} 

void modeChk() {
  if ((micros() - start) > hold) {
     if (mode < 2) {
       mode++;
     } else {
       mode = 0;
     }
     start = micros();
     stat();
     delay(1000);
  }
}

void pulse() {
  // pulse TX on and off N times
  for(int n = 0; n < N; n++) {
      digitalWrite(CTL,HIGH);
      delayMicroseconds(500);
      digitalWrite(CTL,LOW);
      delayMicroseconds(500);
  }
}

void stat() {
  // tap out mode number in morse code
  for(int n = 0; n < mode; n++) {
      digitalWrite(CTL,HIGH);
      delay(dit);
      digitalWrite(CTL,LOW);
      delay(dit);
  }

    for(int n = 0; n < (5 - mode); n++) {
      digitalWrite(CTL,HIGH);
      delay(dash);
      digitalWrite(CTL,LOW);
      delay(dit);
  }
}

void id() {
  // tap out ID for K2NXF
  
// K
  digitalWrite(CTL,HIGH);
  delay(dash);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dash);

  digitalWrite(CTL,LOW);
  delay(dash);
  
// 2 
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dash);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dash);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dash);
  digitalWrite(CTL,LOW);
  delay(dash);

// N
  digitalWrite(CTL,HIGH);
  delay(dash);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dash);

// X
  digitalWrite(CTL,HIGH);
  delay(dash);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dash);
  digitalWrite(CTL,LOW);
  delay(dash);

// F
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dash);
  digitalWrite(CTL,LOW);
  delay(dit);
  digitalWrite(CTL,HIGH);
  delay(dit);
  digitalWrite(CTL,LOW);
  delay(dash);

// new word
  digitalWrite(CTL,LOW);
  delay(dash);

last = micros();          // store current time at end of ID
  
} 

7MHz Crystal Oscillator Design

After constructing a 40m wire dipole that works with my SDR setup, I needed to start working on a transmission system. At the heart of virtually any RF system lies a stable oscillator, and crystal oscillators are ubiquitous in many low-power (QRP) rigs simply because they are so stable. After some rough math and a lot of simulations in LTSpice, I came up with this design to give me somewhere around 7 dBm of power.

The first stage is simple Colpitts oscillator topology with a “bent” 7.03 MHz crystal resonator. The 30 pF variable capacitor (C1) provides around 2 kHz of tuning. The output stage is a common-collector (Q4) and emitter-follower (Q3) with a negative feedback loop. I forget exactly where I saw this configuration, but I thought I would try it out and see if it worked. As you might have guessed, the output is loaded with higher order harmonics resulting in a waveform that doesn’t resemble a sine wave at all. I made sure to include a simple second-order low-pass Butterworth filter on the output to filter the output.

Pictured above is the ugly constructed version of the oscillator in all it’s dead-bug style. I built it on a scrap piece of double-sided FR4 and overall it’s performance came out fairly close to what LTSpice had predicted. I got around 6 dBm of output and the second harmonic is around 29 dB down (around -23 dBm). That’s not the cleanest of signals, but it’s about right for the filter. Below is the output shown on my HP 8595E spectrum analyzer.

For the next phase, I’ll likely be adding control of the oscillator via an ATTiny chip. This will give me the ability to automate on-off keying of the device turning it into a simple CW beacon. One thing that could be improved is the current draw (~40 mA) from the emitter-follower at Q3. Basically, it’s a class A amplifier so it’s not the most efficient design in the world, but it provides enough power for driving an ADE-1 and could run off a small solar panel if I wanted to use it in the field.

DOD FX55B SupraDistortion – BigBuff Mod

wpid-20140915_140854.jpg

Here’s another in a line now of DOD pedal mods. For this FX55B, I decided to go for more of a BigMuff sound. Playing around with this pedal initially, I found it to be like most mass-produced distortion/fuzz effects. It had a very thin sound and that notorious volume drop that you may have heard on a high-school band’s first album. The lows were almost non-existent when the effect was engaged. I found the following schematic and, with a few simple changes, came out with a distortion pedal with considerable gain, massive lows, and a smoother, more rounded square wave.

dodfx55b_bigbuff_mod

Overall, the idea here was to get more from the pedal by employing some germanium to smooth out the harshness and to increase the overall output. The output is now considerably higher as long as the tone knob is set closer to 10 o’clock. At noon, the mixing is practically useless. At the 4 o’clock position, you get more of a thin, trash punk type of sound with an excessive noise floor. The sound sample demonstrates the effect with the tone set at about 10:30-11 and first contrasts the distortion setting. The third set shows off the tone below 10 o’clock. The last set shows what the tone does when you sweep through it.

Class AB amplifier test

image

this was an attempt at designing a simple transformer-less class AB amplifier using two BJT power transistors. i setup the USB fan to protect against thermal runaway and cool off the transistors during operation. it took me looking over several schematics to realize that the the emitters of both the PNP and NPN transistors were tied together. the collector of the PNP (TIP32C) is grounded which is obvious! the synapses just weren’t seeing the PNP symbol as upside down. it’s definitely something i’ll have to work on. i’d like at some point to have a nice 40W amp based on a similar configuration.

LFO modulated simple VCF

lfo_vcf_rev_aa001

this is a rough draft of a circuit i’ve been working on based of the Simple VCF circuit floating out there. a big thanks to the original author for that. i’m sure there are some mistakes in here. it’s an odd one for sure, but it works on the breadboard. the opamp is a TL072. square-wave input from the generator comes out pretty sine-wave like which is what is desired. the output is a little noisy, but i will work that out with time.

initial test of a modulated PT2399 circuit…

a breadboard version of some PT2399 modifications i’ve been working on. there are a lot of DIY schematics that utilize the PT2399 (Magnus Modulus, Echo Base delay, Rebote, etc.). i’ve been interested at trying my hand at modulation techniques recently. i made a simple LFO circuit based on the findings mentioned in a previous post. i used some techniques out lined in some of the schematics floating out there to attempt to modulate the delay time of the chip. i wouldn’t say i’ve got it to work perfectly, but it’s definitely doing what i had hoped.

PT2399 build…

this is an older build now, but i wanted to post it while i’ve been on the subject to record the process. believe it or not, i still have some work to do on this one. i used a TL082 as a buffer for the mixing circuit. getting the gain set to my taste has been the toughest part. this one (unlike the last) is a bit low. it will all come in due time though. i’ve produced two solid builds this week (though really just debugging this one and one from scratch), and i’ll consider that a productive week.


ngSpice: single frequency FM modulated signal generation

ever wanted to see how that 2N2222 might hold up as a linear RF amplifier? here’s a handy feature of ngSpice that i found recently. i’m rather new to ngSpice and at first was somewhat frustrated by its differences from other SPICE variants. however, i’ve earned a deep appreciation for it and its integration with the gEDA suite.

V1 n1 0 sffm(2 24 10k 5 1k)
.tran 0.01ms 2ms
.plot n1

the above code generates the waveform seen above. the corresponding values in the sffm() function run something like this.

Parameters Default value Unit
Vo (offset) Ampere or Volt
Va (amplitude) Ampere or Volt
Fc (carrier frequency) 1/Tstop Hz (Hertz)
Mi (modulation index)
Fs (modulation frequency) 1/Tstop Hz (Hertz)

Boss Tremolo TR-2 w/ C4 Mod +Gain Boost


This little guy is currently on eBay. I always thought that this tremolo wasn’t bad, but the volume drop was insatiable and drove me nuts sometimes. I thought I would try modding this one by cutting out the C4 cap (a 0.1uF bypass cap) which is the alleged cause of the gain loss. It is, but not without good reason. It does keep the effect sounding smooth and really clean. Removing the cap also opens up those capped frequencies which some people report a more warm and/or harsh tremolo tone. I enjoyed the more dramatic effect of the pedal myself, and decided to make it even more so by substituting the 10k ohm resistor before the non-inverting terminal of the first opamp for a 4.7k. This added a nice volume boost which gives the tremolo more cut especially when combined with heavy reverb or a washy delay. We’ll see if anyone decides to buy it. I think it’s a huge upgrade from the original sound.