Frequency

Hi everyone,
I am doing one project with freqcont (FreqCount Library, for Measuring Frequencies in the 1 kHz to 5 MHz Range) with arduino UNO. I have problem with measuring frequency when is voltage (amplitude) lower than 4.5V. May you help me with programming or some ideas what I should do? How could I rewrite or change it ? Is it possible to measure frequency with 2.5 V for example?
Thank you.

Are you supplying an AC signal to the Arduino? If so, you could destroy it. You have to bias it, or rectify it first.

The input pins of the Arduino UNO are guaranteed to read high for voltages above 0.6 Vcc, so above 3V. (See §28.2 in the datasheet.)

Pieter

An Atmega320P running at 5V will have a Vih (the voltage (V) at which an input (i) will be recognized as high 'h') of 0.6xVcc or 3.0V

Without some sort of level translation I don't think you'll be able to count a 2.5V frequency input on this 5V micro.

OK, so you are using the signal conditioning circuit shown in that article, aren’t you?

If not, come back when you have made a serious attempt at the problem! :astonished:

I built this schematic (Colpitts osc.) for coin counter. Nnormal frequency is 210kHz (Ucc=12V, and amplitude is 5V) and when is coin detected (coin near to coil) frequency is changed for example on 234kHz but there is a problem that amplitude of signal decreases on 2.35V for example. So I can measure normal freq. 210kHz with Arduino UNO (its working really good) however when there is a coin I have serious problem with voltage of signal.


So should I use another circuit or is there any possibility to solve it ? I am 17 y.o. student and I have no much experiences so I need help with this.
Thank you.

You could use three inverters of an 74HC04 as amplifier, works great for me (some articles that I've read say you should use an unbuffered version - 74H04 or 74HCU04 - expecting to receive those yesterday so I can see if there's any difference).
I'm actually using a Clapp oscillator, 800-900 kHz, typical output ~2.5V which is then nicely amplified to 5V. A fast comparator should also be able to do the job.

So I repeat - are you using the signal conditioning circuit shown in that article between your oscillator and the Arduino?

(By the way, it needs a 22k resistor in series with the input in order not to load the oscillator.)

I am going to try this. Thanks. And about that 22k resistor, where should I use it ?

Between the oscillator circuit and the 0.1 µF input capacitor of the signal conditioning circuit.

Otherwise the signal conditioning circuit will tend to overload the oscillator.

wvmarle's suggestion is also excellent (better in fact) for a signal conditioning circuit but he didn't give a diagram.

As described in this article.

I’m using three inverters in series with 100k feedback for cleaner signal.

I have extreme suspicions about the assertion in the article referenced, that a 74HC04 with feedback over a single gate, would oscillate. Mike would probably know. a 74HC14 definitely oscillates with feedback and presumably needs no shunt capacitance on the input to do so.

If a 74HC04 is buffered internally, that means it already is three inverters in series - and a single gate has plenty of gain to function as an amplifier. If it oscillates, it is most likely due to being mounted on a breadboard with jumper wires whose inductance resonates at a couple of hundred MHz, but with a proper ceramic 0.1 µF capacitor mounted directly between ground and Vcc and proper layout of ground connections (preferably on a PCB) it should not oscillate unless configured to do so.

(Note that the other five gates must have their inputs terminated in some manner.)

In my project I have the 74HC04 soldered on perfboard with short wires.

Most of the time it works fine (I get the expected block wave) but one time it did not - I saw a weird waveform on my scope. I strongly suspect oscillations in the IC, three inverters in series, but as my scope maxes out at 10 MHz or so I can't be sure of what happened.

After trying for half an hour I gave up; tried a few hours later and it was back to normal. I don't know what was different that time, I haven't seen it since and haven't been able to trigger that behaviour. It was weird, for sure.

I have tried a single inverter vs. a series of three, and there's a clear difference in waveform. Input about 2.4V peak/peak; output nearly 4.5V peak/peak after one, 4.85V peak/peak and cleaner looking block wave after three. In this project I don't need any other inverters so can just as well use half the chip instead of just 1/6th.

Paul__B:
Between the oscillator circuit and the 0.1 µF input capacitor of the signal conditioning circuit.

Otherwise the signal conditioning circuit will tend to overload the oscillator.

wvmarle's suggestion is also excellent (better in fact) for a signal conditioning circuit but he didn't give a diagram.

I used this 74HC14N and it does not work. I used generator sinus wave 220kHz as input and osciloskope at output and nothing happened.

Ludwig118:
I used this 74HC14N and it does not work. I used generator sinus wave 220kHz as input and osciloskope at output and nothing happened.

I fear that from this description we really have no idea what you did. "used this 74HC14N" tells nothing. You might just as well have used it to brush your teeth! :grinning:

It has Schmitt trigger inputs, in contrast to the 74HC04 which does not. That's probably the reason it doesn't work for you.

I've also had good results with the 74HC00 (a NAND gate, also no Schmitt triggers on the input) following this article. I had it resonate quite stable at 6 MHz.