How to Detect Frequency (LED Status)

kjames
Posts: 16
Joined: Mon Jul 01, 2019 3:27 pm

How to Detect Frequency (LED Status)

Postby kjames » 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!
Last edited by kjames on Fri Aug 30, 2019 3:34 pm, edited 1 time in total.

xL0j1kx
Posts: 1
Joined: Fri Aug 23, 2019 5:15 pm

Re: How to Detect Frequency (LED Status)

Postby xL0j1kx » 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?

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: How to Detect Frequency (LED Status)

Postby Ritesh » 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.
Regards,
Ritesh Prajapati

Nikonov_94
Posts: 5
Joined: Fri Jul 26, 2019 6:20 pm

Re: How to Detect Frequency (LED Status)

Postby Nikonov_94 » Sat Aug 24, 2019 6:10 pm

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.

kjames
Posts: 16
Joined: Mon Jul 01, 2019 3:27 pm

Re: How to Detect Frequency (LED Status)

Postby kjames » Sat Aug 24, 2019 6:34 pm

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

kjames
Posts: 16
Joined: Mon Jul 01, 2019 3:27 pm

Re: How to Detect Frequency (LED Status)

Postby kjames » 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...

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: How to Detect Frequency (LED Status)

Postby Ritesh » 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
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.
Regards,
Ritesh Prajapati

kjames
Posts: 16
Joined: Mon Jul 01, 2019 3:27 pm

Re: How to Detect Frequency (LED Status)

Postby kjames » 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
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

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: How to Detect Frequency (LED Status)

Postby Ritesh » 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
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.
Regards,
Ritesh Prajapati

kjames
Posts: 16
Joined: Mon Jul 01, 2019 3:27 pm

Re: How to Detect Frequency (LED Status)

Postby kjames » Wed Sep 25, 2019 2:06 pm

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

Who is online

Users browsing this forum: Bing [Bot] and 149 guests