Building a frequency counter, mysterious opamp output shift - Page 1
Forum section: electronics / beginners

author: hp3310a
author_rank: Regular Contributor
timestamp: November 24, 2024, 09:01:00 am
content: Hello,I'm new here and new to building circuits myself, though I'm not new to electronics as a whole but have been more into power electronics for electrical motors and such. Plus that was 30 years ago and my professional life took me somewhere completely different.So much for the introduction so you know better what you can expect. Not a lot...I'm building a frequency counter and while it took me some time to get there, I got surprisingly far. The counter is based on a 74LV8154 2x16Bit counter, the control and display part is done by an Arduino using an 8 digit 7-Segment display. The time base of the Arduino is useless, so I'm using a DS32KHZ with a second counter to get an accurate 1Hz frequency normal. The whole thing actually works!Now I wanted to change the input opamp from an AD8034 (data sheet herehttps://www.analog.com/media/en/technical-documentation/data-sheets/AD8033_8034.pdf) to an AD8062 (data sheet herehttps://www.analog.com/media/en/technical-documentation/data-sheets/AD8061_8062_8063.pdf) because it's cheaper, easier to get my hands on and faster too. But that change doesn't want to work as I planned.The opamp supply is +-5V, the input signal into the opamp is at most 1Vpp, so in theory that should work for both opamp variants.Here is part of the schematic concerning the signal input part (I hope the pictures work, they don't show up in the preview):The signal goes via a voltage divider (2M : 100k) into the opamp as voltage follower. From there into a comparator so I get a signal that I can use for the 74LV8154 counter that follows it.I suspect this problem might have to do with the TC7660/ICL7660 -5V converter (data sheet herehttps://ww1.microchip.com/downloads/en/devicedoc/21465c.pdf) that I use, which I need as a negative supply for the opamp. The replacement AD8062 opamp draws more current than the original AD8034 and as a result the negative input is even farther away from the ideal -5V at only -3V. The voltage different increases with load, all documented in the data sheet but I hoped I can get away with the drop.Next follow images from probing the opamp output along with the signal. First with the AD8034, first is at 52kHz then 5MHz input. While there may be problems, the output (blue) is symmetrical.Switching the opamp to AD8062, the output is offset, so almost nothing is negative and that destroys the whole idea with the following comparator.I'm sure I'm making tons of rookie mistakes, there are much better ways to do it and the breadboard setup is far from ideal. What would interest me most is why the two opamps behave so differently and what my error in assuming this would work is.Thanks for any pointers.

author: jonpaul
author_rank: Super Contributor
timestamp: November 24, 2024, 09:28:58 am
content: dont use opamps in a counter, needs buffer/comparator on frt end.Schematics please?j

author: hp3310a
author_rank: Regular Contributor
timestamp: November 24, 2024, 09:39:13 am
content: Not sure why you need to see the whole thing (the relevant portion is already in the post), but here you go.

author: Ian.M
author_rank: Super Contributor
timestamp: November 24, 2024, 09:59:36 am
content: You can be certain your 20:1 input attenuator is no good at 5MHz. 3pF of stray capacitance on the OPAMP input will have a reactance of approx 10K shunting your 100K lower resistor!

author: PGPG
author_rank: Frequent Contributor
timestamp: November 24, 2024, 12:56:08 pm
content: In 1985 just to have frequency counter I have build it based on TTL ICs (oscilloscope I already had as I build it in 1982). My biggest problem was to reach 100MHz at input while typical TTLs don't work to such high frequency. I used separate input (build from transistors) for frequencies above 10MHz and 1/10 frequency divider working up to 100MHz (don't remember its symbol now, but probably somewhere I have its schematic).Quote from: hp3310a on November 24, 2024, 09:01:00 amI have looked into their datasheets (I have never read them before and not try to go very deep into them).First what I noticed - only first of them is called OpAmp in datasheet. Second - only Amp.My conclusion - in theory AD8062 should not work. Its supply is max 8V (not ±, but total). They normally assume working it with only positive supply. At the end of datasheet there is example with differential supply, but only ±4V (so total 8V).Its input bias current is up to 9uA (compared to 11pA of AD8034) what with your 100k input polarizing resistor gives 0.9V input voltage shift (I don't know if in + or - direction).All examples in AD8062 datasheet uses rather small resistors at input (50Ω can be assumed a standard as it is typical impedance of shielded cables used in high frequency measurement).You should decide - you want to have high input impedance and low max input frequency or low input impedance and high frequency (or two separate inputs). You try to use IC for high frequency while input will not pass them.Now something you didn't asked but I think you will like to know.As you have computation possibilities I didn't had you can build much better frequency counter than I have build.Assume you have 10-6frequency reference accuracy (you probably don't, but let us think a moment that you have).Now you count input frequency during 1s. If measured frequency is 1MHz you can display it as 1 000 000 so you display it with 10-6accuracy - everything is OK.But if measured frequency is 1kHz you display it as 1 000 so with 10-3accuracy. So even you have 10-6reference you get much less accurate result.You can count it during 10s increasing accuracy to 10-4but it is still far from you can reach.Modern counters work in other way. I have never build something like that so my description can be not fully accurate but probably is. During let us say 1s frequency counter finds the whole measured frequency periods that are within this time and counts them. At the same time it counts how many pulses of its 10MHz reference generator falls within this counted number of whole periods of the measured signal. Now having these two numbers you can display 1kHz as not 1 000 but 1 000.000 so with accuracy as your reference source.Those my frequency counter had much worse reference (about 20 * 10-6) but few years earlier (1980) I was building chronocomparator (device to measure watch accuracy) and to reach 1ppm (=10-6) I have build 1MHz thermostated generator (the styrofoam generator casing was approximately 12x8x4cm).

author: hp3310a
author_rank: Regular Contributor
timestamp: November 24, 2024, 05:05:01 pm
content: First of all, thanks for taking the time to look at this and the detailed response. I'm a beginner and have no idea about most things, so I appreciate the extra hand holding.Quote from: PGPG on November 24, 2024, 12:56:08 pmOMG, you are right! I just assumed it was an opamp because of the similar numbering and identical symbol and footprint. No wonder this doesn't work at all. What a mistake.Thanks also for the additional information about the better counting strategy. I'm aware mine is probably the simplest there is and hopelessly flawed. Maybe there will be a v2 that is more sophisticated, who knows.As far as input handling goes, I know I could do better, but I don't know how.Thanks again!

author: jonpaul
author_rank: Super Contributor
timestamp: November 24, 2024, 05:41:12 pm
content: Suggest a 50 Ohm Zo input for wideband, not 1M.We used a FET buffer and Motorola MECL ECL in 1972, worked fine in 120 MHz FM LO counter for Sequerra hifi tuner.Jon