I needed a frequency counter with serial output so an Arduino can count and process, then I realized that the Arduino can be used directly for counting in the range 0 to 8Mhz.
Code and lib is from this reference: http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-frequency-counter-library/
Here's the diagram:
The oscillator part (on the left) was just for testing if was working, if standalone input is "F_in" on diagram.
The serial out from the Arduino looks like this:
The input signal on D5 of the "Nano":
...and as curiosity the signal on the oscillator:
...not the most beautiful but enough for testing.
Code is this one:
// ----------------
#include
// counter code from here: http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-frequency-counter-library/
unsigned long frq;
void setup() {
Serial.begin(9600); // connect to the serial port
Serial.println("Starting");
}
void loop() {
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(" F: ");
Serial.println(frq);
delay(20);
}
//-----------------
Things changed, don't need this part/project any more, in any case it stays for future reference.
Have a nice week!
Code and lib is from this reference: http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-frequency-counter-library/
Here's the diagram:
The oscillator part (on the left) was just for testing if was working, if standalone input is "F_in" on diagram.
The serial out from the Arduino looks like this:
The input signal on D5 of the "Nano":
...and as curiosity the signal on the oscillator:
...not the most beautiful but enough for testing.
Code is this one:
// ----------------
#include
// counter code from here: http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-frequency-counter-library/
unsigned long frq;
void setup() {
Serial.begin(9600); // connect to the serial port
Serial.println("Starting");
}
void loop() {
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(" F: ");
Serial.println(frq);
delay(20);
}
//-----------------
Things changed, don't need this part/project any more, in any case it stays for future reference.
Have a nice week!
No comments:
Post a Comment