building a telecom Transmission Impairment Measuring Set (TIMS) with arduino nano II

arduino nano frequency counter
arduino nano frequency counter

I have considered several design possibilities for myTIMS project.  I was going to use the TimerFreeTone library because of the timer conflict between tone() and the FreqCount library, and have the user type in the desired frequency using a keypad.  I do not have enough GPIO on my nano for this as I need 6 pins for my LCD and seven for my 4-column 3-row keypad.  (I know I could get an i2c display, but I’m using what I have laying around!)

Anyway, the two nano approach is acutally looking better.  I am using one nano to generate the desired frequency when the TIMS is in transmit / generate mode.  I am using a 10-K potentiometer to tune to the desired frequency and basically copied and pasted the tonePitchFollower example sketch with a few modifications.  The other nano does the frequency counting and drives the LCD.  As you can see above, the nano frequency counter is only off by 1 Hz from a professional TIMS.

Here is the frequency counter sketch ->

     
     1	#include \<FreqCount.h\>
     2	#include \<LiquidCrystal.h\>
       
     3	const int rs = 12, en = 11, d4 = 10, d5 = 4, d6 = 3, d7 = 2;
     4	LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
       
       
     5	void setup() {
     6	  lcd.begin(16, 2);
     7	  lcd.print("Freq:");
     8	  FreqCount.begin(1000);
     9	}
       
    10	void loop() {
    11	  if (FreqCount.available()) {
    12	    unsigned long count = FreqCount.read();
    13	    lcd.setCursor(0, 1);
    14	    lcd.print(count);
    15	    lcd.print(" Hz       ");
    16	  }
    17	}
       

Leave a Reply

Your email address will not be published. Required fields are marked *