Page 1 of 2

How to Detect Frequency (LED Status)

Posted: Fri Aug 23, 2019 2:41 pm
by kjames
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!

Re: How to Detect Frequency (LED Status)

Posted: Fri Aug 23, 2019 5:49 pm
by xL0j1kx
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)

Posted: Fri Aug 23, 2019 7:53 pm
by Ritesh
kjames wrote:
Fri Aug 23, 2019 2:41 pm
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!
Hello,

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.

Re: How to Detect Frequency (LED Status)

Posted: Sat Aug 24, 2019 6:10 pm
by Nikonov_94
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.

Re: How to Detect Frequency (LED Status)

Posted: Sat Aug 24, 2019 6:34 pm
by kjames
xL0j1kx wrote:
Fri Aug 23, 2019 5:49 pm
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?
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...

Re: How to Detect Frequency (LED Status)

Posted: Sat Aug 24, 2019 6:38 pm
by kjames
Ritesh wrote:
Fri Aug 23, 2019 7:53 pm
kjames wrote:
Fri Aug 23, 2019 2:41 pm
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!
Hello,

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.
Hello,

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)

Posted: Sun Aug 25, 2019 9:39 am
by Ritesh
kjames wrote:
Sat Aug 24, 2019 6:38 pm
Ritesh wrote:
Fri Aug 23, 2019 7:53 pm
kjames wrote:
Fri Aug 23, 2019 2:41 pm
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!
Hello,

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.
Hello,

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...
Thanks..

Let me know if need any help for RMT interface as we have already used it.

Re: How to Detect Frequency (LED Status)

Posted: Wed Sep 04, 2019 1:00 pm
by kjames
Ritesh wrote:
Sun Aug 25, 2019 9:39 am
kjames wrote:
Sat Aug 24, 2019 6:38 pm
Ritesh wrote:
Fri Aug 23, 2019 7:53 pm


Hello,

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.
Hello,

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...
Thanks..

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)

Posted: Sat Sep 21, 2019 6:33 pm
by Ritesh
kjames wrote:
Wed Sep 04, 2019 1:00 pm
Ritesh wrote:
Sun Aug 25, 2019 9:39 am
kjames wrote:
Sat Aug 24, 2019 6:38 pm


Hello,

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...
Thanks..

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
Hello,

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.

Re: How to Detect Frequency (LED Status)

Posted: Wed Sep 25, 2019 2:06 pm
by kjames
Ritesh wrote:
Sat Sep 21, 2019 6:33 pm
kjames wrote:
Wed Sep 04, 2019 1:00 pm
Ritesh wrote:
Sun Aug 25, 2019 9:39 am


Thanks..

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
Hello,

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.
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.

Best,
Kevin