Is it possible to set the threshold for external wake up?

Thomas1
Posts: 11
Joined: Wed Jan 23, 2019 7:40 pm

Is it possible to set the threshold for external wake up?

Postby Thomas1 » Fri Feb 08, 2019 7:19 pm

I'm having a chip that sleeps after a few seconds of inactivity and can be woken up by a GPIO that is connected to microphone. The relevant code is here. The wakeup is set to trigger on the GPIO being high.

Code: Select all

#define SLEEPTIMEOUT 3000

int lastActive;

void setup(void)
{
  lastActive = millis();
}
void loop()
{

  if (millis() - lastActive > SLEEPTIMEOUT)
  {

    uint64_t ext_wakeup_pin_1_mask = 0;
    ext_wakeup_pin_1_mask |= (1ULL << WAKEUPPIN);
    esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask, ESP_EXT1_WAKEUP_ANY_HIGH);

    esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);

    wasAsleep = true;

    esp_light_sleep_start();

    delay(500);
  }
}

The problem is, this causes a lot of "false positives" wakeups to appear. The device for example keeps waking up constantly when in a room with lots of people talking or when put in one's pocket. The desired behaviour is that the waking up takes place only if the noise is high enough (the GPIO reading is high enough).

Is it possible to set a threshold so that the device only wakes up if the reading on the GPIO pin is above a certain level?

Thanks.

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Is it possible to set the threshold for external wake up?

Postby ESP_Sprite » Sat Feb 09, 2019 11:10 am

No, there is not. Suggest you use an external solution for this. You should be able to implement it using something like a simple RC network to filter out the spikes.

Thomas1
Posts: 11
Joined: Wed Jan 23, 2019 7:40 pm

Re: Is it possible to set the threshold for external wake up?

Postby Thomas1 » Tue Feb 12, 2019 4:18 pm

ESP_Sprite wrote:
Sat Feb 09, 2019 11:10 am
No, there is not. Suggest you use an external solution for this. You should be able to implement it using something like a simple RC network to filter out the spikes.
Could you please give more details on how such a RC circuit would work? We are not trying to filter out frequencies, we want to filter out pin voltage readings below a certain threshold.

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Is it possible to set the threshold for external wake up?

Postby ESP_Sprite » Wed Feb 13, 2019 3:19 am

It really depends on how your current setup works. If you're feeding the AC signal directly into the GPIO and just want to raise the minimum wake-up level, an external comparator or even a simple 2-resistor attenuator may do the job. If you go the more nuanced way of actually detecting sound levels, you probably already have a rectifier and a peak detector in place. If so, a RC filter means you'd need either a more sustained sound or a higher sound level to trigger the wake-up.

Who is online

Users browsing this forum: No registered users and 66 guests