Friday, 1 November 2013

Counting Once More

Well,

Back from A71 land for a week or two and I have been looking once again at the Signal Generator that I made back here:

http://g0mgx.blogspot.co.uk/2013/10/so-hows-sig-gen.html

I was wondering about my choice of frequency counter and wondered if I could do something better. You may recall the counter I made back here:

http://g0mgx.blogspot.co.uk/2011/07/pic-n-choose-how-to-count.html

This was a PIC based frequency counter that I have blown the dust off (well re-made actually), please excuse the paws in the picture:


So, that has a gate time (right now) of 1s and a very good resolution. I have calibrated it against my 10MHz shack frequency reference from back here:

http://g0mgx.blogspot.co.uk/2011/07/ocxo-oh-you-mean-ocxo.html

and it works very well. What I don't like about it is the fact that it's coded in assembly language - I would much prefer to come up with something using a high level language that utilises Arduino.

Now, the processors on the Arduino boards dont have the same kind of timers that the PICs have and they are synchronous (this means they are gated internally to the system clock) which results in a maximum frequency that can be counted of about 40% of the system clock speed. For all the boards I have that would be about 6MHz. Also the smaller boards like the Uno have a resonator clocking the processor rather than a crystal - making the timing very hit and miss. So, I wondered if I could do something a little smarter with Arduino. I am contemplating using an external clock (based on a cheap watch crystal) to drive an interrupt on the board to control timing and an external pre-scaler to increase the maximum frequency I can count to the tune of 1024. If I use a simple CMOS 4040 chip to divide the incoming frequency by 1024 (say), the tricky bit will be not limiting the counting to a 1024 resolution - I'm still pondering that one.

Here's the watch clock running at 32.768KHz (great software number egh? 32768 is 2 ^ 15):


If I were to use one of the on-board Arduino hardware timers I could divide this 32.768KHz by 256 and crate an interrupt routine that ran 128 times per second. That should give me enough control to be able to gate an external incoming frequency to exactly one second. If I can do that then we should have the basis of an Arduino frequency counter. Seems a bit complicated though!

If I am going to go to all that trouble to generate a 1 second counter gate, I wonder why I can't use an external GPS - they can generate spectacularly accurate 1pps signals based on the US DoD atomic clocks....

Here's the mess I am working with at the moment:


And here is new Ham cat asleep on the data sheets I am trying to use:


Damn crazy cat:


Bonkers, egh?

No comments:

Post a Comment