I'm not new to electronics, but I am fairly new to Arduino and very new to Teensy.
For my first real project, I'm working on this in stages. The plan is start with a frequency counter with a GPS module as a reference/calibration standard, then that controls a DDS like the AD8951. The Teensy will check the output of the DDS and correct it as needed.
I see the Teensy 3.0/1/2 uses a 16MHz crystal. I think I could replace that with a TCXO with +-2.5ppm temp and +-1.5ppm initial accuracy.
But what does the Teensy 3.6 have on it? I see the clock is no longer a multiple of 16.
I may also borrow an idea from another thread here, and stick a Dallas 18B20 on board, but I'm worried about the complexity of changing the crystal register.
Please forgive my ignorance.
I've got a Teensy 3.0 on a little display. I reprogrammed a NEO-6 to output 10MHz. It is currently locked to satellites. The readout on the Teensy 3.0 toggles between 9,999,990 and 9,999,991 Hz. When I change the measurement time to 10S, the display is pretty solidly on 9,999,990 Hz. -1ppm, well within specs for the on-board crystal, but a TCXO would be much closer.
Back to 1 second period: I warmed the crystal on the Teensy 3.0 for about 30 seconds with my fingertip, and the frequency is now toggles between 9,999,992 and ,999,993 Hz, going down as it cools back to room temperature. After being on for an hour, it is now wandering around 4 or 5 for the last digit.
Set to 10 second capture time, the last digits are 5.2 for several minutes, then slowly drifting upwards. It is now on 6.x for the last digit and still drifting upwards.
Clearly this drifts enough with temperature that simply correcting it one time won't get me much. A TCXO on board would be much better.
So what crystal is the Teensy 3.6 using?
For my first real project, I'm working on this in stages. The plan is start with a frequency counter with a GPS module as a reference/calibration standard, then that controls a DDS like the AD8951. The Teensy will check the output of the DDS and correct it as needed.
I see the Teensy 3.0/1/2 uses a 16MHz crystal. I think I could replace that with a TCXO with +-2.5ppm temp and +-1.5ppm initial accuracy.
But what does the Teensy 3.6 have on it? I see the clock is no longer a multiple of 16.
I may also borrow an idea from another thread here, and stick a Dallas 18B20 on board, but I'm worried about the complexity of changing the crystal register.
Please forgive my ignorance.
I've got a Teensy 3.0 on a little display. I reprogrammed a NEO-6 to output 10MHz. It is currently locked to satellites. The readout on the Teensy 3.0 toggles between 9,999,990 and 9,999,991 Hz. When I change the measurement time to 10S, the display is pretty solidly on 9,999,990 Hz. -1ppm, well within specs for the on-board crystal, but a TCXO would be much closer.
Back to 1 second period: I warmed the crystal on the Teensy 3.0 for about 30 seconds with my fingertip, and the frequency is now toggles between 9,999,992 and ,999,993 Hz, going down as it cools back to room temperature. After being on for an hour, it is now wandering around 4 or 5 for the last digit.
Set to 10 second capture time, the last digits are 5.2 for several minutes, then slowly drifting upwards. It is now on 6.x for the last digit and still drifting upwards.
Clearly this drifts enough with temperature that simply correcting it one time won't get me much. A TCXO on board would be much better.
So what crystal is the Teensy 3.6 using?
Code:
/* Adapted from
* Arduino Macro Frequency Counter
*
* Teensy 3.0 or higher
* NOTES: Signal must be logic level
* Input pin is 13
* Teensy 3.x good to about 65MHz
* SCL to A5
* SDA to A4
* No limitations on analogWrite()
* For FreqMeasure, use with PPS from GPS module to calibrate
* Input pin is 3
* Pin 4 unusable with analogWrite()
*/
#include <Wire.h> //I2C library for the OLED
#include <Adafruit_SSD1306.h> //OLED driver
#include <FreqCount.h> //FreqCount library for you know...counting frequencies
//find it here: https://github.com/PaulStoffregen/FreqCount
#define OLED_RESET 4 //it's a thing
Adafruit_SSD1306 display(OLED_RESET); //create instance of the SSD1306 called display
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //begin the OLED @ hex addy )x3C
display.display(); //show the buffer
delay(2000); //bask in the glory of LadyAda
display.clearDisplay(); //enough basking
FreqCount.begin(10000); //start counting 1,2,3,4...
// tone(14, 20000); //something to count
}
void loop() {
if (FreqCount.available()) { //if the code if working
double count = FreqCount.read(); //create float var called count and populate it with current frequency count
float period = (1000000000000/count); //create float var called period and populate it with the inverse of the frequency
display.clearDisplay(); //always clear the display first
display.setTextSize(1); //smallest text size
display.setTextColor(WHITE); //my only choice, really
display.setCursor(0,0); //cursor to upper left
display.println("Arduino Freq. Counter"); //print heading to buffer
display.println("------- ----- -------"); //print some pretty line to buffer
display.print("F: "); //print the name of the function to buffer
display.print(count/10); //print the actual counted frequency to buffer
display.println("Hz"); //print units to buffer & drop down 1 line
display.print("P: "); //print the name of the fuction to buffer
display.print(period); //print the period of signal in picoseconds to buffer
display.print("pS"); //print the units to buffer
display.display(); //SHOW ME THE BUFFER!!!!
}
}