The personal website of Scott W Harden
June 19th, 2011

Using Timers and Counters to Clock Seconds

My current secret project involves cramming a bunch of features into a single microcontroller. The chip I chose to use is an ATMega48. The ATMega 48 is $1.40 each in small quantities and comes crammed packed with features. The chip will be quite busy performing many functions, but its main loop will be executed at least every 50ms (required for USB, did I mention I'm bit-banging USB?!). I desire to have a bit of RTC (real time clock) functionality in that I need to precisely measure seconds, although I don't need to actually know the time or date. I desire to execute a function once per second, consuming a minimum of resources. The solution was quite simple, but I'm choosing to document it because it's somewhat convoluted in its explanation elsewhere on the net.

In summary, the way I accomplished this is using the built-in 16-bit timer (most AVRs have such a timer, including the ATTiny series). If I'm clocking the microcontroller at a known rate (determined by my selection of crystal, 12 MHz in my case), I can set the chip to continuously increment a register (timer1) and execute a function every time it overflows. Timer1 overflows at 2^16 (65,536). I enabled a prescaler value of 256 so that it takes 256 clock pulses to increment the timer. 12MHz/256 = 46,875 Timer1 increments each second. Since Timer1 overflows at 65,536, if I initiate Timer1 at 18,661 (65,536-46,875), it will take 1 second exactly to overflow. Upon overflowing, I do something (maybe flip a LED on or off), and reset the Timer1 back to its starting value 18,661. Done! Without using an external RTC module or even an external crystal or asynchronous timer, we managed to execute a function every second on the second with minimal overhead, allowing the chip to do everything it wants in the rest of the time!

The following example is a little more specific, executing a function exactly 15 times a second, and executing another function (to flash an LED) exactly every 1 second. It should be self explanatory:

// This function is called every second on the second
volatile int count; // this should be global
ISR(TIMER1_OVF_vect){
    TCNT1=62411;//Initialize our varriable (set for 1/15th second)
    count++; //increment 1/15th second counter
    if(count==15){
        statusTOGGLE(); // do your event (flash a LED in my case)
        count=0;//reset global variable
        }
    }
// This is for ATMega48, consult datasheet for variations for different chips
// place this just inside main(), before your primary loop
TCCR1B|=(1<<CS12);// prescaler 256
TIMSK1|=(1<<TOIE1); //Enable Overflow Interrupt Enable
TCNT1=62411;//Initialize our varriable (set for 1/15th second)
count=0; //Initialize a global variable
sei(); // enable interrupts

I'm having a lot of fun spending time going through the datasheet of this chip. It has a lot of features, and some I didn't really dig deeply into. Without giving away too much of my project, I'll show some photos I'm excited to share. My project interfaces the PC through USB directly attached to 2 pins using no intermediate chips (wow!). The photos demonstrate various steps in the temperature measurement and calibration tests...

Markdown source code last modified on January 18th, 2021
---
title: Using Timers and Counters to Clock Seconds
date: 2011-06-19 23:06:41
tags: circuit, microcontroller, old
---

# Using Timers and Counters to Clock Seconds

__My current secret project involves cramming a bunch of features into a single microcontroller.__ The chip I chose to use is an [ATMega48](http://www.swharden.com/blog/images/atmega48pinout.png). The ATMega 48 is $1.40 each in small quantities and comes crammed packed with features. The chip will be quite busy performing many functions, but its main loop will be executed at least every 50ms (required for USB, did I mention I'm bit-banging USB?!).  I desire to have a bit of RTC (real time clock) functionality in that I need to precisely measure seconds, although I don't need to actually know the time or date. I desire to execute a function once per second, consuming a minimum of resources. The solution was quite simple, but I'm choosing to document it because it's somewhat convoluted in its explanation elsewhere on the net.

__In summary, the way I accomplished this__ is using the built-in 16-bit timer (most AVRs have such a timer, including the ATTiny series). If I'm clocking the microcontroller at a known rate (determined by my selection of crystal, 12 MHz in my case), I can set the chip to continuously increment a register (timer1) and execute a function every time it overflows. Timer1 overflows at 2^16 (65,536).  I enabled a prescaler value of 256 so that it takes 256 clock pulses to increment the timer. 12MHz/256 = 46,875 Timer1 increments each second. Since Timer1 overflows at 65,536, if I initiate Timer1 at 18,661 (65,536-46,875), it will take 1 second exactly to overflow. Upon overflowing, I do something (maybe flip a LED on or off), and reset the Timer1 back to its starting value 18,661. Done! Without using an external RTC module or even an external crystal or asynchronous timer, we managed to execute a function every second on the second with minimal overhead, allowing the chip to do everything it wants in the rest of the time!

__The following example__ is a little more specific, executing a function exactly 15 times a second, and executing another function (to flash an LED) exactly every 1 second. It should be self explanatory:

```c
// This function is called every second on the second
volatile int count; // this should be global
ISR(TIMER1_OVF_vect){
    TCNT1=62411;//Initialize our varriable (set for 1/15th second)
    count++; //increment 1/15th second counter
    if(count==15){
        statusTOGGLE(); // do your event (flash a LED in my case)
        count=0;//reset global variable
        }
    }
```

```c
// This is for ATMega48, consult datasheet for variations for different chips
// place this just inside main(), before your primary loop
TCCR1B|=(1<<CS12);// prescaler 256
TIMSK1|=(1<<TOIE1); //Enable Overflow Interrupt Enable
TCNT1=62411;//Initialize our varriable (set for 1/15th second)
count=0; //Initialize a global variable
sei(); // enable interrupts
```

__I'm having a lot of fun__ spending time going through the datasheet of this chip. It has a lot of features, and some I didn't really dig deeply into. Without giving away too much of my project, I'll show some photos I'm excited to share. My project interfaces the PC through USB directly attached to 2 pins using no intermediate chips (wow!). The photos demonstrate various steps in the temperature measurement and calibration tests...

<div class="text-center img-border">

[![](DSCN1367_thumb.jpg)](DSCN1367.jpg)
[![](DSCN1372_thumb.jpg)](DSCN1372.jpg)

</div>
March 14th, 2011

$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!

Markdown source code last modified on January 18th, 2021
---
title: $10 Frequency Counter Finished!
date: 2011-03-14 10:29:21
tags: amateur radio, circuit, microcontroller, old
---

# $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:

![](https://www.youtube.com/embed/KduEGjvXaeY)

__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!

<dev class="center border">

[![](IMG_5452_thumb.jpg)](IMG_5452.jpg)

</dev>

__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.

<dev class="center border">

[![](IMG_5429_thumb.jpg)](IMG_5429.jpg)

</dev>

__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](http://www.radioshack.com/product/index.jsp?productId=2062217)) and request that their local store order them. When they arrive, you can buy them with no extra charge!

<dev class="center border">

[![](IMG_5425_thumb.jpg)](IMG_5425.jpg)

</dev>

__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.

<dev class="center border">

[![](IMG_5209_thumb.jpg)](IMG_5209.jpg)
[![](IMG_5222_thumb.jpg)](IMG_5222.jpg)
[![](IMG_5221_thumb.jpg)](IMG_5221.jpg)

</dev>

__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.

* [this post demonstrates it in action](http://www.swharden.com/blog/2011-02-12-wideband-receiver-works/)

* [this post shows it being used too](http://www.swharden.com/blog/2011-02-09-minimal-radio-project-continues/)

* [this post shows the first time I really got it working](http://www.swharden.com/blog/2011-02-04-frequency-counter-working/)

* [this post has the SCHEMATIC for the counter!](http://www.swharden.com/blog/2011-01-28-home-brew-transceiver-taking-shape/)

__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

![](http://www.youtube.com/embed/B0pj717UJPo)

__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

```c
#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:__

![](https://www.youtube.com/embed/_0NIDVJWo0U)

(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](http://hackaday.com/2011/03/14/frequency-counter-for-10-worth-of-parts/) and [Electronics-Lab](http://www.electronics-lab.com/blog/?p=10093)!

<dev class="center border">

[![](counter_EL_thumb.jpg)](counter_EL.jpg)
[![](counter_HAD_thumb.jpg)](counter_HAD.jpg)

</dev>
February 12th, 2011

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.

Markdown source code last modified on January 18th, 2021
---
title: Wideband Receiver Works!
date: 2011-02-12 23:28:56
tags: amateur radio, circuit, microcontroller, old
---

# Wideband Receiver Works!

__I demonstrated [earlier this week](http://www.swharden.com/blog/2011-02-09-minimal-radio-project-continues/) 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](http://www.swharden.com/blog/2010-02-07-simple-diy-stealth-apartment-antenna-for-20m-and-40m/) and vwa la, audio emerges!  Endless improvements can be made, but it demonstrates the functionality of this simple circuit.

![](https://www.youtube.com/embed/FajGFEL-DDg)
February 4th, 2011

Frequency Counter Working!

I'm ecstatic! Finally I built something that worked the first time. Well... on the 3rd attempt! The goal was to develop a minimal-cost, minimal complexity frequency counter suitable for amateur radio. Although I think I can still cut cost by eliminating components and downgrading the microcontroller, I'm happy with my first working prototype.

I haven't tested it rigorously with anything other than square waves, but I imagine that anything over 1PPV is sufficient (the input is through a bypass capacitor, internally biased right at the trigger threshold). Counting is accomplished by a 74LV8154N (dual 16-bit counter configured as 32-bit) which displays the count as four selectable bytes presented on 8 parallel pins. The heart of the device is an ATMega16 which handles multiplexing of the display and has a continuously-running 16-bit timer which, upon overflowing, triggers a reset of the counter and measurement of the output. Software isn't perfect (you can see the timing isn't accurate) but I imagine its inaccuracy can be measured and is a function of frequency such that it can be corrected via software. Here are some photos...

A PCB is DESPERATELY needed. I'll probably make one soon. Once it's a PCB, the components are pretty much drop-in and go! No wires! It'll be a breeze to assemble in 5 minutes. I wonder if it would make a fun kit? It would run on a 9V battery of course, but a calculator-like LCD (rather than LED) display would be ultra-low-current and might make a good counter for field operation (3xAAA batteries would last for months!)

UPDATE: I found out that the ATMega16 donation was from my friend Obulpathi, a fellow Gator Amateur Radio Club member! He also gave me a pair of ATMega32 chips. Thanks Obul!

Markdown source code last modified on January 18th, 2021
---
title: Frequency Counter Working!
date: 2011-02-04 21:26:26
tags: microcontroller, circuit, old
---

# Frequency Counter Working!

__I'm ecstatic!__ Finally I built something that worked the first time.  Well... on the 3rd attempt! The goal was to develop a minimal-cost, minimal complexity frequency counter suitable for amateur radio. Although I think I can still cut cost by eliminating components and downgrading the microcontroller, I'm happy with my first working prototype.

![](https://www.youtube.com/embed/heIkWcM9n0Q)

![](https://www.youtube.com/embed/EVZcyYnUipQ)

__I haven't tested it rigorously __ with anything other than square waves, but I imagine that anything over 1PPV is sufficient (the input is through a bypass capacitor, internally biased right at the trigger threshold).  Counting is accomplished by a 74LV8154N  (dual 16-bit counter configured as 32-bit) which displays the count as four selectable bytes presented on 8 parallel pins. The heart of the device is an ATMega16 which handles [multiplexing of the display](http://en.wikipedia.org/wiki/Multiplexed_display) and has a continuously-running 16-bit timer which, upon overflowing, triggers a reset of the counter and measurement of the output.  Software isn't perfect (you can see the timing isn't accurate) but I imagine its inaccuracy can be measured and is a function of frequency such that it can be corrected via software.  Here are some photos...

<div class="text-center img-border">

[![](IMG_5209_thumb.jpg)](IMG_5209.jpg)
[![](IMG_5222_thumb.jpg)](IMG_5222.jpg)
[![](IMG_5221_thumb.jpg)](IMG_5221.jpg)

</div>

__A PCB is DESPERATELY needed.__ I'll probably make one soon. Once it's a PCB, the components are pretty much drop-in and go! No wires! It'll be a breeze to assemble in 5 minutes. I wonder if it would make a fun kit? It would run on a 9V battery of course, but a calculator-like LCD (rather than LED) display would be ultra-low-current and might make a good counter for field operation (3xAAA batteries would last for months!)

_UPDATE: I found out that the ATMega16 donation was from my friend Obulpathi, a fellow Gator Amateur Radio Club member! He also gave me a pair of ATMega32 chips. Thanks Obul!_
January 28th, 2011

Home-Brew Transceiver Taking Shape!

In the spirit of furthering my knowledge of AC circuity, I'm trying to build a 100% homebrew transceiver. Yeah, QRSS and ultra-weak signal, ultra-narrowband communications is still fun, but it's not the same thrill as actually engaging in real time communication with somebody! My goal is a transmitter / receiver in a box. The basic features I desire are (1) multiple bands (at least 40m, 30m, 20m), (2) FULL-band coverage, (3) direct conversion receiver, (4) 10W transmitter, (5) digital frequency display, (6) common standard components (nothing mechanical, no air variable capacitors, everything must be easily obtainable on sites like Mouser and DigiKey), (7) SMT capability, (8) inexpensive ($20 is my goal, but that's a tough goal!). My designs are changing daily, so I'm not going to waste time posting schematics every time I write on this blog, but here are some photos and videos of the product in its current state.

(I just found that last video - it was one of my favorite songs as a teenager, performed live!)

UPDATE: I got a cool dual 16-bit counter IC made by TI, a SN74LV8154N - very cheap, and can be configured as a 32-bit counter. It seemed like a better option than multiple 8-bit counters, and this chip is about $0.60 so if I can make it work I'll be happy! I breadboarded it up (see circuit diagram) and it seemed to work. I started wiring it on the perf board, but haven't written software for it yet...

UPDATE - I just found this video on youtube I never posted on my blog, so this seems like an appropriate location for it:

Markdown source code last modified on January 18th, 2021
---
title: Home-Brew Transceiver Taking Shape!
date: 2011-01-28 14:13:33
tags: circuit, microcontroller, old, amateur radio
---

# Home-Brew Transceiver Taking Shape!

__In the spirit of furthering my knowledge of AC circuity,__ I'm trying to build a 100% homebrew transceiver.  Yeah, QRSS and ultra-weak signal, ultra-narrowband communications is still fun, but it's not the same thrill as actually engaging in real time communication with somebody!  My goal is a transmitter / receiver in a box. The basic features I desire are (1) multiple bands (at least 40m, 30m, 20m), (2) FULL-band coverage, (3) direct conversion receiver, (4) 10W transmitter, (5) digital frequency display, (6) common standard components (nothing mechanical, no air variable capacitors, everything must be easily obtainable on sites like Mouser and DigiKey), (7) SMT capability, (8) inexpensive ($20 is my goal, but that's a tough goal!). My designs are changing daily, so I'm not going to waste time posting schematics every time I write on this blog, but here are some photos and videos of the product in its current state.

![](https://www.youtube.com/embed/LACpR1vIwWM)

![](https://www.youtube.com/embed/Cq-lnMONUe4)

<div class="text-center img-border">

[![](IMG_4994_thumb.jpg)](IMG_4994.jpg)
[![](IMG_5013_thumb.jpg)](IMG_5013.jpg)

</div>

![](https://www.youtube.com/embed/B-klfgb125o)

(I just found that last video - it was one of my favorite songs as a teenager, performed live!)

__UPDATE:__ I got a cool dual 16-bit counter IC made by TI, a SN74LV8154N - very cheap, and can be configured as a 32-bit counter. It seemed like a better option than multiple 8-bit counters, and this chip is about $0.60 so if I can make it work I'll be happy! I breadboarded it up (see circuit diagram) and it seemed to work. I started wiring it on the perf board, but haven't written software for it yet...

<div class="text-center img-border">

[![](IMG_5042_thumb.jpg)](IMG_5042.jpg)
[![](IMG_5039_thumb.jpg)](IMG_5039.jpg)
[![](IMG_5041_thumb.jpg)](IMG_5041.jpg)

</div>

__UPDATE__ - I just found this video on youtube I never posted on my blog, so this seems like an appropriate location for it:

![](https://www.youtube.com/embed/w2MJQakqI0M)
Pages