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

Permeability Tuned Oscillator (PTO) Working Nicely

My last entry described my accidental discovery of the PTO for QRP purposes. I breadboarded it and was amazed at the results! I went ahead and built this carefully in an enclosure and the output is wonderful. It's strong, it's stable, and it tunes effortlessly over the same range it did before (about 1MHz). The video describes details of the action, and demonstrates the stability of the oscillator by letting you hear it audibly on a nearby receiver.

The fundamental concept and hardware is straightforward. Two nuts are soldered into an Altoids tin providing much-needed grounding for the screw (reduces shift when it's touched). Also the wire soldered over the screw is pinched firmly at the base to apply constant pressure to the screw to make it hard to turn and therefore more stable while turning. The inductor is a bunch of turns (no idea how many, about a meter of magnet wire) around a McDonalds straw.

Alltogether it's a simple colpitts oscillator with a MPF102 JFET at its heart, using a 74hc240 CMOS buffer as an amplifier. There's a voltage regulator in there too.

The result? Pretty darn stable (by CW QSO standards). That's without any regard to thermal isolation or temperature compensation. I'm quite pleased! I look forward to MUCH more experimentation now that I'm starting to feel good about designing and building simple, tunable, stable oscillators. It's always hard to nail all 3 in a single device!

Markdown source code last modified on January 18th, 2021
---
title: Permeability Tuned Oscillator (PTO) Working Nicely
date: 2011-06-05 02:21:40
tags: circuit, amateur radio, old
---

# Permeability Tuned Oscillator (PTO) Working Nicely

__My last entry described my accidental discovery of the PTO__ for QRP purposes. I breadboarded it and was amazed at the results! I went ahead and built this carefully in an enclosure and the output is wonderful. It's strong, it's stable, and it tunes effortlessly over the same range it did before (about 1MHz). The video describes details of the action, and demonstrates the stability of the oscillator by letting you hear it audibly on a nearby receiver.

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

__The fundamental concept and hardware is straightforward.__ Two nuts are soldered into an Altoids tin providing much-needed grounding for the screw (reduces shift when it's touched). Also the wire soldered over the screw is pinched firmly at the base to apply constant pressure to the screw to make it hard to turn and therefore more stable while turning. The inductor is a bunch of turns (no idea how many, about a meter of magnet wire) around a McDonalds straw.

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

[![](DSCN1350_thumb.jpg)](DSCN1350.jpg)

</div>

__Alltogether it's a simple colpitts oscillator__ with a MPF102 JFET at its heart, using a 74hc240 CMOS buffer as an amplifier. There's a voltage regulator in there too.

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

[![](DSCN1356_thumb.jpg)](DSCN1356.jpg)

</div>

__The result?__ Pretty darn stable (by CW QSO standards).  That's without any regard to thermal isolation or temperature compensation. I'm quite pleased!  I look forward to MUCH more experimentation now that I'm starting to feel good about designing and building simple, tunable, stable oscillators. It's always hard to nail all 3 in a single device!

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

[![](DSCN1357_thumb.jpg)](DSCN1357.jpg)

</div>
June 2nd, 2011

Screwy Oscillator Idea

Can you believe it's been almost 3 months since my last post? A lot's been going on since then, namely the national board dental exam. I'm happy to report I prepared for it and performed above and beyond my expectations on the exam, and I'm quite satisfied. The last few weeks were quite a strain on my life in my aspects, and during that time I realized that I didn't appreciate the little things (such as free time) that I would have loved to experience instead of studying. I guess it's the feeling you have when you're really sick and think to yourself "remember this moment so that when you're well again, you can appreciate feeling well". Now that it's all behind me, what do I do? I sit at my work station, play some light music, grab an adult beverage, turn on the soldering iron, and make something special.

I'm resuming work on my simple transmitter/receiver projects, but I'm working at the heart of the device and experimenting with oscillator designs. I built various Colpitts, Hartley, Clapp, and other oscillator designs, and I think I landed on a design I'm most comfortable with replicating. I'm actually creating a voltage controlled oscillator (VCO or VFO), with a frequency that can be adjusted by rotating a dial or two. It's always a balance between stability and tunability for me. I don't want to use polyvaricon variable capacitors (expensive!), and LED-based varactor diode configurations only give me a swing of about 20pf. What did I come up with?

I had tremendous success using a variable inductor for coarse tuning! The inductor is nothing more than a screw entering and exiting the center of an air core inductor. I can't claim all the credit, because I got the idea from this photo on one of the coolest websites on the planet, Alan Yates' Lab. It looks like Alan got the idea from this page... This is so useful! Is this common HAM knowledge? Why am I, someone who's been into RF circuitry for a couple of years now, JUST learning about this? I'm documenting it because I haven't seen it out there on the web, and I feel it should be represented more! Here's a video of it in action:

This is the circuit I was using:

This is what it looked like before the glue or screw:

Here's the variable inductor enveloped in hot glue before it cooled and turned white:

At the end of the day, it looks nice!

Band changes can be accomplished by swapping the capacitor between the inductor and ground. It couldn't be any easier! I'll see if I can build this in a more compact manner...

UPDATE (2 days later): Apparently this is called a "Permeability Tuned Oscillator", or PTO. It's an early design for radios (earlier than variable capacitors) and I guess therefore not described often on the internet. Knowing it's official title, searching yielded a few pages describing this action: Dave, G7UVW did some analytical measurements using a mercury core!The Tin Ear uses a PTO as its primary tuning method (also McDonalds straw?) This guy made a PTO out of PVC with a nice screw handle! This PTO kit seems to be used in many projects.The Century 21's VFO is a PTO! I love that rig and had no idea it tuned like that... This guy used a PTO in his MMR-40 radio.

Someone on Hackaday recommended This ARRL Challenge winner with an almost identical design as mine!I guess this bright idea was so bright, it was thought of by many people long ago...

Markdown source code last modified on January 18th, 2021
---
title: Screwy Oscillator Idea
date: 2011-06-02 21:18:47
tags: circuit, amateur radio, old
---

# Screwy Oscillator Idea

__Can you believe it's been almost 3 months since my last post?__ A lot's been going on since then, namely the national board dental exam. I'm happy to report I prepared for it and performed above and beyond my expectations on the exam, and I'm quite satisfied.  The last few weeks were quite a strain on my life in my aspects, and during that time I realized that I didn't appreciate the little things (such as free time) that I would have loved to experience instead of studying. I guess it's the feeling you have when you're really sick and think to yourself "remember this moment so that when you're well again, you can appreciate feeling well". Now that it's all behind me, what do I do?  I sit at my work station, play some [light music](http://www.youtube.com/watch?v=7nmTRZLLO2M), grab an adult beverage, turn on the soldering iron, and make something special.

__I'm resuming work on my simple transmitter/receiver projects,__ but I'm working at the heart of the device and experimenting with oscillator designs. I built various [Colpitts](http://en.wikipedia.org/wiki/Colpitts_oscillator), [Hartley](http://en.wikipedia.org/wiki/Hartley_oscillator), [Clapp](http://en.wikipedia.org/wiki/Clapp_oscillator), and other oscillator designs, and I think I landed on a design I'm most comfortable with replicating. I'm actually creating a voltage controlled oscillator (VCO or VFO), with a frequency that can be adjusted by rotating a dial or two. It's always a balance between stability and tunability for me. I don't want to use polyvaricon variable capacitors (expensive!), and LED-based varactor diode configurations only give me a swing of about 20pf. What did I come up with?

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

[![](DSCN1335_thumb.jpg)](DSCN1335.jpg)

</div>

__I had tremendous success__ using a variable _inductor_ for coarse tuning! The inductor is nothing more than a screw entering and exiting the center of an air core inductor. I can't claim all the credit, because I got the idea from [this photo](http://www.vk2zay.net/article/45) on one of the coolest websites on the planet, [Alan Yates' Lab](http://www.vk2zay.net). It looks like Alan got the idea from [this](http://www.wa6otp.com/pto.htm) page... This is so useful! Is this common HAM knowledge? Why am I, someone who's been into RF circuitry for a couple of years now, JUST learning about this? I'm documenting it because I haven't seen it out there on the web, and I feel it should be represented more! Here's a video of it in action:

![](https://www.youtube.com/embed/5JjF8-hjL9E)

This is the circuit I was using: 

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

[![](DSCN1334_thumb.jpg)](DSCN1334.jpg)

</div>

This is what it looked like before the glue or screw: 

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

[![](DSCN1307_thumb.jpg)](DSCN1307.jpg)

</div>

Here's the variable inductor enveloped in hot glue before it cooled and turned white: 

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

[![](DSCN1316_thumb.jpg)](DSCN1316.jpg)

</div>

At the end of the day, it looks nice! 


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

[![](DSCN1339_thumb.jpg)](DSCN1339.jpg)

</div>

__Band changes can be accomplished by__ swapping the capacitor between the inductor and ground. It couldn't be any easier! I'll see if I can build this in a more compact manner...

**UPDATE (2 days later):** Apparently this is called a "Permeability Tuned Oscillator", or PTO. It's an early design for radios (earlier than variable capacitors) and I guess therefore not described often on the internet. Knowing it's official title, searching yielded a few pages describing this action: [Dave, G7UVW](http://webshed.org/wiki/Mercury_PTO) did some analytical measurements using a mercury core!The [Tin Ear](http://www.amqrp.org/kits/tin_ear/index.html) uses a PTO as its primary tuning method (also McDonalds straw?) [This guy](http://www.geocities.ws/k7hkl_arv/PTO_Simplified_Mechanicals.html) made a PTO out of PVC with a nice screw handle! [This PTO](http://www.wa6otp.com/pto.htm) kit seems to be used in many projects.The [Century 21's VFO](http://www.io.com/~n5fc/c21_pto.htm) is a PTO! I love that rig and had no idea it tuned like that... [This guy](http://kd1jv.qrpradio.com/ARRLHBC/ARRL_MMR40.html) used a PTO in his MMR-40 radio.

Someone on Hackaday recommended [This ARRL Challenge winner](http://www.arrl.org/files/file/QST/Homebrew%20Challenge/HBC%201%20Winner-KD1JV.pdf) with an almost identical design as mine!I guess this bright idea was so bright, it was thought of by many people long ago...
March 17th, 2011

QRSS and WSPR Presentation for GARS

Last night I had the honor of speaking for GARS, the Gainesville Amateur Radio Society. Their club call (K4GNV) is used by the 146.820 MHz FM repeater (the most active in Gainesville). There were a few dozen attendees, and it was interesting to give a lecture on advanced radio topics to a body that had a lot of experience with RF. This group was a couple generations older and a lot more experienced and than the groups of students I'm used to speaking for! Overall it went well and I'm glad I had the opportunity to present. It's probably one of those things I'll remember for quite some time.

The talk was an overview of QRSS, WSPR, and ultra-narrowband data transmission, with a focus on home made transmitters and simple radio/PC/software receiving stations. I did a little more research into WSPR in the process of preparing for it (including familiarizing myself with the details of how the data is encoded into 4 tones) and I am glad I understand more about the mode than I did before I started. I grinned as I showed a few slides of Hans Summers' kit pictures. I wonder if anyone in the group will buy one? I hope so! Below are a few links I put together where people can go for more information about QRSS and WSPR:

Markdown source code last modified on January 18th, 2021
---
title: QRSS and WSPR Presentation for GARS
date: 2011-03-17 10:15:15
tags: amateur radio, qrss
---

# QRSS and WSPR Presentation for GARS

__Last night I had the honor of speaking for GARS,__ the Gainesville Amateur Radio Society. Their club call (K4GNV) is used by the 146.820 MHz FM repeater (the most active in Gainesville).  There were a few dozen attendees, and it was interesting to give a lecture on advanced radio topics to a body that had a lot of experience with RF. This group was a couple generations older and a lot more experienced and than the groups of students I'm used to speaking for! Overall it went well and I'm glad I had the opportunity to present. It's probably one of those things I'll remember for quite some time.

<dev class="center border">

[![](qrss_presentation_GARS_thumb.jpg)](qrss_presentation_GARS.jpg)

</dev>

__The talk was an overview of QRSS, WSPR, and ultra-narrowband data transmission__, with a focus on home made transmitters and simple radio/PC/software receiving stations. I did a little more research into WSPR in the process of preparing for it (including familiarizing myself with the details of how the data is encoded into 4 tones) and I am glad I understand more about the mode than I did before I started. I grinned as I showed a few slides of [Hans Summers' kit pictures](http://www.hanssummers.com/qrsskit). I wonder if anyone in the group will buy one? I hope so! Below are a few links I put together where people can go for more information about QRSS and WSPR:

* [Knights QRSS mailing list](http://cnts.be/mailman/listinfo/knightsqrss_cnts.be)
* [Knights QRSS Compendium](http://digilander.libero.it/i2ndt/grabber/grabber-compendium.htm)
* [WSPR home page](http://wsprnet.org/)
* [Introduction to QRSS](http://www.ussc.com/~turner/qrss1.html)
* [Hans Summers' QRSS kit](http://www.hanssummers.com/qrsskit)
* [Schematic for that kit](http://www.hanssummers.com/images/stories/qrsskit/1/circuit.jpg)
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>
March 14th, 2011

6 Day QRSS Stitch

Has this been done before? I don't know how useful it is, but I did it just for kicks and it turned out pretty cool. I realized that my strong signal (what is that?!) which is desentizing the the receiver is repetitive by day. Perhaps it's something at the hospital! Days are 3/7/2011 through 3/12/2011, separated by black lines.

Higher resolution image here:

Cool stuff. All right, I'm outta here.

Markdown source code last modified on January 18th, 2021
---
title: 6 Day QRSS Stitch
date: 2011-03-14 16:10:10
tags: qrss
---

# 6 Day QRSS Stitch

__Has this been done before?__ I don't know how useful it is, but I did it just for kicks and it turned out pretty cool. I realized that my strong signal (what is that?!) which is desentizing the the receiver is repetitive by day. Perhaps it's something at the hospital! Days are 3/7/2011 through 3/12/2011, separated by black lines.

<dev class="center border">

[![](6-day-sml_thumb.jpg)](6-day-sml.jpg)

</dev>

Higher resolution image here:

<dev class="center border">

[![](6-day-bit_thumb.jpg)](6-day-bit.jpg)

</dev>

Cool stuff.  All right, I'm outta here.
Pages