Signal Generator or Frequency Counter or Power Meter, Chicken or Egg? - Page 1
Forum section: electronics / projects

author: madshaman
author_rank: Frequent Contributor
timestamp: March 21, 2013, 07:26:52 pm
content: Hi all,As I'm thinking of buffing out my lab a bit and delving deeper into analog electronics with a current interest in the high frequency domain, I decided the best way to move forward would be to start building test equipment instead of buying it.Of the many things I don't yet have, a frequency counter seemed to be a good starting point, however, if I want to give the device a broad frequency range, how would I test it (let's call it the chicken). If I had a good signal generator (call it the egg) that could get up into the double digit Ghz, this wouldn't a problem, so, I should consider building a signal generator, how would I test it for frequencies well beyond the bandwidth of my fastest scope (400Mhz), I know, I could use a frequency counter...Of course, for the frequency generator, I also need to be able to measure its output power, but I don't have an RF power meter either.I'm happy to move in baby steps, and do realise that for both a signal generator and a frequency counter I'm going to have to break the spectrum into chunks and handle the chunks with separate circuitry.Where should I start? Also, is there method I could use to reaching higher and higher frequencies with both a counter and generator kind of pushing each one to higher frequencies and use them to test each other?Finally, how useful is an RF power meter, how difficult to build and calibrate.I'm on my own schedule, so I'm more than happy to learn all the minutia required to be successful, but my goal is definitely clear: frequency counter and signal generator that can both reach 50Ghz one day.Other additionals: would like the option for both devices to be disciplined by a frequency standard (like a Rubidium standard).

author: Thor-Arne
author_rank: Unknown
timestamp: March 21, 2013, 08:21:11 pm
content: Start off with a simple frequency counter and add on prescaler circuits later, and you can design it to have a clock input so you can change the oscillator to a OCXO or Rubidium frequency standard later.The simplest would be i.e. 74HC160 BCD counter -> 74HC4511 BCD-to-7segment decoder-> 7-segment LED display.This means two IC's for each digit, and you add the number of counters/decoders you need.The 74HC160 has a typical max clock frequency of 61 MHz (NXP datasheet) and a prescaler that divides by 10 would bring this up to 610MHz and so on.While not being optimal in many aspects this is a nice way to start off since it's quite easy to understand.And you can use a MCU if you insist, but that leaves you in charge of writing the code for it.

author: hlavac
author_rank: Frequent Contributor
timestamp: March 21, 2013, 08:31:31 pm
content: You could also make a simple frequency divider module to downshift from GHz range down to what your scope can measure....Something likethisperhaps?

author: KJDS
author_rank: Super Contributor
timestamp: March 21, 2013, 08:36:22 pm
content: Power meters are fairly straightforwards providing you don't care about frequency response too much or about too much dynamic range. There are plenty of circuits about using a zero biased detector diode and a very very low offset voltage op amp.For a signal generator, analog devices have some test boards for their frequency synth ICs that can be controlled from a PC. The challenge then is to get a board frequency coverage by mixing a couple of these together with some multiplied up xtal references.

author: PA0PBZ
author_rank: Super Contributor
timestamp: March 21, 2013, 08:54:20 pm
content: +1 for the frequency counter. The advantage is that if it works it is probably ok, if it measures 10MHz ok then there is no reason why it should not be ok at 20, 50 or 100MHz. Prescalers is another thing, but you will only need that by the time you have something to feed it with and then it's the same again, if you get a reasonable output it is probably ok.

author: madshaman
author_rank: Frequent Contributor
timestamp: March 22, 2013, 02:05:17 pm
content: Quote from: Thor-Arne on March 21, 2013, 08:21:11 pmThanks! I will probably go this route for the first counter iteration. I'm assuming there are some advantages to making the actual counter faster before resorting to frequency dividing. I was thinking for later iterations of building a fast binary counter from fast discrete components (e.g. a 30-bit counter) with a corresponding high speed latch that slower digital circuitry could read from. Apart from greater resolution at higher frequencies, what other advantages would this give me? What disadvantages?I probably would add a uC for connectivity and automation.

author: madshaman
author_rank: Frequent Contributor
timestamp: March 22, 2013, 02:17:06 pm
content: Quote from: KJDS on March 21, 2013, 08:36:22 pmI'll start looking into power meter design, for me this will require a bit of research.For the signal generator, I'll take a look on analog's site for these test/eval boards, for how wide a range they cover, etc.I did take a look at digikey's assortment of VCOs, seems I'd need to acquire a few of them to cover up to 1Ghz directly. I'm assuming for higher frequencies I'd need to use a shunted diode or something to intertroduce non-linearity to generate harmonics and filter them with a bandpass filter?Any tips or resources you could recommend for different signal generation approaches?Also, I'm assuming I'll need a duplicate of my counter as part of a control loop to lock the output of the signal generator to the value I want? I'm not entirely sure yet how that would work; need more reading; I do know the counter will only provide feedback at a discrete rate, dropping resolution as the rate is increased. Not exactly sure how to make a control loop under these conditions.It might seem ambitious, but if I'm going to build these devices for myself, I'd like to be able to use them for very precise measurements as if I'd doled out tens of thousands of dollars.

author: Thor-Arne
author_rank: Unknown
timestamp: March 22, 2013, 03:35:16 pm
content: Quote from: madshaman on March 22, 2013, 02:05:17 pmThere's nothing much to gain by struggling making the counter faster, what is important is the timebase accuracy and that it counts accurately.You use counters that counts the frequency directly from the input buffer circuit.When the need for higher frequencies arrive, you just add a prescaler instead of the "direct" buffer circuit. There's many descriptions of these tings on the net.There's absolutely no reason or benefit to adding a micro controller to this kind of design, just use switches, rotary or whatever you prefer.Frequency counters is basically very simple to implement, don't over-complicate your design.All you need to get a basic frequency counter is some 74HC160, some 74HC4511, some 7segment displays, an oscillator, a few gates to make the timing circuit, switches to change gate time/prescaler.

author: zibadun
author_rank: Regular Contributor
timestamp: March 22, 2013, 03:45:12 pm
content: Well you could start with building your own GPS disciplined frequency standard and go from there. QST magazine had an article and schematics for it. Assume the gps satellite already exists and you won't need to launch it yourself.

author: KJDS
author_rank: Super Contributor
timestamp: March 22, 2013, 04:04:13 pm
content: Quote from: madshaman on March 22, 2013, 02:17:06 pmYou need to do some research on phase locked loops. There's no counter involved.

author: jpb
author_rank: Super Contributor
timestamp: March 22, 2013, 05:10:26 pm
content: The experimental project I'm working on (actually barely started) is along similar lines.I'm planning to use the 1pps output from a GPS module I've bought combined with simple counters to give an accurate frequency counter. Then to modify the circuit a bit to discipline my 10MHz ocxo that I recently got, perhaps using Rasberry Pi (I know a microcontroller would be better but I already have a Rasberry Pi).To keep things really simple I've got a lot of BCD counters, some LED display drivers (I know I should multiplex one - but I'm keeping things really simple to start), some latches and a stack of LED display digits. I can make it more sophisticated once Mark I works.I'm really doing it more as an educational exercise so plan to evolve the design.I don't think you need to build a fast 32 bit counter - why not just a fast 4 bit counter as the carry from it will already be down to 1/16th of the original frequency.

author: Thor-Arne
author_rank: Unknown
timestamp: March 22, 2013, 05:20:15 pm
content: The carry out from a 74HC160 is 1/10, and that is what we want. Hard to read hexadecimal values on the counter display.

author: jpb
author_rank: Super Contributor
timestamp: March 22, 2013, 05:22:19 pm
content: Quote from: Thor-Arne on March 22, 2013, 05:20:15 pmYes, that is why I'm using BCD counters it makes life much easier unless you're someone who thinks in hex.I only made the comment re 4 bit counter to contrast it with the proposed 32 bit counter rather than suggesting he use binary over BCD.

author: madshaman
author_rank: Frequent Contributor
timestamp: March 22, 2013, 05:26:05 pm
content: Quote from: Thor-Arne on March 22, 2013, 03:35:16 pmThank-you. I think being able to change the timing period and record counts on a computer is a valid reason for this, and that was my stated reason. I don't think the additional of a uC really adds any difficulty.

author: madshaman
author_rank: Frequent Contributor
timestamp: March 22, 2013, 05:29:12 pm
content: Quote from: Thor-Arne on March 22, 2013, 05:20:15 pmWith great struggle and effort and endless nights and years of research, I think it's possible to drive a decimal display from a binary number. I do understand using less chips, but maybe your preferences when doing a project like this would be different.Thank-you for the input!

author: madshaman
author_rank: Frequent Contributor
timestamp: March 22, 2013, 05:51:26 pm
content: Quote from: KJDS on March 22, 2013, 04:04:13 pmI do understand using a PLL to discipline an oscillator, for which the control loop is straight forward. I am trying to learn here, so here's a question: I've got a rubidium frequency standard box on the way, but it outputs at 10Mhz (I *think* it can be reprogrammed for other frequencies). However, isn't the accuracy of the locked frequency limited by both the accuracy of the reference and the frequency it's outputting?Another question along the same lines, the counter's accuracy itself is of course limited by the accuracy of the time-base, which again leads to to the rubidium reference.Accuracy aside, the precision can still be increased which can still be useful.

author: Thor-Arne
author_rank: Unknown
timestamp: March 22, 2013, 05:55:54 pm
content: jpb: I see, we agree then.madshaman: I don't see any reason to re-invent the wheel, the BCD counter is a binary counter that resets automatically after the 10th count and sets the carry out pin.It's fully possible to do this with a binary counter and some gates, however the ready made BCD counter should be faster since the gates is on the same die as the counter.If you really need to have the control and output available on a PC, just skip the entire counter project and use a microcontroller with counter in software. The input/prescaler is the same in either case.However, there's room for more errors with a software counter.

author: madshaman
author_rank: Frequent Contributor
timestamp: March 22, 2013, 06:00:54 pm
content: Quote from: Thor-Arne on March 22, 2013, 03:35:16 pmThanks! One quick question:If the counter used can count events at say 100Mhz, that means, (given a period of one second per measurement) at most 5 digits of accuracy. Keeping the measurement period the same, a faster counter yields more digits of precision right?If my own personal goal is to develop a counter with the highest accuracy, precision and sample rate, is it still wise to throw out the idea of a faster counter? Another part of my goal is to use this challenge to drive what I'm going to be learning and just to gain more experience. I realise that maybe the project isn't entirely practical, but I could just spend large amounts of money to buy equipment that meets my specs, I might even save money versus my personal time spent, but not much learning there.I'm sure I'm going to learn *something* hooking together a couple off-the-shelf chip and driving an LED from it, but imho, not really that much, especially if it just works.

author: madshaman
author_rank: Frequent Contributor
timestamp: March 22, 2013, 06:07:56 pm
content: Quote from: Thor-Arne on March 22, 2013, 05:55:54 pmI don't agree at all, but I see your point as being valid from a certain point of view. I don't consider driving an LED display from a micro (which will read a binary counter) to be remotely challenging or difficult or even approaching re-inventing the wheel, that's going a bit too far.Why reinvent the wheel and build your own audio amplifier, plenty of companies sell these off the shelf? Why not skip electronics altogether and just buy consumer goods?You might be an EE by trade or simply have different desires, but I'm a hobbyist who wants to try challenging projects to learn.If I had to produce a product design and was getting paid for it, I'd certainly not bother re-inventing anything unless a serious design challenge arose, but I'm trying to use experimentation and hands-on experience to drive learning. It's quite possible I could find a "frequency counter controller with built-in display driver, pre-scalers and serial interface" IC, just buy that and follow the application notes. It's definitely not wrong, it's just not what I want.Does anyone else think it's not a good idea to explore ideas as long as you're well informed as to the advantages and disadvantages? And the well informed part is why I'm here, no offence is meant, but not to be told simply "no, no point in doing that", that's fine as a suggestion, but it's really a more useful suggestion if it's backed with solid reasons: here's the pros, here's the cons, here's why doing it this other way gives an identical result, etc.

author: Thor-Arne
author_rank: Unknown
timestamp: March 22, 2013, 06:32:13 pm
content: Quote from: madshaman on March 22, 2013, 06:00:54 pmA faster counter will increase the upper limit of the frequency that can be measured.If the chip can handle 100MHz the first one is counting 100M pulses and the second one is counting 10M pulses and so on.More accuracy is achieved by increasing the timebase precision, and using a longer gate time will "catch" a few more counts.Quote from: madshaman on March 22, 2013, 06:00:54 pmI'm all for learning, and a frequency counter is a great project for this.With a little careful planning one can achieve a counter that is really a accurate and useful.My suggestion about the logic to use is a very easy way to achieve this.However, there are simpler (less logic) solutions, but with this you doesn't introduce any "black-box" logic and everything can be probed and analyzed.

author: madshaman
author_rank: Frequent Contributor
timestamp: March 22, 2013, 06:46:01 pm
content: Quote from: Thor-Arne on March 22, 2013, 06:32:13 pmThanks for the reply!I definitely see where you're coming from. For me digital circuits (at least at lower speeds) are relatively easy for me and I am a visual guy who likes to be able to shunt data into one central place where I can deal with it using my primary skill-set.That aside, I was kind of looking forward to trying to design some super-high-speed logic from scratch. I don't even know if you can easily build a bi-stable circuit, gates and other logic from HFETs (whose existence I only recently discovered). I also have no experience dealing with very high frequency signals and all the extra minutia required to make it work, the common problems encountered and how to overcome them, how to instrument your device at these speeds, etc.This is the stuff I want to dig into and get good at, and honestly, I'm still a babe in the woods in this domain. I will admit that building very high speed logic by hand really interests me and has since I started pricing off-the-shelf very high speed ADCs and similar components (I've seen $500+ for a single IC), I don't even know how possible it is; I'm imagining physical fabrication will play a big role (half expecting at some point in needing a CNC micro-mill to move forwards in the future). Right now though, I'm just at the stage of figuring out *what* I need to learn, and *what* can be learned :-).Other member responses to my question have already pointed me to reference material that's going to fill me up for weeks if not months, but this stuff is so interesting to me it's well worth it. When I was younger, the library was the only place you could go to learn new things unless you had a mentor.

author: jpb
author_rank: Super Contributor
timestamp: March 22, 2013, 07:01:38 pm
content: I was thinking of using ECL for the fast end of the counter, but as a future expansion. The problem is completely different biasing required so it would be best as a separate board. Also perhaps PECL rather than NECL would be easier to interface to.According to the latest addition of Electronics for Inventors "ECL is obsolete". Is this the case? Quite a few ECL ics are still sold and I'm not sure what has made it obsolete - especially in its SiGe form.One of the reasons I've been looking at ECL is I'm thinking of getting a WW5061 (at reduced cost) and this provides its clock out in ECL form. Perhaps I should start a new thread on this.

author: Thor-Arne
author_rank: Unknown
timestamp: March 22, 2013, 07:07:13 pm
content: Quote from: madshaman on March 22, 2013, 06:07:56 pmBy all means, this is a doable solution. And it's not difficult at all, perhaps laying out the board can be a challenge but that's another topic.Quote from: madshaman on March 22, 2013, 06:07:56 pmThis is not what I mean at all, my point is to use a optimal approach to not introduce any flaws to the design.Oh, I'm not an EE but I've been doing electronics for many-many years.Quote from: madshaman on March 22, 2013, 06:07:56 pmWe agree on this, not much to learn from "black-box" logic.Quote from: madshaman on March 22, 2013, 06:07:56 pmWell, I suppose I was a bit harsh about that. Sorry about that, didn't mean to offend you in any way.I meant that the is no benefit for the actual frequency counter to add a microcontroller, it only adds complexity and if used incorrectly degrades the performance of the frequency counter.People adds microcontrollers to anything these days, so its to easy to be defensive about adding one. Again, sorry.Anyway, it's perfectly okay if you need a advanced user interface or need to dump data to a PC.IMO, it is a bit overkill with a microcontroller for a frequency counter. And there is designs for this things with the counters implemented in software, these has a lot less logic and is easy to build. The main problem with this is that it's performance is directly depended on the performance of the microcontroller and the software.

author: Thor-Arne
author_rank: Unknown
timestamp: March 22, 2013, 07:22:14 pm
content: Quote from: madshaman on March 22, 2013, 06:46:01 pmDigital circuits is nice to work with, but getting into the higher frequencies (above "standard" logic familys) is something I'm not familiar with. It's probably not to difficult to design gates with HFET technology, at least on paper. With those frequencies a lot of factors start to influence the design, I'm not a expert but board capacitance and trace inductance springs to mind.A CNC mill is absolutely a nice thing to have, but I think you'd be better off making pcb's with the traditional photo-/etching-process. There's some threads about that in the forum to.This place is a great source for information, and there's quite a fewreallyskilled users here.

author: hlavac
author_rank: Frequent Contributor
timestamp: March 23, 2013, 10:08:23 pm
content: I don't agree a microcontroller is an overkill here.I can imagine a few things micro with a LCD would be useful for:Automatic selection of appropriate prescaler inputMore possible digits on a LCD, smaller boxYou can measure fluctuations in frequency and display only appropriate number of digits and error size (like 1.234MHz +- 350kHz or +- 5%)The longer the measurement, the better precision (more digits). If the frequency is really stable you can get extra digits. With micro you can show extra digits when you get themAs for making the counter faster not important, I disagree with that too.Speed of your counter is directly relevant for speed of your measurementand precision. You want to prescale to the fastest frequency you can count to get precision digits faster.

author: Thor-Arne
author_rank: Unknown
timestamp: March 23, 2013, 11:09:45 pm
content: IMO this is a completely different design concept, I was originally suggesting using 74HC160 and 74HC4511 to make a simple and reliable counter.If you are going to do all that with a microcontroller then you would be better off using a microcontroller to do the actual counting rater than reading the data from the counter IC's.A design based on a pure microcontroller design will be smaller, I doesn't agree that this necessarily give you any more digits as there's a digit for each decade of counting regardless of the method of counting.As I see it, for increasing the speed of the counter to matter with the precision you'd have to increase the speed enough to get another decade of counting for it to be beneficial regarding the acuracy.The 74HC160 is rated to max 61MHz and you need to get up to 100MHz to get another digit.This should be possible to do by implementing your own counter, but I haven't looked into that as I'd be more than happy with prescaling for the 61MHz I can get from the 74HC160.

author: hlavac
author_rank: Frequent Contributor
timestamp: March 24, 2013, 01:14:27 pm
content: Quote from: Thor-Arne on March 23, 2013, 11:09:45 pmI can keep counting across consecutive measurements and get an extra digit after 10 of them. After 100 I will have two extra digits. I can do fractions with microcontroller.But I dont need to wait for them to display something.Also I dont have to count base 10 - base 2 will give me more granularity in prescaling which means I can stay closer to the max frequency i can count thus be faster overall.

author: Thor-Arne
author_rank: Unknown
timestamp: March 24, 2013, 03:07:03 pm
content: I don't have any issues with this, all that's possible.However, this is the pure microcontroller design, not the traditional counter logic with a micro controller added to the logic chips.

author: madshaman
author_rank: Frequent Contributor
timestamp: March 24, 2013, 10:14:48 pm
content: Thanks everyone for some great input.wrt: using the uC itself to do the counting, I'll probably avoid, the suggested IC for the first prototype can count way faster than I could count with a 20Mhz uC which is what I'll likely use.I'm putting together a new digikey order so I think I am going to take a crack at building some digital logic from HFETs, starting with low frequencies for testing. Will post some results whether I succeed or fail; will probably be weeks for this.

author: C
author_rank: Super Contributor
timestamp: March 25, 2013, 12:50:40 am
content: On the forum some place, someone mentioned a pre-scaler ic that went in to the GHz range As a pre-scaler the counter will not really know the pre-scaler exists, it's up to you or the circuit to compensate. If the pre-scaler is a /10 then you or the circuit moves the decimal point one place. You could design a counter with the following chain, pre-scaler, gate, counters, counter overflow to micro. If the micro can read the counters and catch the overflow from them hlavac's options could happen. With a micro lots of tricks are possible to make it better

author: madshaman
author_rank: Frequent Contributor
timestamp: March 25, 2013, 04:25:16 pm
content: Thanks!Already started pouring over digikey and the fun process of reading datasheets for various counter and divider ICs.Now starting to think of the design for the time base. My first idea is to assume a 10Mhz reference clock (which I'll soon have), then use two divide-by-n ICs in series programmed by a micro to select an arbitrary timebase. Does that sound reasonable? Is dividing a reference like this a reasonable or common way to do this or is there a better method?

author: C
author_rank: Super Contributor
timestamp: March 25, 2013, 06:15:36 pm
content: simple countergate opens, counter counts input, gate closes, display count, reset counter , repeatFor the simple counter time the gate is open is the key. Gate based on your 10Mhz reference clock best you can do. For us humans the open gate times should be in powers of 10 and very repeatable & accurate. Closed gate time could be small, just time needed to display and reset counter. Old counters used a 1 of ___ to select the decade gate signal. If you use software to set/select the gate, once set it should just work on it's own.Frequency counter = count the signal , reference controls gate.Period counter = count the reference, signal controls gateFor hlavac's method,one way to say it is, counter always counts the signal or reference and is never reset. The gate change takes a snapshot of the counter value. macro computes count between snapshots.C

author: KJDS
author_rank: Super Contributor
timestamp: March 25, 2013, 06:22:21 pm
content: Hititte do a good range of prescalers when you want to up the frequencyhttp://www.hittite.com/products/index.html/category/259

author: madshaman
author_rank: Frequent Contributor
timestamp: March 26, 2013, 03:48:32 am
content: Quote from: KJDS on March 25, 2013, 06:22:21 pmThanks! Nice site, some of the stuff is available on digikey (like $500 10ps logic gates (woah)) some isn't. Know any other sites sellng this kind of high speed stuff? This is all new to me, but half the battle is knowing what exists.

author: gerrysweeney
author_rank: Regular Contributor
timestamp: March 27, 2013, 10:33:43 am
content: I would take a different approach, I would suggest that from a construction point of view a simple micro controller to drive an LED display would make life much easier. As for the counter part, an external TTL counter, use a high speed 4-bit one, and use the carry-out to drive a timer input of the micro controller. You ideally want a fast gate time, not 1s and 10s which you find in older counters. If you can detect the lower frequency range, your bit '0' counter output will be half the input frequency so at low frequency you can very accurately measure the time it takes (the width of) for a single complete cycle. Even measuring 50Hz and oversampling 3-5 times you can get resolution of three decimal places and a gate time of 100ms. At higher frequencies you count the pulses as usual, you will get enough samples to get good resolution.One thing that is missing from the suggestions though is the front end. One of the more difficult thing to get right in a frequency counter is the front end amp, you need something that has variable gain (which generally sets the trigger level), is linear across a broad range and does not resonate or alias the signal being measured.A simple micro controller (PIC or Atmel) and an external high speed counter chip will give you a decent auto ranging frequency counter. Add a decent temperature stable clock source for the timer clock and a pre-scaler chip (of which there are many) and you have a pretty decent counter that would not be any bigger than a cigarette packet.