I've found some interesting electronic projects which I wanna build, but I'll need a frequency meter for at least 1MHz. Sadly, I don't own one, but I found on the web that an Arduino UNO could do it.
My problem is that AVR's and other microcontrollers like 0V-5V logic levels as inputs, so it would be nice to create an 5V rectangular wave from the input wave.
I found that a simple Schmitt-trigger could do it, but sadly, I could not get one, and I'd like to use a wider voltage range than 5V.

That's what I've got so far(as a plan): An opamp in peak value detector configuration, then use a voltage divider to divide it by 2. (I don't know that I can or can't use a voltage divider with opamp output. If not, use another opamp to divide it by 2) Then another opamp in comparator config, compare the original signal to (peak value)/2. I think that if I feed 5V to the comparator's Vcc, then I should have a nice 5V rectangular wave as output.

Am I right?

  • \$\begingroup\$ Why not just use an op amp that allows input beyond the rails in open-loop configuration? \$\endgroup\$ – Ignacio Vazquez-Abrams Dec 8 '16 at 23:35
  • \$\begingroup\$ I'm new to electronics, so to opamps. Do you mean using it as a comparator? \$\endgroup\$ – Sasszem Dec 8 '16 at 23:54
  • \$\begingroup\$ For example, uA/LM741 is that type? \$\endgroup\$ – Sasszem Dec 8 '16 at 23:57
  • \$\begingroup\$ What is the actual voltage range and waveform shape of the signal you are trying to characterize? You may also be able to use a Schmitt-trigger with some limiting diodes, although this may perturb the signal you are measuring (not sure if that would be an issue). \$\endgroup\$ – uint128_t Dec 9 '16 at 0:17
  • \$\begingroup\$ About 0-12V. 741s have maximum ratings of Vcc=+-22V, and Vin=+-15V. \$\endgroup\$ – Sasszem Dec 9 '16 at 0:46

Providing you want to do this as a learning exercise, then you have absolutely everything you need in the Arduino to build a frequency counter.

The AtMega328 (and in fact most of the other AVR variants that include A/D capability) have an Analog Comparator built in. The comparator has two inputs (+,-), and a propagation delay of about 500 nS so it is usable out to 1 MHz.
The + input can be routed (programmed) to either a 1 V reference or to the AIN0 Analog input pin.
The - input can be routed to AIN1 (or any other) Analog input pin. From the ATMega328 datasheet

enter image description here

The Analog comparator signal can be routed to an Interrupt vector, or to the T/C1 so you can implement a frequency counter with fixed (1 V) or variable (set your own voltage with a divider on AIN0 or AIN1) input threshold.

If you are just starting to learn how to program the Arduino you will need to do lot's of reading to learn to program these advanced features. Its quite a task, but there is lots of reference code and help online. You should start here.
Then perhaps a slow speed frequency counter as an exercise:
The code here is straightforward, outputs results to the serial line and is very easy to follow and modify.

If you look for code on the Arduino site about timing tasks you will find this in contributed code that answers your original question about an invertor/Schmitt trigger frontend and provides a library to use.

  • \$\begingroup\$ Looks like nice. \$\endgroup\$ – Sasszem Dec 9 '16 at 14:32
  • \$\begingroup\$ But I'd like to build a circuit that can be used as simple as possible, and not setting a voltage bias for the signal, that's why I wanna compare it to peak value/2. Also, I don't think that the input can be higher than 5V, so I need a predivider. But it's an interesting idea... \$\endgroup\$ – Sasszem Dec 9 '16 at 14:46
  • \$\begingroup\$ If you set the comparator to something around 150 mV threshold (2 resistors) and put two back to back schottky diodes and a series resistor on the input you have reasonable sensitivity. AC coupling the input get's rid of DC bias. You could use a conventional X1/X10 CRO probe to touch the signal. Capturing the peak requires a high input impedance amplifier followed by a peak detector and is much more complex. \$\endgroup\$ – Jack Creasey Dec 9 '16 at 18:28

I hate to discourage your desire to innovate but take this into consideration:

From a quick web search:

enter image description here

From a quick eBay search:

enter image description here

enter image description here

enter image description here

The choice should be obvious.

  • \$\begingroup\$ I've ordered the Arduino (clone, but really good quality), in a big kit, from china for 7000HUF(ab. 23 euro), and a multimeter with that feature costs about 12000HUF(About 40 euro). I've got some opamps that may do the work for me. Also, I don't think that I'd use it very often, so why spend lots of money on it? Although, I think that I'll definitely buy a better multimeter once, but I'm new to electronics and don't want to spend all my pocket money on a multimeter that I won't use very often? \$\endgroup\$ – Sasszem Dec 9 '16 at 0:47
  • \$\begingroup\$ Oh, I see, ordering from ebay with free shipping... about 4587HUF... \$\endgroup\$ – Sasszem Dec 9 '16 at 0:47
  • \$\begingroup\$ Also, I have some opamps at home, so for one use, I'd like do do it for free. \$\endgroup\$ – Sasszem Dec 9 '16 at 0:57
  • 1
    \$\begingroup\$ When you get into building and testing electronics a digital multi meter will be your most often tool......maybe just after a soldering iron if you hard wire up your circuits. \$\endgroup\$ – Michael Karas Dec 9 '16 at 1:03
  • \$\begingroup\$ I've got a cheaper one, that can do everything except freq and inductance measurement... \$\endgroup\$ – Sasszem Dec 9 '16 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.