Design a system for measuring the frequency of square wave signals above 100 kHz using an Arduino UNO. Achieve maximum range for measuring frequency.
Note: You can use any approach or method which can generate frequencies between 100 kHz to 8 MHz (e.g., Function Generator, etc)
For example:
Generating frequency > 100 kHz using Arduino UNO
We have used another Arduino UNO along with a potentiometer to generate frequencies between 100 kHz and 8 MHz where a potentiometer is used to vary the frequency.
The corresponding code for generating these frequencies is provided below.
CODE
#define pot A0
void setup() {
cli();
TCCR1A = (1 << COM1A0); // Toggle OC1A on compare match
TCCR1B = (1 << WGM12) | (1 << CS10); // CTC mode, prescaler = 1
OCR1A = 0;
// Corrected DDRB Configuration
DDRB |= (1 << PB1); //D9 (PB1) as outputs
sei(); // Enable interrupts
}
void loop()
{
uint16_t potValue = analogRead(pot);
//map pot value to genetate frequency >100KHz
OCR1A = map(potValue, 0, 1024, 0, 80);
}