Hello,
I am just starting out with ESP32 and am looking for example code for detecting frequency on GPIOs. My ultimate goal is to be able to detect the state of (4) LEDs with possible states of: ON (not blinking), OFF, 1 Hz, 2 Hz, 5 Hz -- basically detect the status and print to screen or collect the data somehow.
As I am quite new at this, I am currently looking for any examples that I could use to get started with or gain inspiration from using the ESP-IDF (programming in C only).
Any suggestions that might help would be much appreciated, thanks so much!
How to Detect Frequency (LED Status)
How to Detect Frequency (LED Status)
Last edited by kjames on Fri Aug 30, 2019 3:34 pm, edited 1 time in total.
Re: How to Detect Frequency (LED Status)
Let's start our problem description by defining the conditions. What are the LEDs connected to? More specifically, is your ESP32 powering (controlling) the LEDs? If not, how are the LEDs being powered? And is it safe to assume these are like just generic single-color LEDs in series with a ~220 (ish) Ohm resistor?
Re: How to Detect Frequency (LED Status)
Hello,kjames wrote: ↑Fri Aug 23, 2019 2:41 pmHello,
I am just starting out with ESP32 and am looking for example code for detecting frequency on GPIOs. My ultimate goal is to be able to detect the state of (4) LEDs with possible states of: ON (not blinking), OFF, 1 Hz, 2 Hz, 5 Hz -- basically detect the status and print to screen or collect the data somehow.
As I am quite new at this, I am currently looking for any examples that I could use to get started with or gain inspiration from using the ESP-IDF (programming in C only).
Any suggestions that might help would be much appreciated, thanks so much!
Which ESP32 IDF you are planning to use?
So, Basically you have to use PWM or RMT interface in which you can read signals from which you can measure GPIO frequency.
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 5
- Joined: Fri Jul 26, 2019 6:20 pm
Re: How to Detect Frequency (LED Status)
Thanks for the help, I'm not the OP but it does allow me to do a step forwards in my project! I'm planning to buy some property on the Costa Blanca for the holidays and make a home automation system there, and I'll need that kind of function.
Last edited by Nikonov_94 on Wed Sep 11, 2019 7:02 am, edited 1 time in total.
Re: How to Detect Frequency (LED Status)
thanks for replying; for initial testing I will control the LEDs using the ESP32 and yes, I should have mentioned that these would be generic single-color LEDs in series with ~220 ish Ohm resistor...xL0j1kx wrote: ↑Fri Aug 23, 2019 5:49 pmLet's start our problem description by defining the conditions. What are the LEDs connected to? More specifically, is your ESP32 powering (controlling) the LEDs? If not, how are the LEDs being powered? And is it safe to assume these are like just generic single-color LEDs in series with a ~220 (ish) Ohm resistor?
Re: How to Detect Frequency (LED Status)
Hello,Ritesh wrote: ↑Fri Aug 23, 2019 7:53 pmHello,kjames wrote: ↑Fri Aug 23, 2019 2:41 pmHello,
I am just starting out with ESP32 and am looking for example code for detecting frequency on GPIOs. My ultimate goal is to be able to detect the state of (4) LEDs with possible states of: ON (not blinking), OFF, 1 Hz, 2 Hz, 5 Hz -- basically detect the status and print to screen or collect the data somehow.
As I am quite new at this, I am currently looking for any examples that I could use to get started with or gain inspiration from using the ESP-IDF (programming in C only).
Any suggestions that might help would be much appreciated, thanks so much!
Which ESP32 IDF you are planning to use?
So, Basically you have to use PWM or RMT interface in which you can read signals from which you can measure GPIO frequency.
I am currently on ESP-IDF v4.0-dev-1346-g1b6010bed-dirty
okay, thanks very much for your suggestion! I will try looking into the RMT components and search for examples based on this to start with...
Re: How to Detect Frequency (LED Status)
Thanks..kjames wrote: ↑Sat Aug 24, 2019 6:38 pmHello,Ritesh wrote: ↑Fri Aug 23, 2019 7:53 pmHello,kjames wrote: ↑Fri Aug 23, 2019 2:41 pmHello,
I am just starting out with ESP32 and am looking for example code for detecting frequency on GPIOs. My ultimate goal is to be able to detect the state of (4) LEDs with possible states of: ON (not blinking), OFF, 1 Hz, 2 Hz, 5 Hz -- basically detect the status and print to screen or collect the data somehow.
As I am quite new at this, I am currently looking for any examples that I could use to get started with or gain inspiration from using the ESP-IDF (programming in C only).
Any suggestions that might help would be much appreciated, thanks so much!
Which ESP32 IDF you are planning to use?
So, Basically you have to use PWM or RMT interface in which you can read signals from which you can measure GPIO frequency.
I am currently on ESP-IDF v4.0-dev-1346-g1b6010bed-dirty
okay, thanks very much for your suggestion! I will try looking into the RMT components and search for examples based on this to start with...
Let me know if need any help for RMT interface as we have already used it.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: How to Detect Frequency (LED Status)
Ritesh wrote: ↑Sun Aug 25, 2019 9:39 amThanks..
Let me know if need any help for RMT interface as we have already used it.
Hello,
I wanted to ask if you are familiar with the Pulse Counter? I plan to modify an example from Espressif so that I can use it for detecting the frequency on GPIOs. I am just a bit confused on how to expand on it so that it works with multiple GPIOs; this is the example from Espressif that I am looking at:
https://github.com/espressif/esp-idf/tr ... erals/pcnt
My question now is, since my project requires monitoring multiple GPIOs, I trying to find out the proper way to set up interrupts, configure the counter and process the results for each GPIO (I would need four in my case).
In order to set it up for more than one GPIO do separate "units" need to be configured for each GPIO?
Are aware of or do you have any examples of using this module with multiple GPIOs that you could refer me to? Any additional info on this would be very helpful...
thanks again
Re: How to Detect Frequency (LED Status)
Hello,kjames wrote: ↑Wed Sep 04, 2019 1:00 pm
Hello,
I wanted to ask if you are familiar with the Pulse Counter? I plan to modify an example from Espressif so that I can use it for detecting the frequency on GPIOs. I am just a bit confused on how to expand on it so that it works with multiple GPIOs; this is the example from Espressif that I am looking at:
https://github.com/espressif/esp-idf/tr ... erals/pcnt
My question now is, since my project requires monitoring multiple GPIOs, I trying to find out the proper way to set up interrupts, configure the counter and process the results for each GPIO (I would need four in my case).
In order to set it up for more than one GPIO do separate "units" need to be configured for each GPIO?
Are aware of or do you have any examples of using this module with multiple GPIOs that you could refer me to? Any additional info on this would be very helpful...
thanks again
Sorry for late reply.
We have used PCNT for individual GPIO separately into our project. So You can also use PCNT as per your requirements but I am not sure it can be used for multiple GPIOs same time.
Espressif SDK will help on this.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: How to Detect Frequency (LED Status)
Hi, no worries at all, thanks I am thinking the same and that it is not built for use with multiple GPIOs at the same time - but it would be a nice feature to have.Ritesh wrote: ↑Sat Sep 21, 2019 6:33 pmHello,kjames wrote: ↑Wed Sep 04, 2019 1:00 pm
Hello,
I wanted to ask if you are familiar with the Pulse Counter? I plan to modify an example from Espressif so that I can use it for detecting the frequency on GPIOs. I am just a bit confused on how to expand on it so that it works with multiple GPIOs; this is the example from Espressif that I am looking at:
https://github.com/espressif/esp-idf/tr ... erals/pcnt
My question now is, since my project requires monitoring multiple GPIOs, I trying to find out the proper way to set up interrupts, configure the counter and process the results for each GPIO (I would need four in my case).
In order to set it up for more than one GPIO do separate "units" need to be configured for each GPIO?
Are aware of or do you have any examples of using this module with multiple GPIOs that you could refer me to? Any additional info on this would be very helpful...
thanks again
Sorry for late reply.
We have used PCNT for individual GPIO separately into our project. So You can also use PCNT as per your requirements but I am not sure it can be used for multiple GPIOs same time.
Espressif SDK will help on this.
Best,
Kevin
Who is online
Users browsing this forum: No registered users and 171 guests