My Morse Code practice generator…

A while ago, I worked up a simple little program that could generate both computer generated speech and Morse code at various speeds to make up some sample recordings I could use to brush up on my Morse skills. I apparently left it in a pretty broken state though: it could use some work. But it does generate pretty pretty reasonable sounding audio using the voice synthesis system on the Mac and my own relatively nicely filtered morse wave forms. I should clean this up, and then use it to brush up on my code skills.

On an LC Bandpass Filter for receivers…

I had some time yesterday, but no enthusiasm for melting solder (hey, some times, you just don’t feel it) so I thought I’d spend some time, well, learning stuff. So, I dusted off EMRFD and looked at the design equations for creating bandpass filters for receiver inputs. On my second printing, these occur on page 3.14 (π!). Rather than laboriously work through the possibilities, I decided to just code up a small python program. Here’s the result.


#!/usr/bin/env python

# An simple program to compute the value of components needed for a 
# Doubly Tuned Circuit LC filter that can serve as a bandpass filter 
# for homebrew receivers.   The equations come from the sidebar equations
# presented in EMRFD (I have the first edition, where it appears on page 
# 3.14)
#
# Written by Mark VandeWettering

from math import sqrt, pi

F = 7050000.            # frequency of operation in Hz
B = 100000              # bandwidth
R0 = 50                 # load resistance
L = 0.000001156         # inductance of the two coils
Qu = 250.               # "Q" of the coils, approximate

k = sqrt(2.)/2.         # I hardcoded the Butterworth filter equations
q = sqrt(2.)

omega = 2.0 * pi * F
c0 = 1. / (omega * omega * L)
c12 = c0 * k * B / F
qe = (q * F * Qu) / (B * Qu - q * F)
ce = 1.0 / (omega * sqrt(R0 * qe * omega * L - R0 * R0))
ct = c0 - ce - c12

print """
     CE           C12           CE
 +---||---+---+---||---+----+---||---+
 |        |   |        |    |        | 
 <        (   |        (    |        < 
 > R0     ) L - Ctune  ) L  - Ctune  > R0
 <        (   -        (    -        < 
 >        )   |        )    |        > 
 |        |   |        |    |        | 
 V        V   V        V    V        V

"""


print "F     = %.2f" % (F / 1e6), "Mhz"
print "B     = %.2f" % (B / 1e6), "Mhz"
print "R0    = %.0f" % (R0), "ohms"
print "L     = %.1f" % (L * 1e6), "microhenries"
print "C12   = %.1f" % (c12 * 1e12), "pf"
print "CE    = %.0f" % (ce * 1e12), "pf"
print "Ctune = %.0f" % (ct * 1e12), "pf"

If you run it, you can find a filter designed for 40m with a bandwidth of 100khz. I haven’t had time to run the results through LTSpice for analysis, but the values computed match the values printed in the table in EMRFD, so I suspect things are reasonably well behaved. My choices of the constant k and q select a Butterworth filter instead of a Chebyshev, which given the application I suspect is just fine. According to EMRFD, the choice of L is fairly arbitrary, They suggested 10. / frequency (in Hz) as a good starting value. I used a Qu of 250 because, well, that’s what they used, and I suspect it’s fairly typical over toroidal coils that you’ll wind yourself.

Hope this helps someone.