Saturday 29 October 2016

BASIC Tech Group - MyNews 2 - Freq Meter

This project has been abandoned as the accuracy is too low

Natively the Arduino UNO can use its timers to count up to around 6MHz. This can be extended up to a more useful 60MHz by using a divide by ten pre-scaler, for example the CD74HC4017 chip.

Here's the schematic for a FREQ_BASIC shield, it uses a 2 line by 16 column I2C Serial LCD display:

Screen Shot 2016 10 29 at 18 07 27

Code

// FREQ-Basic, v2, Input Pin 5

#include 
#include 
#include 

// this LCD has an address of 3F, some others use 27. 16 columns, 2 rows
#define LCDADDR 0x3F
#define LCDCOLS 16
#define LCDROWS 2

// lcd object
LiquidCrystal_I2C lcd(LCDADDR, LCDCOLS, LCDROWS);

// count result, and Arduino crystal correction
unsigned long count;
float freq;
float corr = 0.99852;

void setup() {
  lcd.init();
  lcd.backlight();
  lcd.clear();

  FreqCount.begin(1000);
}

void loop() {
  if (FreqCount.available()) {
    count = FreqCount.read();
    
    lcd.setCursor(3, 0);
    lcd.print("Frequency");
    freq = (float)count * corr / 100000; //
    lcd.setCursor(3, 1);
    lcd.print(freq, 3);
    lcd.print("MHz     ");
  }
}

On test with Arduino Si5351 DDS VFO on the left

IMG 0391

Accuracy is better than +/-500Hz, so not so good for accurate readings or frequency calibration, But OK for a general purpose indicator.

1 comment:

ЕвгенийЛ said...

Привет!Хотел пвтоить прибор-а код не полный.Что было в include ?