Frequency Counter Project - Page 1
Forum section: electronics / projects

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: September 07, 2014, 12:53:31 pm
content: I'm starting a frequency counter design based offhttp://lea.hamradio.si/~s53mv/counter/counter.htmlby S53MV but I'm trying to make a few enhancements, some of which are driven by the fact that some components used seem to be no longer available.I'm aiming to use a PIC16F883 running at 5 volts, that matches the original design and the 2x20 LCD I'm aiming for is also 5V. For better accuracy, I could use an external ±0.5ppm TCXO device such as thishttp://www.digikey.com/product-detail/en/ASVTX-09-20.000MHZ-T/535-9702-1-ND/1578302which theoretically is available in a 5V version but that is not listed by any major supplier.The data sheet for the ASVTX-09-20.000MHZ-T says that it has a clipped sine wave output voltage that's 0.8Vp-p min. If I want to drive the OSC1 pin of the PIC (running at 5V) using the 3V version of this oscillator, I think I will need some kind of level translation. Or maybe the schmidt trigger section in the PIC input stages takes care of that?I have a lot of experience with PICs but the real question here is how to drive OSC1 using the output from the Oscillator block, especially because of the voltage differences. Any advice is welcome.Thanks,

author: dannyf
author_rank: Super Contributor
timestamp: September 07, 2014, 02:08:00 pm
content: QuoteI would suggest a few changes:1) the prescaler can be done with something simpler / faster, like MB506 or MC100EL family of counters -> those guys go all the way to Ghz.2) you may want to think about if you want to read prescalers. It adds to some hardware complexity and lots of software complexity.3) input signal conditioner: may be a few gates connected as linear amplifier.QuoteA few options:1) you can run the 3v oscillator at 5v - I have done that for many oscillators, and TCO-919 most recently;2) you can run the pic at 3v. The lcd can still run at 5v or you can use a charge pump to create a negative voltage to drive the contrast.3) even if you run the oscillator at 3v and the pic at 5v, they are likely to work gotether.4) if not, run the oscillator's output through a not/nand gate + feedback resistors and call it a day. See my TCO-919 thread - the Vpp there is less than 100mv or even smaller, as I recall.

author: German_EE
author_rank: Super Contributor
timestamp: September 07, 2014, 02:10:39 pm
content: The problem is the 0,8V output of the oscillator. A simple transistor amplifier driven off the 5V supply will have enough gain but it would be better if you chose an oscillator with either CMOS or TTL output levels.

author: dannyf
author_rank: Super Contributor
timestamp: September 07, 2014, 02:18:42 pm
content: QuoteIt may not be a problem. Give it a try and it doesn't pay to over-engineer it.

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: September 07, 2014, 02:47:46 pm
content: Quote from: dannyf on September 07, 2014, 02:18:42 pmI believe that the OSC1 & OSC2 inputs are not normal logic level inputs; if you scope the OSC1 pin whicle it's running on an external crystal, you only get about 1 volt-pp for the sine wave signal so it might just work anyway.If I took the whole 74LVC109 - 74AC74 - PIC chain and ran it on 3.3 volts, then I could use the oscillator block and figure out how to interface with the LCD, or I could double the display price to $30 and use an OLED that's rated at 3.3 volts. There are many possibilities on the display side.I struggled to find the 2N3960 and have found a close replacement, the DSC3G03, I'm sure there'll be tweaks to get that interface running.I actually have already developed a working PIC frequency counter project but the front end is useless.

author: dannyf
author_rank: Super Contributor
timestamp: September 07, 2014, 02:59:01 pm
content: QuoteDo you have access to the internet / distributors / ebay? I would venture to guess that any 1Ghz+ npn would work.I would also check out jfets / dual gate mosfets (bf998 for example). If you think you will stay with 50ohm input, those MMIC are also quite wonderfully cheap.Not to mention the use of logic gates here.QuoteCheck out those service manuals from HP.

author: dannyf
author_rank: Super Contributor
timestamp: September 07, 2014, 03:00:19 pm
content: If you are willing to stay with a 50ohm input, think about a common base amplifier, or a cascode input stage.

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: September 07, 2014, 08:53:21 pm
content: Quote from: dannyf on September 07, 2014, 03:00:19 pmThanks, don't know whether or not you read the full design that I linked to but that it has 3 different input stages: a TTL, an RF, and a microwave (5 GHz with prescaler). The main schematic takes input from one of those stages (at 50 Ohms I think) and the matching is done by the 2N3960 feeding into the 74F50109. S53MV has told me that changing the first flip-flop to a 74LVC109 followed by a 74AC74 will require different pull ups to match the devices to the bipolar inputs of the PIC but I can't get the 74F50109 so I'm planning on using the 74LVC109.Any circuit schematic links for suggested changes would be useful, I'll pull the design schematic together and post it up here. I'll also share the board design for those interested enough.

author: dannyf
author_rank: Super Contributor
timestamp: September 07, 2014, 09:09:08 pm
content: Those are fairly weird devices.If the MB or MC100EL devices are two exotic for you, try 393 or 4040 counters -> 393 is more flexible and 4040 is all in one. Many of they go over 150Mhz and some over 200Mhz -> more than sufficient for this application.And the counting can be stopped by the mcu - making the reading of the prescaler very easy.

author: DmitryL
author_rank: Regular Contributor
timestamp: September 07, 2014, 10:11:54 pm
content: Quote from: Gandalf_Sr on September 07, 2014, 12:53:31 pmErr.. Looks like rubbish to meWhan about a reciprocal Freq. counter based on EPM3064 & ATMega8 ? 100Mhz bandwidth (without a prescaler), interpolator for measuring pulse width, proper analog frontend, etc. ? If you ask the author nicely, he will also give you a source code, otherwise, only schematics, PCB layout and firmware avalaiblehttp://www.cqham.ru/forum/showthread.php?t=20109That project cost me about 30 GBP in parts.ops, it is in Russian

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: September 07, 2014, 10:30:31 pm
content: The 74LVC109 can count up to almost 200 MHz so that's why it's favored as the best part to replace the 74F50109. I could:1. Stick with the original design as closely as possible.2. Put an ECL counter like the MC100E137FNR2G as the front end, that would count up to 1.5 GHz and still give full digit count down to 1 Hz using the 74LVC109+74AC74+PIC counter. But what about the input stage? Are there good examples of input stages for this chip?3. Put an ECL counter like the MC100E137FNR2G as the front end and then add a PIC24 or PIC32 or some other microcontroller that can count at 200 MHz and then get the first 8 bits from the front end ECL chip and the final 24 as a counter in the PIC.As always, the front end is my problem.

author: dannyf
author_rank: Super Contributor
timestamp: September 07, 2014, 10:47:40 pm
content: QuoteYou may have to wait for a few decades for that kind of chips to be made.I think sticking with the original design, without any modification, is probably the best course of action for you.

author: tggzzz
author_rank: Super Contributor
timestamp: September 07, 2014, 11:11:56 pm
content: Quote from: dannyf on September 07, 2014, 10:47:40 pmNope. The Xilinx Zynq family has been available for several years; there are many dev boards available.

author: hamster_nz
author_rank: Super Contributor
timestamp: September 08, 2014, 01:49:38 am
content: Quote from: tggzzz on September 07, 2014, 11:11:56 pmHeck, even a little old $25 Spartan 6 FPGA - about 5 years old - can count at 950MHz, using a single flip-flop as a 2:1 prescaler (seehttp://hamsterworks.co.nz/mediawiki/index.php/High_Speed_Frequency_Counter).And it is a heck of a lot easier to engineer a PCB for, given that is available in TQFP package

author: salbayeng
author_rank: Frequent Contributor
timestamp: September 08, 2014, 07:03:02 am
content: Prescaler: Some time back NatSemi made the LMX23xx range of synthesisers, You could use one of these (or a modern equivalent), ignoring the VCO aspect.It has a programmable prescaler in it , so GHZ in , MHZ out , with an SPI interface. OR you could use the reference divider to make some programmable frequency source.Re connecting clock to PIC , just connect a 100k? resistor between X1 and X2 (this gives the correct DC bias to get 50% duty cycle) and capacitively (100pF?) connect the clock to X1 .One way to look at this is you have made an injection locked RC clock.

author: tggzzz
author_rank: Super Contributor
timestamp: September 08, 2014, 09:26:16 am
content: Quote from: hamster_nz on September 08, 2014, 01:49:38 amJust so. Given that is it often difficult to coerce two radically different technogies into the same package (and company!), it is often cheapest to simply mount two packages on a PCB.But the original point was about a counter and cpu in the same package and, softcores excepted, the Zynq is the best current exemplar.

author: dannyf
author_rank: Super Contributor
timestamp: September 08, 2014, 10:27:21 am
content: Quote from: tggzzz on September 08, 2014, 09:26:16 amI thought it said something about a PIC24 or PIC32 that can count to 200Mhz.A re-reading may be helpful.

author: tggzzz
author_rank: Super Contributor
timestamp: September 08, 2014, 11:51:04 am
content: Quote from: dannyf on September 08, 2014, 10:27:21 amI'm sorry, I'm being a bit slow today: what's your point?

author: Strada916
author_rank: Frequent Contributor
timestamp: September 08, 2014, 12:07:25 pm
content: www.siliconchip.com.au/Issue/2012/December/A+2.5GHz+12-digit+Frequency+Counter,+Pt.1this might be of interest

author: BloodyCactus
author_rank: Frequent Contributor
timestamp: September 08, 2014, 04:53:29 pm
content: that looks like an interesting article. thanks for the link

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: September 08, 2014, 05:15:53 pm
content: Yes, thanks. It looks interesting but I have to pay $9 just to get Pt1 of the article.

author: BloodyCactus
author_rank: Frequent Contributor
timestamp: September 08, 2014, 05:56:38 pm
content: Quote from: Gandalf_Sr on September 08, 2014, 05:15:53 pmyeah I was looking more, no PDF, the 'online' version is FLASH ugh. so much for buying the online and printing the article. sigh.

author: Strada916
author_rank: Frequent Contributor
timestamp: September 08, 2014, 06:12:21 pm
content: Those of us in Australia can go to your local reference library. Goto shelf 621 in journals and get copies that way. Glandulf_Sr pm sent.

author: BloodyCactus
author_rank: Frequent Contributor
timestamp: September 08, 2014, 07:04:54 pm
content: Quote from: Strada916 on September 08, 2014, 06:12:21 pmif I can drag the wife away from her parents here in the usa and move back home I'll try that out

author: dannyf
author_rank: Super Contributor
timestamp: September 09, 2014, 10:42:17 am
content: There is an 8-bit counter implemented by someone from Korea. It basically follows the approach I laid out earlier: for the 2.5Ghz input, mmic pre-amplifier, mb506 divider; for the 10Mhz (or 100Mhz) input, jfet preamplifier. Signal then goes to a 393 read parallelly by the mcu.Frequency meters are some of the simplest to implement over a mcu. I posted an example where the only part is a 4-digit led sitting onto of a mcu. It counts up to 20Mhz and displays the 8-digit output on a 4-digit led.

author: Strada916
author_rank: Frequent Contributor
timestamp: September 09, 2014, 12:03:47 pm
content: Quote from: BloodyCactus on September 08, 2014, 07:04:54 pmNice one. LOL Email sent

author: BloodyCactus
author_rank: Frequent Contributor
timestamp: September 09, 2014, 02:11:26 pm
content: thanks for the email. if the article says it has good accuracy, i may order the pcb's from them.Id love to move back to Melbourne if I could.

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: September 10, 2014, 01:04:31 pm
content: I'm thinking of a designing a simpler version to start off with. I could do a front end similar to the silicon chip article and feed that into an improved version of a counter that I've already made which uses a 74LVC161 4-bit counter as the prescaler. The silicon chip version is a huge sprawling DIP design on a board I'm guessing is 250x160 mm, I'm thinking of all-SMT on a board not much bigger than the actual 2 x 16 display - maybe 100 x 40 mm for everything.The 74LVC161 is supposed to be good for 150 MHz (maybe even 200 MHz) and provides a /16 prescaler. My existing design - inspired by the original Weeder PIC frequency counter - uses a neat trick to extract the contents of the prescaler inside the PIC with counts well over 50 MHz possible at the PIC input pin. I'm also thinking that I'd have 2 options for the oscillator, one is just the standard 100 ppm Xtal and the other would be a 0.5 ppm TCXO oscillator block - with provision on the PCB to fit one or the other.What do you guys think? I can always add extra stuff on for TTL and GHz inputs; the question is this, is a simpler but reliable 0 - 150 MHz counter something that would be useful?

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: September 10, 2014, 01:26:01 pm
content: Here's a quick picture of the existing design reading a 49 MHz signal. The big LCD is from allelectronics.com, they don't sell it any more but it is available. Mine has no back light.Note that the small white board at the back is the whole thing, PIC + PSU + 74x161 + front end and it's all on a 70 x 40 mm board AND it's DIP/TH technology!

author: dannyf
author_rank: Super Contributor
timestamp: September 10, 2014, 04:00:24 pm
content: I would take it in steps:1) build a module that takes digital signal and goes to a lower frequency threshold (10Mhz if you don't to read prescalers or 100Mhz if you do want to read prescalers). Assuming good signal swing;2) build an AFE / signal conditioner later, add a high frequency divider to extend the frequency range.

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: September 10, 2014, 04:21:15 pm
content: Quote from: dannyf on September 10, 2014, 04:00:24 pmI guess that what I'm saying is that I already did 1, at least in running prototype form. So I'm asking what to do for 2; I think you're suggesting go for 1½ first