An Arduino is much more fun and modern to program than a PIC12F as you could find 20 years ago. thank you for the very nice editing. (note: it will not go below 3mhz)
Very nice introduction and good to see the progress on the frequency counter. Still waiting for my prescalers to show up in mail.... . Even if there is no eeprom I think the offset can be due to some fixed software delays as it was constant and you can adjust them in the main program itself once you have the golden number. Once again thanks for sharing.
Nice little project, I did one like this a while back. A couple of things to watch out for, the counter timer input is limited to 1/2 the CPU clock frequency -- small note in the data sheet. Second the nano clock resonator is neither accurate nor temperature stable, it's only attribute was like the lowest cost part they could find. The millis() function is also not accurate and has jitter based on how they had to generate the millis count. They prescale the counter input by 64 then count to 256 with the counter. If you do the math this is not 1mS but 1.024mS. So about every so often they adjust the count by skipping a count. This gets you close but the count is still off a little. To provide a 1 second gate for the counter use an external source not the internal nano clock or millis function. Funny, I just went through this the other day, had to examine the code behind the millis funciton because I couldn't figure how they got 1.000mS using a 16MHz clock and a 256 bit counter -- the math didn't work out.
My suggestion to Prescaller: is to use the 2SC9018 AM/FM IF amplifier transistor for 1100 MHz, I use it in a Cristal Frequency Meeter ( It has a wide working frequency range)
Yeah it really is satisfying to see one's plan printed out with glorious shiny solder mask. I've almost stopped etching my own. High freq response, why is the prescaler so far from the SMA?
Nice project. Thank you for sharing. We really do recognize and appreciate your efforts. Some questions... What is the purpose of C8 having such a large Farad value? Any concern about in-rush current stress? It looks to be a Tantalum? If so, why? I am confused as to whether the green, manufactured PCB was the first one ordered, that I thought you said had an error? Or, did you make the correction, reorder boards, build the corrected version and that is what we saw? Anyway, my interest is in what the error(s) was/were and, if you bodged them on the back of the first board, what did you do? Meaning, maybe we could learn from that/those mistakes... Just FYI, I can not read the schematic. Even in full-screen, it is too blurry.
General practice to have one large uf and one small for low freq and high freq. I just choose 10uf and 0.01uf for fun. no concern about current inrush green board ordered and tested. if found I routed 5v to the wrong pin on the arduino and that the switches were routed to analog pins that cannot be configured to digital inputs, the second revision i fixed the errors and ordered red boards. go to the pcbway website for a clear schematic
Inrush current is self limiting on such small capacitors. Remember that an ideal capacitor coupled to an ideal voltage source has an infinite inrush current. Little ceramic caps fed from very low impedance sources have stupendous inrush - you can get a 0805 capacitor size spike 10A or even more. A tantalum of this size has a couple tenths of an Ohm ESR usually, and that’s plenty enough, especially when fed via long wires. It does help to have a fast clamp across the power input on the entrance to the board, so that the inevitable ringing of the long supply wires won’t zap anything. Jim Williams IIRC has an app note about supply transients cause by low ESR capacitance that kill voltage regulators. Of course there are good reasons for low ESR capacitors, it just takes some proper design work and bench testing to quench all the spikes.
Personally I would have put the frequency counter into an FPGA with an I2C interface to read off the frequency registers that would be updated after each measurement cycle. An FPGA would give more resolution, with a divide by 4 pre-scaler it would measure GHz frequencies. To keep the FPGA simple I would read off the counter and do the math in the processor. Calibration would be stored in the processor eeprom.
@@IMSAIGuy I did this design back in 2015 and I know I have the verilog code and the schematic for it. The project I was looking at in 2015 was almost exactly what you are doing here. Except the VCO was another product we build that has an external VCO control input which I was controlling with a16 bit DAC. My plan was to get the frequency counter calibrated then have the CPU step through 256 steps that covers the full range of the DAC and record the frequency in a eeprom to use as a look up table to get me close to the desired frequency then let the CPU fine tune it using interpolation. Unfortunately the project was a low priority and eventually died on the vine and has never been revisited. I have the first revision of the PCB here at home and I do have the verilog code functional for the most part but needs a lot more attention. Back then I wanted the FPGA to do all the auto ranging which was giving me lots of problems. If rip out the auto ranging features and let the CPU set the range / pre-scaler as needed that would make it much easier. If I use the prototype to work on the verilog code while I get the schematic trimmed down to just what is needed and then make a new layout. Famous last words "It shouldn't take me that long" but don't hold your breath! I have always wanted to make a frequency counter but I've never had a real reason to actually build it outside of work. I won't build something just to be building it, I have to have a need for it. I will give it a try and if I get it working I will send you one. But until then you should continue with your plan.
An FPGA for this is like going with a tank after a fly. There are high resolution single chip time-to-digital converters that make the whole thing mostly trivial and give you resolution and update rate that until recently was reserved for $2k+ instruments that has to implement interpolation on an ASIC. An FPGA will top out at clock rates that were no problem to direct counting (no prescaler) frequency counters decades ago. You can build a 1GHz direct counter using an ECL counter for the lowest digits, those are still being made. No prescaler needed.
On the PCBWay website linked, someone mentioned the fact that pin 5 of the arduino is NOT defined in code. Have you ever released an updated version of the code for this? As for the diodes used to protect the front end (prescaler input) you may want to use Germanium diodes IF you can get any (1N34A or 1N270?) as the turn on voltage is around 300mv or so.
@@IMSAIGuy Perhaps I am using the wrong terminology - D5 is an input from the prescaler, yes? D5 is not defined in the code. SO, sre you using the I2C input for that? Or is it listed as some other pin in the code. I DO see A4 and A5 as the SDA and SCL lines to the display.
the ESP32 is more complicated. Program, WiFi, 2 core. the ESP8266 is also built bugy The Mega832 is just an 8 bit computer and good at doing a single job
GPS disciplined is $100 and is easy. WWV is ok but requires practice and only when you can receive the station. rubidium is getting expensive and requires some DIY for power supply and heatsink. if you get an oven oscillator and can cal it (friend?) they are stable for decades. my old HP equipment are all still spot on (8591,8712,8921)
An Arduino is much more fun and modern to program than a PIC12F as you could find 20 years ago. thank you for the very nice editing. (note: it will not go below 3mhz)
Very nice introduction and good to see the progress on the frequency counter. Still waiting for my prescalers to show up in mail.... . Even if there is no eeprom I think the offset can be due to some fixed software delays as it was constant and you can adjust them in the main program itself once you have the golden number.
Once again thanks for sharing.
Nice little project, I did one like this a while back. A couple of things to watch out for, the counter timer input is limited to 1/2 the CPU clock frequency -- small note in the data sheet. Second the nano clock resonator is neither accurate nor temperature stable, it's only attribute was like the lowest cost part they could find. The millis() function is also not accurate and has jitter based on how they had to generate the millis count. They prescale the counter input by 64 then count to 256 with the counter. If you do the math this is not 1mS but 1.024mS. So about every so often they adjust the count by skipping a count. This gets you close but the count is still off a little. To provide a 1 second gate for the counter use an external source not the internal nano clock or millis function. Funny, I just went through this the other day, had to examine the code behind the millis funciton because I couldn't figure how they got 1.000mS using a 16MHz clock and a 256 bit counter -- the math didn't work out.
Thanks for sharing nice info. I have all parts, and will make it as winter project. Thank you
My suggestion to Prescaller: is to use the 2SC9018 AM/FM IF amplifier transistor for 1100 MHz, I use it in a Cristal Frequency Meeter ( It has a wide working frequency range)
Most arduinos have some form of EEPROM in them that is for saving stuff between power cycles. (I think most have 255 bytes if it.)
1024 bytes eeprom on Uno, nano and pro mini. Mega I think has 4096 bytes eeprom.
No, you do not to push a button to program the ESP32. The modern dev boards have auto reset.
yes, I like the ones that program easily, unfortunately there are still new boards that still do require Boot 0
esp32 the way to go :)
A nice-to-have would be a power meter (don't know how easy you could add that with the existing prescaler / firmware)
That is amazing
Yeah it really is satisfying to see one's plan printed out with glorious shiny solder mask. I've almost stopped etching my own.
High freq response, why is the prescaler so far from the SMA?
Nice project
328 has onboard EEPROM
Nice project. Thank you for sharing. We really do recognize and appreciate your efforts. Some questions... What is the purpose of C8 having such a large Farad value? Any concern about in-rush current stress? It looks to be a Tantalum? If so, why? I am confused as to whether the green, manufactured PCB was the first one ordered, that I thought you said had an error? Or, did you make the correction, reorder boards, build the corrected version and that is what we saw? Anyway, my interest is in what the error(s) was/were and, if you bodged them on the back of the first board, what did you do? Meaning, maybe we could learn from that/those mistakes... Just FYI, I can not read the schematic. Even in full-screen, it is too blurry.
General practice to have one large uf and one small for low freq and high freq. I just choose 10uf and 0.01uf for fun. no concern about current inrush
green board ordered and tested. if found I routed 5v to the wrong pin on the arduino and that the switches were routed to analog pins that cannot be configured to digital inputs, the second revision i fixed the errors and ordered red boards.
go to the pcbway website for a clear schematic
Inrush current is self limiting on such small capacitors. Remember that an ideal capacitor coupled to an ideal voltage source has an infinite inrush current. Little ceramic caps fed from very low impedance sources have stupendous inrush - you can get a 0805 capacitor size spike 10A or even more. A tantalum of this size has a couple tenths of an Ohm ESR usually, and that’s plenty enough, especially when fed via long wires. It does help to have a fast clamp across the power input on the entrance to the board, so that the inevitable ringing of the long supply wires won’t zap anything. Jim Williams IIRC has an app note about supply transients cause by low ESR capacitance that kill voltage regulators. Of course there are good reasons for low ESR capacitors, it just takes some proper design work and bench testing to quench all the spikes.
Personally I would have put the frequency counter into an FPGA with an I2C interface to read off the frequency registers that would be updated after each measurement cycle. An FPGA would give more resolution, with a divide by 4 pre-scaler it would measure GHz frequencies. To keep the FPGA simple I would read off the counter and do the math in the processor. Calibration would be stored in the processor eeprom.
I'll be waiting for your build and video
@@IMSAIGuy I did this design back in 2015 and I know I have the verilog code and the schematic for it. The project I was looking at in 2015 was almost exactly what you are doing here. Except the VCO was another product we build that has an external VCO control input which I was controlling with a16 bit DAC. My plan was to get the frequency counter calibrated then have the CPU step through 256 steps that covers the full range of the DAC and record the frequency in a eeprom to use as a look up table to get me close to the desired frequency then let the CPU fine tune it using interpolation. Unfortunately the project was a low priority and eventually died on the vine and has never been revisited.
I have the first revision of the PCB here at home and I do have the verilog code functional for the most part but needs a lot more attention. Back then I wanted the FPGA to do all the auto ranging which was giving me lots of problems. If rip out the auto ranging features and let the CPU set the range / pre-scaler as needed that would make it much easier. If I use the prototype to work on the verilog code while I get the schematic trimmed down to just what is needed and then make a new layout. Famous last words "It shouldn't take me that long" but don't hold your breath!
I have always wanted to make a frequency counter but I've never had a real reason to actually build it outside of work. I won't build something just to be building it, I have to have a need for it. I will give it a try and if I get it working I will send you one. But until then you should continue with your plan.
An FPGA for this is like going with a tank after a fly. There are high resolution single chip time-to-digital converters that make the whole thing mostly trivial and give you resolution and update rate that until recently was reserved for $2k+ instruments that has to implement interpolation on an ASIC. An FPGA will top out at clock rates that were no problem to direct counting (no prescaler) frequency counters decades ago. You can build a 1GHz direct counter using an ECL counter for the lowest digits, those are still being made. No prescaler needed.
good 1 ! sharp!!
How do I read a sine wave of 1MHz through an arduino based frequency counter. I have used Op-Amp but itwas of no use
On the PCBWay website linked, someone mentioned the fact that pin 5 of the arduino is NOT defined in code.
Have you ever released an updated version of the code for this?
As for the diodes used to protect the front end (prescaler input) you may want to use Germanium diodes IF you can get any (1N34A or 1N270?) as the turn on voltage is around 300mv or so.
pins 4 and 5 are i2c so they don't need defining
@@IMSAIGuy Perhaps I am using the wrong terminology - D5 is an input from the prescaler, yes? D5 is not defined in the code. SO, sre you using the I2C input for that?
Or is it listed as some other pin in the code.
I DO see A4 and A5 as the SDA and SCL lines to the display.
@@mstover2809 oh yes, A4 A5 are used for i2c, d5 is an input and should be defined as input. I guess it worked for me with out definition.
Please, can you tell me where you bought the SAB6456 prescaler ?
I don't remember, eBay?
the ESP32 is more complicated. Program, WiFi, 2 core.
the ESP8266 is also built bugy
The Mega832 is just an 8 bit computer and good at doing a single job
input protection diodes may be limiting how much input you can provide.
Scope it out.
No. It was just too fast. I had to change to a 256 divisor
don't forget some termination at input
0:36 I thought he said "Ice squared sea lions" but he actually said "I²C lines" which makes much more sense
when the sea lions in the artic sleep on the ice, their fat takes on a squared appearance.
What's a reasonably economical way to get a benchtop 10Mhz reference signal at high accuracy for calibration? GPS disciplined osc? WWV tuner + LNA?
GPS disciplined is $100 and is easy. WWV is ok but requires practice and only when you can receive the station. rubidium is getting expensive and requires some DIY for power supply and heatsink. if you get an oven oscillator and can cal it (friend?) they are stable for decades. my old HP equipment are all still spot on (8591,8712,8921)
@@IMSAIGuy Hmm. How tricky would it be to make your board accept a 1PPS signal from an external GPS module as a timebase or special calibration mode?
@@ThinklikeTesla if you get an m8n gps it can program it over usb-serial to output a slightly dodgy, but accurate period, 10mhz wave
Please make an arduino tx tone decoder like ctcss and dcs
I have a question, how do you know where to place the vias?
anywhere you want. anytime you need to go from top layer to bottom
If you don't need WiFi and working in 5v is easier than I don't see why you'd want esp32, as long as you had stock of arduinos
This project calibration don't matched