SWHarden.com

The personal website of Scott W Harden

$10 Frequency Counter Finished!

Wow, what a cool project start to finish. Simple, cheap, and absolutely useful! … and not to mention big green numbers which make it look more impressive than it actually is! This is my super-simple frequency counter designed to be used for amateur radio, all for about $10. It was a project I developed over the last few months and documented all along the way. It’s finished I guess, so this will probably be the last post about it! Now for some vids and pics:

__Sure there’s room for improvement,__but that’s the fun part! This is a solid start and it’s cheap as can be. Simply improving software would greatly improve its accuracy. This doesn’t use any time-averaging at all! If you had it average 20 readings, it’d probably be much smoother, update every second, and have a higher precision. Also, there’s ample room left in the case to build in a transmitter or receiver!

There’s the finished project! It looks pretty good, considering it was built mostly out of junk box components, and everything it’s made from can be purchased cheaply online. I’m happy with it! I could improve my metal cutting, but that was the first time I ever cut a square window in aluminum so I’m still proud of myself.

As you can see the enclosure is made from sheet metal bent and cut into 2 pieces. The enclosure was from RadioShack, and was $2.99! Yeah it might be cheaper online, but when you add shipping it’s pretty convenient to get it locally. My local RadioShack didn’t carry these metal ones (they have stupid plastic ones), but I found these in Orlando and after asking the workers I learned that anyone can find any product online (such as the case I used) and request that their local store order them. When they arrive, you can buy them with no extra charge!

Here are some of the internals after being mounted. Heck, these are ALL the internals! You can tell I could have gotten away with a case one third this size if I had one available. Oh well, it’s still cool.

There are a few random photos of the build. It’s just a microcontroller reading (and resetting) a counter a bunch of times a second and displaying the result on the multiplexed display. That’s it! It was a lot of work, but a truly simple concept. The micro-controller is an ATMEL Atmega 16 AVR which is a little costly (around $5) but I had it on hand. I imagine you could accomplish the same thing with a far less intricate microcontroller! I’ll bet you could pull it off with an ATTiny2313, especially if you had a LCD display rather than a multiplexed LED like mine. The counter is a 74lv8154 chip, a 32-bit (dual 16-bit) counter IC at a bargain $0.50 - why when I google for home made frequency counters do I not see people using these? They daisy-chain multiple 8-bit counters! What a shortcut I stumbled upon…

Thinking of making your own? Go for it! Here are some of my other posts which describe the development of this thing (including stuff I tried that didn’t work). Everything I ordered should be stocked at mouser.com.

I guess that sums it up! What a fun hack. If you have any questions feel free to contact me (link in the menu on the right), and if you make one of these of your own I’d LOVE to see it! I’ll even slap a photo of yours on my site to share with everyone. I had fun working on this project. If you’re at all into radio, I recommend you try attacking a project like this too! It’s more efficient at determining frequency than turning on a commercial radio receiver and spinning the dial until you hear your transmitter ^_^

SUPPLEMENTAL VIDEO

Upon request here’s the code! It’s nothing special, and certainly not very efficient, but it’s quite functional. If you re-create this project, I recommend writing your own code rather than flat copying mine. You’ll learn a heck of a lot more… and my code for this is really crap XD

#include <avr/io.h>
#include <avr/delay.h>
#include <avr/interrupt.h>

#define A PC5
#define B PC0
#define C PC6
#define D PC7
#define E PC2
#define F PC4
#define G PC1
#define P PC3

char sendDigit(char row, char num, char dot){
    char val=0;
    if (num==0) {val|=(1<<A)|(1<<B)|(1<<C)|(1<<D)|(1<<E)|(1<<F);}
    if (num==1) {val|=(1<<B)|(1<<C);}
    if (num==2) {val|=(1<<A)|(1<<B)|(1<<D)|(1<<E)|(1<<G);}
    if (num==3) {val|=(1<<A)|(1<<B)|(1<<C)|(1<<D)|(1<<G);}
    if (num==4) {val|=(1<<B)|(1<<C)|(1<<F)|(1<<G);}
    if (num==5) {val|=(1<<A)|(1<<C)|(1<<D)|(1<<F)|(1<<G);}
    if (num==6) {val|=(1<<A)|(1<<C)|(1<<D)|(1<<E)|(1<<F)|(1<<G);}
    if (num==7) {val|=(1<<A)|(1<<B)|(1<<C);}
    if (num==8) {val|=(1<<A)|(1<<B)|(1<<C)|(1<<D)|(1<<E)|(1<<F)|(1<<G);}
    if (num==9) {val|=(1<<A)|(1<<B)|(1<<C)|(1<<F)|(1<<G);}
    if (dot==1) {val|=(1<<P);}
    PORTC=val;
    PORTD=(0b10000000>>row);
    _delay_ms(1);
}

void showNumber(unsigned long val){
    if (val==0) {return;}
    int i;
    int array[6]={10,0,0,0,0,0}; // NUMBER OF DIGITS
    int dly=10;
    i=6-1;
    while (val>0){
      array[i--]=val%10;
      val /= 10;
    }
    sendDigit(1,array[0],0);
    sendDigit(2,array[1],1);
    sendDigit(3,array[2],0);
    sendDigit(4,array[3],0);
    sendDigit(5,array[4],0);
    sendDigit(6,array[5],0);
    sendDigit(0,0,0);
}

#define byte1 PB4
#define byte2 PB3
#define byte3 PB2
#define byte4 PB1

unsigned long val=123456;
void readFreq(){
    unsigned long b4,b3,b2,b1;
    PORTB=255-(1<<byte1);b1=PINA;
    PORTB=255-(1<<byte2);b2=PINA;
    PORTB=255-(1<<byte3);b3=PINA;
    PORTB=255-(1<<byte4);b4=PINA;
    PORTB=0;PORTB=255;//RESET
    val=b1+b2*256+b3*65536+b4*16777216;
    val=val/3355;
}

int cnt=0;
ISR(TIMER1_OVF_vect)
{
   cnt++;
   readFreq();
}

int main(){
    DDRA=0;
    DDRB=255;
    DDRC=255;
    DDRD=255;

    TIMSK|= (1 << TOIE1); // Enable overflow interrupt
    sei(); // Enable global interrupts
       TCCR1B|=(1<<CS11); // Set up timer at Fcpu/8

    while(1){showNumber(val);}
}

… and I know it’s unrelated, but:

(I watched this four times - it’s so random I love it!)

Update

This project was featured on a couple of my favorite sites, Hack-A-Day and Electronics-Lab!


AJ4VD Portable - Spring Break QTH

So here’s the deal: I’m staying in Orlando, FL at my parents’ home for a large portion of spring break. I wanted to take some radio equipment, and set up a simple antenna to allow me to operate. This post documents what I did, and only time will tell how well my configuration actually works!

Let’s start with the video. It summarizes the antenna, and even shows me making my 1st contact with it to a guy in Vermont, and I’ve been getting good signal reports from Europe and South America as well.

This is what I started with. It’s pink because it’s the bedroom of my younger sister Leah. It might be a a little embarrassing to operate in such an environment, but my ego is up for the challenge!

The first thing I did was set up a table and run some wire out the window. I chose a window with a tree near by. The wire is not coax, but rather some el-cheapo speaker wire I found. It’s not 50 ohm impedance, but I imagine it will make the tuner happy anyhow.

I tied some random objects to the end of a fishing line and used a fishing pole to cast them up and over the tree branch I wanted. Believe it or not this took a lot of time, effort, broken lines, and frustration. Have someone help you do it, or practice doing it! I now appreciate how in an emergency situation getting something like this up might not be as easy as it seems…

The end of the wire splits in two and connects to two quarter-wavelength legs of a dipole resonant at the 40m wavelength (7mhz frequency), with each orange piece of wire being about 33ft in length.

When the fishing line looped over the branch (tied to the speaker wire) is hoisted up, the branch acts like a pulley and pulls the whole system up. You can see the junction of the wires if you look closely in the image…

The thing isn’t that visible, which is a plus. I don’t want anyone to know I operate! Notice how the orange wires are virtually invisible, even against a blue sky. Slick!

From far away the most noticeable wire is the speaker wire. I wish it weren’t reflective with a white stripe! Oh well, it’s all I’ve got. It’s more dramatic since the setting sun is behind me. Also keep in mind that there is a tree/shrubbery between my nearest neighbor and me, so I don’t think they can even see it from their house.

The final setup from inside. Poor Leah, I hope she doesn’t cry when she sees this! With the blinds closed I’m confident I can operate with confidence any time of the day. I don’t think I’ll push the setup beyond 40W (even though it can do 100W) just to keep things simple and safe. I look forward to operating CW (Morse code) later tonight! I wonder how this would do as a QRSS receiver? Much experimentation is left to perform! I’m happy knowing that in a very short time I set up a functional antenna to talk across the country at virtually no cost. Since I retained the pulley system, I can lower the antenna when it’s not in use, and hoist it up whenever I want. I’ll post a log of my contacts at the end of the week.

UPDATE: I’ve been making contacts on 40m, 20m, 17m, 12m, and 10m. I’m impressed how well I’ve been doing on 10m! Even with a dipole not cut for 10m, and oriented for north-south propagation, I’m getting Europe on this thing. I don’t know if it’s an improved antenna, or less noise being in a residential neighborhood. (Compare this to the University of Florida Gator Amateur Radio Club station located on top of a hospital). Here is a video showing some random 12m/10m contacts…

ANTENNA UPDATE - I ended up stringing a SECOND (much longer) antenna. Although it’s configured somewhat like a dipole, I consider it more of a long wire antenna. It’s ridiculously long (about 100 ft) and high (about 20 ft). The other wire is more like a RF ground, and is about 150ft. Here’s a photo of the new antenna (yellow) and the old antenna (orange). Both of them are functional, and I can switch between them quickly.

Although I intended the longer antenna for the lower bands (40m, 80m, and why not try 160m?), it seems to work surprisingly well on the higher bands too! I just worked Spain (EA5GPQ) on 24.967 MHz (12m), how cool is that? I can’t wait until later tonight when the lower bands open up. This is pretty fun…

March 10, 2011

While operating from a portable station in Orlando, Florida, I’m taking time to relax and investigate (through experimentation) different methods to rapidly deploy wire antennas. The antenna system described in my last post was taken down, half by me, and half by the storms that slammed central Florida last night and this morning! I also visited a store and purchased some flat 300-Ohm antenna wire (usually used between old TVs and TV antennas) that I hope will serve me well (better than speaker wire, probably less than 50-ohm coax). I used a fishing rod / line to string up the antenna, and here are some photos of the build. At the end you can see a video of my first QSO with this new antenna (OP2A in Belgium, over 4,500 miles away).

March 12, 2011

The end of the week is nearing! Tonight my family flies in from Colorado, and I’m holding my fingers crossed for several reasons. First, this is the first time that anyone in my entire family has seen an amateur radio. They understand it’s a big part of my life, but obviously they don’t really know what it is/does. I imagine I’ll give a demonstration later, and I hope that everything functions well (and I can have a few QSOs), and that it doesn’t come across as fickle. I think there’s quite a disconnect in interests between most of my family and me. For example, the things that I find fascinating (the RX/TX circuitry, my home brew designs, antenna theory, and digital exchanges) are not things I think they can understand or appreciate in the way that I do. Therefore I’m limited to common ground - talking to a few random people out there - and I don’t think that’s very impressive.

I did a quick estimate and it looks like I have a little over 200 contacts from this portable station! I haven’t broken it down by state or country, but I’m excited to dive into the logs a little further down the road. I grabbed a few random videos along the way, so I present the following:

Here I cam sending/receiving some very slow CW on 30m. This is actually one of my first CW contacts on 30m, as I usually just play with QRSS on 10.140MHz!

This is just a demonstration part for informational purposes and part just for me to have and look back on in the future. I’m sure in the future I’ll laugh at the way I operate (I already find it funny how my voice goes up an octave when I pick up a hand mike!), but it is what it is. For newcomers to HF, this represents what can be done just using about 50W of power and a wire antenna hung in a tree!

I also tried my hand at QRSS reception with this antenna (almost forgot to post it). I realized the shortcoming(s) of my QRSS VD software when I couldn’t get it to run on my linux box! The netbook ran Ubuntu and used the pulse audio system and QRSS VD used PyAudio for linux audio support (runs fine on windows though) and PyAudio likes ALSA and not pulse! It’s so frustrating - I wish there were a better cross-platform solution than pyAudio. Anyhow, in a humbling moment I ended-up actually using Argo (my “competitor” program) fired up with WINE under linux (burn, lol) to grab QRSS and save captures, then I used the QRSS Stitcher (my software) to assemble a few hours worth while the XYL and I went out to lunch. Frequency is 10.140MHz. Here’s the result!

AJ4VD Portable Logbook

March 6-12, 2011 (Orlando, FL):

39 States (146 QSOs)

35 Countries (62 QSOs)


RF Workshop Launched

The Radio Active Workshop kicked off a couple weeks ago in the engineering department of the University of Florida led by yours truly! Jimmy Lin (an aerospace engineering graduate student) set up the group, and together we’re trying to provide an open environment for engineering students (or anyone who’s interested) to meet, share ideas, and get some practical hands-on experience building stuff. We made gave it a radio theme so it meshes nicely with the Gator Amateur Radio Club. I brought a lot of my equipment from home (components, o-scope, tools, etc) and we all started building right away!

This was the first time many students worked on copper boards, as most of them spend their time working with breadboards and/or computer simulations. For a couple it was the first time picking up a soldering iron (how exciting!). My goal is to start everybody off building the same thing (an ultra-simple multi band radio receiver) with a modular design, then turn everyone loose to modify it to their liking. There are a lot of possibilities, from computer control, micro-controller interaction, frequency measurement, stability testing and compensation, audio processing, and of course making it transmit (which should be trivial!). I’m very excited, but still a bit cautious - I think it’s too early to tell whether or not this will be a worthwhile success, or misdirected enthusiasm! I’ll give it my all and see where it goes…

One thing that struck me as a challenge is the difference in levels of experience of the group. We have everything from undergraduate freshmen to experienced graduate students all working on the same project. You can imagine how each of us look at the same circuit differently! I hope that some of the more experienced students can help those less experienced (I fit in that group!) gain some knowledge and come up with some ideas to improve the project.

There are many other projects which would be fun to work on! A cheap and simple frequency counter would be a fun project, especially for the micro-controller gurus out there. Then there’s the enclosure problem - I hope to get a mechanical engineering student to help me out in that department. It would be nice to have a design for an inexpensive HF receiver that can be produced in a small quantity and made available for check out from school radio clubs to let new hams (or those interested in radio) the ability to listen to HF, learn CW, or decode some digital signals! When I got home my wife and I were talking about it and she gave me a hard time for my devices looking so sloppy, specifically commenting on my soldering. Can you believe it? A nursing student ripping on a dental student’s soldering skills – what a funny life I stumbled into =o) Anyhow, I challenged her to make a circuit (switch-controlled LED with filtering capacitor for smooth fade-off) look pretty, and she did! Although it’s not pictured, I got a snapshot of her building it…

Details of the board won’t be published quite yet. I wish to improve it and finalize the design. A PCB would be nice, but I’m very very very hesitant to go in that direction. PCBs imply “finished” circuits, and I don’t want to give the impression that any circuit I design shouldn’t be tinkered with to try to improve it! We’ll figure that out as it goes. Here are a couple photos of the modules I’m providing as a starting point for the students to make. So far they’ve only made the center board, and next week I imagine we’ll start on (maybe even complete) the rest…

And of course a video - it’s a bit on the long and redundant side, but it clearly demonstrates what we’re working on at the workshop. Again, note that this board is purely for educational purposes, and the amount of exposed copper in the critical sections (antenna/oscillator) obviously needs to be minimized in more finalized designs.

Here’s my most recent schematic:

WARNING: This schematic has a couple problems. First and foremost, pins 2 and 3 are ACTUALLY pins 1 and 2 (antenna). Pin 3 should be GROUDNED. Also, the series capacitor between the two ICs was replaced by a 22uF capacitor.


Wideband Receiver Works!

I demonstrated earlier this week that I can generate a wide range of frequencies using a tank circuit and the oscillator in a SA612. I added a little circuitry and hooked the receiver to my homemade indoor 20m/40m dipole antenna and vwa la, audio emerges! Endless improvements can be made, but it demonstrates the functionality of this simple circuit.


First Injections

Yesterday was the notorious “injection lab” where 80 second-year dental students practice injecting on patients (classmates) for the first time. We all performed 5 injections blocking different nerves, some seemed more invasive than others. It was an interesting day I will probably remember. The photo is of my classmate (Steven) giving his first injection to me! Surprisingly it didn’t hurt as much as I expected.

After the event I went to a GARC (Gator Amateur Radio Club) meeting and then to a workshop I’m helping lead in the engineering building. The specific direction of the workshop is still emerging, but it’s in the realm of home-brew radio devices. I took some of the equipment I’ve made and several people seemed interested in potentially working with me on my projects. It would be wonderful to have actual engineers working on these electrical projects!