It receives!

Well, I found a BNC connector, hooked up my antenna, and voila! Before testing it, I tried listening up on my FT-817, and the band seemed pretty dead. But the DC40B had signals!

First powerup of my DC40B

I can hear a bit of hum, which I suspect will only get better once I use a better power supply (I was just using a wall wart) and get it in its case, and its wide, but you can definitely hear signals. At the end, some QRM comes in and spoils it, but I’m encouraged.

Addendum: My morse is pretty rusty, but the loudest signal at the beginning of the recording is a QSO between K6LQ and W6JHQ. W6JHQ would appear to be about 360 miles away, just west of Victorville.

DC40B, Day 4 + over a year…

Back in October of last year, I was eagerly putting together one of Doug Hendrick’s DC40b kits, a nifty little transceiver, complete with a nice metal case. Here’s where the assembly got to prior to today:

brainwagon » Blog Archive » DC40B, Day 4, and stupidity on my part….

Yes, I didn’t install a chip backwards, I merely screwed up and swapped the op-amp (8 pins) and the Atmel chip (similarly 8 pins). At the time, I sent an email to Doug and he kindly sent me replacement parts, and they sat in my “box o’ radio stuff” for quite a while. Until today.

Today, I dusted them off, and then tried to figure out where I left the rig. In the end, I just plugged in the new chips, hooked up a set of ear buds, and fired it up.

This time, and voila. The AVR is running! I hooked up paddles, and the keyer seems to work fine. I can hear the QSK thump in a little bit when the receiver kicks back in, but all seems well. I’ll drag out my oscilloscope and test voltages and the like: when I left it last time I thought the oscillator wasn’t actually oscillating, but now that things are hooked up, maybe all will be better. Now, all I need to do is find the two parts that I need to finish it: the BS170 that serves as the final amplifier and the BNC connector so I can hook my antenna to it.

And then, I’ll have to brush up on my CW. I found my Gordon West CW CDs too. 🙂

Jupiter, the Bringer of Jollity

Phil Plait dug out these amazing pictures taken by Damian Peach. If you go to your local library and look at astronomy books that were published when I was a kid, you’ll see no pictures like any of this. The combination of both computer algorithms and video hardware has put the ability to take astonishingly good imagery into the hands of amateur astrophotographers. Still, some efforts seem an order of magnitude more amazing than others, and these definitely count.

Jupiter, the Bringer of Jollity | Bad Astronomy | Discover Magazine.



Merry Christmas to All…

Well, it’s just after midnight, and with it is time for me and Carmen to don kerchief and cap and then to settle our brains for a long winter’s nap. To all my family, friends, and readers, I’d like to wish you all a Merry Christmas and Happy Holiday. Tomorrow, there will be prime rib and potatoes, egg nog and cookies. I hope that each of you finds some joy in the holiday.

And special best wishes for my mom, Beverly, and for my siblings Kevin and Kristin.

Apollonian Gasket

It took me an embarrassingly long time to write a program to generate this fractal known as the Apollonian Gasket:

More information here:

Apollonian gasket – Wikipedia, the free encyclopedia

Each circle is labelled with its curvature (which is simple the reciprocal of the radius). In this particular instance, all the curvatures turn out to be integers. Not really sure why I think this is interesting, but there you are.

Total Lunar Eclipse

On Monday, December 20th, we’ll have an opportunity to view a total lunar eclipse. Huzzah! It’s been quite a while since I’ve had the opportunity to view one. According to this NASA eclipse calculator, the moon should enter the penumbra of the earth at 9:29PM Pacific time, with the partial eclipse beginning at 10:33 and totality starting at 11:41PM. The middle of the eclipse occurs just after midnight at 12:17, and totality ends at 12:53 AM.

The weather outlook isn’t good, it is questionable as to weather we’ll be able to see it, but if it’s clear on Monday, try to check it out.

You can tune a banjo, but you can’t tuna fish…

Or can you? Courtesy of the Make Blog, here’s an interesting little musical instrument called a “canjo”, a two string banjo that uses an old 4″ tuna fish can as the resonating cavity. Perhaps I should take a break from my plinky string sounds generated with software, and instead do it the old fashioned way.

Tuna can guitar blog.


Ground tracks of satellite passes…

Every once in a while, I feel like making high quality pictures of ground tracks of satellites. The Generic Mapping Toolkit is handy, especially when combined with the pyephem library.

The thick line is the ground track of the amateur satellite AO-51, at any point in its next pass where it is visible from my home location. My idea is to script this up into a generic satellite prediction utility that I can access from my webpage. Stay tuned.

Addendum: I’m particularly interested in passes which might allow me to communicate with Hawaii. Here is a similar map, showing two passes of AO-51 (both passes start from south and move north) and also show the footprints of both San Francisco and Honolulu Hawaii. Any portion of the satellite path which is common to both circles should allow a CA-HI QSO to occur.

What ideas infect my brain and why…

Some of you might be wondering what it is about this Karplus-Strong algorithm that has got me interested. Of course, long time readers of my blog might well have wondered that about any of a number of things that I’ve written about. What is it about checkers that prompted me to write a checkers program? What is it about prime numbers or pi that made me write programs to compute them? What is it about the FFT? What is it about FPGAs and computer architecture? Why did I find Brian Beckman’s Physics of Racing intriguing?

I think it has something to do with hidden complexity.

Consider for example the Karplus-Strong algorithm that I coded up. It’s relatively simple: just a few lines of code. But it has complex behavior: behavior that is in some sense surprising. It’s hard to see from examining it how it can generate the kind of sounds it produces. Ken Steiglitz’s book doesn’t really provide enough background on how it works until 100 pages in, and even then, there is a lot of subtlety which isn’t really apparent. There is genuine genius in the dozen or so lines of code that make it up: genius that hints at hidden knowledge and new ideas.

Ditto for checkers. Payne did some of the first analysis of so-called “First Position” back in the late 1700s. These are some of the most basic checker positions: two king versus one king and one man endgames. Yet, inside these positions are some deeply complex principles, principles which still make writing a good checker playing program difficult.

Beckman’s Physics of Racing provides some insight into how race cars actually work. Making a car go fast around a track is more than just weight and horsepower. It’s about understeer and oversteer. It’s about balance. It’s about friction and slip.

There is more in these systems that are evident from first glance. In many cases, mathematics provides an insight into the underlying structure and complexity. Computers can lend insight into systems which are too complicated to understand from first principles. And in the end, engineering and actual physical implementation provides us with the glory of music, the fun of games, and the thrill of racing.

Richard Feynman once famously mused that science provided a glimpse into a kind of deep beauty. Rather than paraphrase him, I’ll let him talk…


The world of mathematics and physics and computing provides us an opportunity to explore the deeper inner beauty of things in new ways. And geeky as it is, that’s what I think underlies some of the themes I explore on this blog.

There, glad I got that off my chest. Now, back to work.


Okay, I finally found my copy of Ken Steiglitz’s A DSP Primer (a great book, but sadly more expensive now than when I got my copy) and read through the implementation of the tunable plucked string instrument. A couple of things really need to be added: first of all, I was off considerably in my tuning because the averaging operation inserts a delay of 1/2 a sample, and the tuning was necessarily coarse because the frequency was entirely determined by the length of the delay buffer, which was an integer. To make that work, you need to introduce an all-pass filter, which has a pretty simple form. Without any additional explanation, here’s the source code that I tinkered together over a half an hour of reading and typing.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sndfile.h>

 * ks.c
 * an implementation of the Karplus-Strong algorithm, revised after
 * reading Ken Steiglitz's treatment in "A DSP Primer".

#define SAMPLE_RATE     (22050)

double freq = 440. ;

main(int argc, char *argv[])
    SNDFILE *sf ;
    SF_INFO sfinfo ;
    double delay ;
    int L ;
    int i, j ;
    int sample ;
    double a  ;
    double w0 ;
    double x0, y0, x1, y1 ;

    freq = atof(argv[1]) ;

    sfinfo.samplerate = SAMPLE_RATE ;
    sfinfo.channels = 1 ;
    sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;

    sf = sf_open(argv[2], SFM_WRITE, &sfinfo) ;

    /* first of all, figure out the total delay... 
     * freq = SAMPLE_RATE / (L + 0.5) 
     * or L = SAMPLE_RATE / freq - 0.5 ;

    delay = SAMPLE_RATE / freq - 0.5 ;
    fprintf(stderr, "... delay = %f\n", delay) ;
    L = floor(delay) ;
    delay -= L ;
    fprintf(stderr, "... buffer size is = %d\n", L) ;
    fprintf(stderr, "... fractional delay is = %f\n", delay) ;

    fprintf(stderr, "... approximate value for a = %f\n", (1-delay)/(1+delay)) ;
    w0 = 2.0 * M_PI * freq / SAMPLE_RATE ;
    a = sin((1. - delay) * w0/2.) / (sin((1. + delay) * w0/2.)) ;
    fprintf(stderr, "... exact value for a = %f\n", a) ;

    /* okay, now generate one second of the plucked string sound.

    double *buf = calloc(L, sizeof(double)) ;

    /* initialize with random numbers. */
    for (i=0; i<L; i++) 
        buf[i] = 2.0 * drand48() - 1.0 ;

    x0 = y0 = 0. ;
    for (sample=i=0; sample < SAMPLE_RATE * 0.25 ; sample++) {
        j = i + 1 ;
        if (j >= L) j = 0 ;
        x1 = (buf[i] + buf[j]) / 2. ;
        /* implement the "allpass" filter. */
        y1 = a * x1 + x0 - a * y0 ;
        sf_write_double(sf, &y1, 1) ;
        y0 = y1 ;
        x0 = x1 ;
        buf[i] = y1 ;
        i = j ;

    sf_close(sf) ;

This just writes out 1/4 of a second of a note tuned at the frequency that you specify. I wrote a little python program, and computed an mp3 of a simple two octave run of notes.

Addendum: I synthesized the small set of three note chords just to test how them merged. They do sound a bit plinky and a little thin, but not terrible.

An AO-51 recording, and an attempt at a QSO…

Well, it’s been quite some time since I tried to work any of the FM birds, but I dusted off my TH-D7A, my voice recorder and my Arrow antenna, and decided to give it a go. It was pretty busy, and as usual I found it a bit difficult to get in. I got myself in the downlink once, and KB6LTY responded, but I couldn’t get through to confirm the QSO. Oh well. I’ll give SO-50 a try later, it is usually a bit more civilized there, and we have an 85 degree pass coming up shortly.

Until then, here’s a recording of the pass, a bit scratchy in the beginning, then it gets better.



The other day, I was trying to remember how to generate some simple sounds with minimal amounts of code. I remembered vaguely something called the Karplus-Strong algorithm, and it has been floating around in my head that I should look it up again. I mentioned it to Tom, and he spent 15 seconds drawing something on his whiteboard to remind me how the rudiments of it worked. I spent two or three minutes in a break typing in this small chunk of C to try it out:

#include <stdio.h>
#include <stdlib.h>
#include <sndfile.h>

 * ks.c
 * a small implementation of the karplus-strong synthesis algorithm
 * as described to me in 15 seconds or less by Tom Duff, and implemented
 * in the two or three minutes that it took to type in.

#define SAMPLE_RATE     44100
#define TONE            440

 *  BUFSIZE is essentially the period of the sound in samples.

#define BUFSIZE         (SAMPLE_RATE/TONE)

double buf[BUFSIZE] ;

    int sample ;
    int i, j ;
    double s ;
    SNDFILE * sf ;
    SF_INFO sfinfo ;

    sfinfo.channels = 1 ;
    sfinfo.samplerate = SAMPLE_RATE ;
    sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;

    sf = sf_open("test.wav", SFM_WRITE, &sfinfo) ;

    for (i=0; i<BUFSIZE; i++)
        buf[i] = 2.0 * drand48() - 1.0 ;

    for (sample=i=0; sample<5*SAMPLE_RATE; sample++) {
        j = i + 1 ;
        if (j >= BUFSIZE) j = 0 ;
        s = (buf[i] + buf[j]) / 2 ;             /* simplest filter imaginable */
        buf[i] = s ;
        sf_write_double(sf, &s, 1) ;
        i = j ;

    sf_close(sf) ;


Here is link to the single note that the above code generated. Sure, it’s not all that impressive by itself, but consider how simple the code is. It takes a small buffer of random numbers and a simple averaging operation, and generates something which isn’t a completely unpleasant plucked-string sound. I find that rather remarkable. I’ll probably use this in a little programming project that I’ve been mulling over which involves Christmas music. Stay tuned.

Congratulations to SpaceX, and a new Cubesat!

Lost in yesterday’s thrilling launch of the SpaceX Falcon-9/Dragon launch was that during their flight, they also apparently deployed a cubesat: CAERUS (which is apparently Greek for “opportunity”). It has a 900mw FM AFSK beacon downlink on 437.600, and operates under the amateur callsign KJ6FIX. I have not as yet been able to locate TLEs for the satellite, so I’m not sure of its orbit, period and the like, but it might be good to try to give it a listen.

Information Sciences Institute – CAERUS.

Addendum: The Falcon9 also carried a nanosatellite for the Army.