0
\$\begingroup\$

I have a wave I want to feed into an Arduino to measure frequency.

I need the wave to hit zero to measure the frequency, I think. A nice clean square wave ideally.

I am using a simple 4.3V Zener voltage limiting circuit to cap the wave to 5V but need it to hit zero also.

I'm not worried so much about amplitude, just frequency. The frequency range is from 0-8000Hz. Can anyone suggest a way to do this?

The wave form looks like this:

![enter image description here

0V is at the base of the plot, maximum voltage on this snapshot is 4.73V.

\$\endgroup\$
6
  • 7
    \$\begingroup\$ ... please use your windows screenshot function. That's way more useful than a foto of your screen with a flash reflection. Even better, I bet your oscilloscope software has an "save as bitmap" "export image" or similar functionality! Make it easy for us to help you, please :) \$\endgroup\$ Mar 28, 2022 at 15:26
  • 2
    \$\begingroup\$ Research Schmitt Trigger. \$\endgroup\$
    – rdtsc
    Mar 28, 2022 at 15:59
  • \$\begingroup\$ What is the scale of the image, and where is the zero line? \$\endgroup\$
    – AnalogKid
    Mar 28, 2022 at 16:12
  • \$\begingroup\$ Please post the relevant schematic \$\endgroup\$
    – Aaron
    Mar 28, 2022 at 17:33
  • \$\begingroup\$ You can use a comparator or op amp but you need some head room unless you use +- supplies. What voltage do you define as zero. You state it must be zero then later you say just frequency. If it is a few volts logic gates will work, if just a few millivolts the op-amp or comparator will be needed. \$\endgroup\$
    – Gil
    Mar 28, 2022 at 18:20

1 Answer 1

0
\$\begingroup\$

If your Arduino can handle 5 V, use a 4.7V zener. It is not critical to each the 5.00 V rail precisely.

Similarly for 0, the zener may clamp at -0.7 V. This is potentially risky for the Arduino. You can mitigate with a Schottky diode in parallel with the zener (so will clamp at ~ -0.3V), or just put a 10 kΩ between the zener original output and the Arduino -- this will limit the injected current to negligible levels.

In your software, you might want to debounce the signal before measuring frequency -- basically, when an edge is detected, 'blank' subsequent edges for a short time (say 1/20 the maximum frequency) in case there are multiple transitions.

\$\endgroup\$
1
  • \$\begingroup\$ I am using 4.3v zener but my problem is that the wave does not drop to 0v to sensibly trigger the FALSE logic. I have tested with a square wave generator and code/system works fine. Have also tried using an analog input but the Arduino seems too slow to read the changes. I'm planning on trying a 74HC14N schmitt trigger as suggested. \$\endgroup\$
    – crazyquiff
    Mar 30, 2022 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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