Pages: 1 2 3 [4]   Go Down
Author Topic: Frequency Counter Library  (Read 38214 times)
0 Members and 2 Guests are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I use the frequency library on both Mega ADK ( modified library)  and Nano board.
When i measure a precise 1.000.000 Hz signal I get 1.000.169 on the display.
I try to correct this with f_comp but it seems that i can only increase the displayed reading.
How can I decrease the reading to 1.000.000 ??

Thanks for a nice frequency library. Very usefull.
Logged

Venezuela
Offline Offline
God Member
*****
Karma: 16
Posts: 515
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello dc42.

I just tested your improved version of a frequency counter sketch (Reply#35).
http://forum.arduino.cc/index.php?PHPSESSID=25artcic6a44jl71kf4a1kevo7&topic=64219.30 .
It works great!. Is is possible to modify it to read frequencies between 1Hz to 3Hz. So far, I can measure with your code frequencies over 2.99Hz.

Thank you.
Palliser
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can I detect a guitare sound frequency with it?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can anyone help me?

I have a bipolar signal from 40mVp to 4Vp (it has 2Kohm impedance too as it comes from an inductance). I want to measure his frecuency. I tried all configurations possible withouth succesful.

My first approach was plug into V+ and V- in an operational with open loop (so i have an square output and a single edge detector with a timer will measure). The output is not consistent due to the small voltage of the signal i guess.

I tried a transistor with the signal attached to the base and collector so it enables. It does not work either. The solution with the biestable is not possible due to the small Voltage of the signal when low frecuencies.


Thanks in advance.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I'm trying to measure frequency, and display always return on decimal place less. It should show 26640, but show only 2664. I also tryed to increase/decrease frequency, but same error occur.

I'm using FreqCounter library.  

This is the code:

Code:
#include <FreqCounter.h>


unsigned long frq;
int cnt;
int pinLed=13;

void setup() {
  pinMode(pinLed, OUTPUT);

  Serial.begin(115200);        // connect to the serial port

  Serial.println("Frequency Counter");
}


void loop() {

  // wait if any serial is going on
  FreqCounter::f_comp=10;   // Cal Value / Calibrate with professional Freq Counter
  FreqCounter::start(100);  // 100 ms Gate Time

  while (FreqCounter::f_ready == 0)

  frq=FreqCounter::f_freq;
  Serial.print(cnt++);
  Serial.print("  Freq: ");
  Serial.println(frq);
  delay(20);
  digitalWrite(pinLed,!digitalRead(pinLed));  // blink Led

}

Please help !

BR !

Mladen


* Screenshot 2014-06-07 01.31.46.png (244.05 KB, 1920x1080 - viewed 52 times.)
« Last Edit: June 06, 2014, 06:40:58 pm by Mladen Bruck » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


while (FreqCounter::f_ready == 0)

is this really what you meant  ?
or is the  ;   missing

while (FreqCounter::f_ready == 0) ;

the difference is effectively a different loop

while (FreqCounter::f_ready == 0)
{
   frq=FreqCounter::f_freq;
}

or

while (FreqCounter::f_ready == 0)  {}
frq=FreqCounter::f_freq;
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm...

I didn't notice missing ; since compiled without error.  But I have found yet another post with similar problem. I'll try your both proposal.   Thank you.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is a workoround for use with servo library?

I have not yet tried this code yet, so if it doesn't work I am sorry!  When I thought of a workaround, I was thinking external.  I found the liked below chip on adafruit that takes an I2C signal and can create PWM without using the AtMel's PWM.  As long as the communications clock is not disabled or messed up, something like this might work for you. 

http://www.adafruit.com/product/815
Logged

Pages: 1 2 3 [4]   Go Up
Jump to: