Best Frequency Meter ever made with ESP32 - awesome!

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby jgustavoam » Mon Dec 19, 2022 11:59 am

Ahmet,

Unfortunately it is not possible to help you. You have made too many changes which could be the cause of the program malfunctioning!
You cannot change GPIO pins arbitrarily. There are rules that are in the documentation.

https://www.espressif.com/sites/default ... ual_en.pdf
Retired IBM Brasil
Electronic hobbyist since 1976.

Ahmet58
Posts: 21
Joined: Sat Jan 22, 2022 8:38 pm

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby Ahmet58 » Mon Dec 19, 2022 4:27 pm

thanks for the answer. I tested it without making any changes to the program. frequency line transitions on the monitor at 1 second intervals.

Ahmet58
Posts: 21
Joined: Sat Jan 22, 2022 8:38 pm

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby Ahmet58 » Mon Dec 19, 2022 4:50 pm

Dear jgustavoam, unfortunately there is something wrong again. I am currently working with your original code. If you don't help, I will have to stay in front of the computer until the morning and sleep during the day. :)

uint32_t sample_time = 1000;
uint32_t osc_freq = 50;

When I set it to, on the monitor;

Frequency: It is seen as 0 Hz.

In the same way,
uint32_t sample_time = 10000; (ten thousand microseconds)
uint32_t osc_freq = 50;

When I set it to, on the monitor;

Frequency: It is seen as 0 Hz.

In the same way,
uint32_t sample_time = 100000; (one hundred thousand microseconds)
uint32_t osc_freq = 50;

When I set it to, on the monitor;

Frequency: It is seen as 5 Hz.
as a result, it only measures normal frequency when set to 1s(1000000). My aim is to be able to measure this frequency in 100ms or less times on the LCD screen and monitor.
Could you please help to fix this situation.

Ahmet58
Posts: 21
Joined: Sat Jan 22, 2022 8:38 pm

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby Ahmet58 » Mon Dec 19, 2022 9:32 pm

Thanks Gustavo, have solved this problem according to your suggestions. :)

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby jgustavoam » Mon Dec 19, 2022 9:38 pm

Ahmet58,
If you did the assembly like the tutorial and used the original code, everything should work perfectly.
If you've done all that and you still have a problem, let me know.
But it looks like you already solved your problem. I'm glad for that. :D
Retired IBM Brasil
Electronic hobbyist since 1976.

Ahmet58
Posts: 21
Joined: Sat Jan 22, 2022 8:38 pm

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby Ahmet58 » Mon Dec 19, 2022 10:17 pm

Yes, I solved the problem. I was really happy too. As you mentioned in your previous comments, there can be erroneous counts when the sampling time is set to low values. In my test, the count of frequencies less than 50hz below 100000 microseconds is wrong. I can accurately count the frequency values I want with 100 milliseconds. Problem solved. It was a really nice project. I hope you will announce new ones soon. :)

xiaolaba
Posts: 8
Joined: Sat Sep 26, 2020 7:01 am

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby xiaolaba » Fri Feb 10, 2023 4:36 am

hi, our prototype built show a littel difference, the default 12543Hz showing 12539Hz.
20MHZ is showing 20,000,156 HZ, it saying offset 156Hz
then half each step and offest does the same, till 10KHz
only an old 20MHZ CRT scope was used to counter check some spots, it is ok, but would like to understand more about this offset issue either the hardware variation or software issue related.
thanks.

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby jgustavoam » Fri Feb 10, 2023 1:12 pm

Hi xialaba,

As I mentioned in the tutorial, the frequency measurement can be calibrated with another frequency meter for calibration!
You can calibrate, changing the variable:
uint32_t sample_time = 1000000;
Regards
Gustavo Murta
Retired IBM Brasil
Electronic hobbyist since 1976.

xiaolaba
Posts: 8
Joined: Sat Sep 26, 2020 7:01 am

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby xiaolaba » Tue Feb 14, 2023 1:58 pm

jgustavoam wrote:
Fri Feb 10, 2023 1:12 pm
Hi xialaba,

As I mentioned in the tutorial, the frequency measurement can be calibrated with another frequency meter for calibration!
You can calibrate, changing the variable:
uint32_t sample_time = 1000000;
Regards
Gustavo Murta
Thanks Gustavo, I read your blog and trying to understand more about the Pulse Counter and oscillator. the mentioned offset that was GPIO33 and GPIO34 shorted via 1k resistor and then readout, it was feeding osc to the frequency counter. because no other good enough frequency counter to be used to calibrate this gadget, I did not understand whether oscillator no good or frequency counter over counting by varying sample_time.

Image

Code: Select all

//uint32_t sample_time = 1000000;
uint32_t sample_time = 1000000+319; // (12539-12543)/12543 *1000000 = 318.90
it results 12,543 Hz readout as desired, however as expected at higher-end, 10MHz offset +3,2KHz

so this get me to further confusing about how the osc and the frequency counter related to each other, on this single chip.

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: Best Frequency Meter ever made with ESP32 - awesome!

Postby jgustavoam » Tue Feb 14, 2023 8:45 pm

Hi Xiaolab,

If you don't have another frequency counter or oscilloscope frequency meter, you won't be able to calibrate because you won't have a reference measurement.
The ESP32 oscillator has some limitations in the resolution of the generated signal adjustment. So you can't rely on that signal alone.
When you have a reference measurement for the calibration, the fit is empirical. Increase or decrease the variable value until you get a measurement closer to the reference value.
Retired IBM Brasil
Electronic hobbyist since 1976.

Who is online

Users browsing this forum: No registered users and 45 guests