-->
Page 1 of 1

PIR wake on motion. - Some questions.

PostPosted: Thu Sep 26, 2019 2:30 pm
by WhiteLion
Hiho,
I ve a problem: My batteries are empty after about 300 wakeups (each about 6-7 seconds to send a message to MQTT).
I use PIR (HC-SR501) to wake the ESP-12E on motion and have my circuty like this:
Image
The only difference is that I used a ESP-12E and a transistor (HT7333) in between ESP-12E and power supply to get 3.3V.
The PIR (HC-SR501) is connected to battery pack 4.5V directly (3 x AA). (This will be changed later because I found out,
that there is a regulator to 3.3V in the PIR to, but that doesn´t matter atm).
While my tests a programmer (FTDI232) was permanent connected to (TX,RX,GND), but was powered by USB the hole time.
The main question is: Why are my batteries empty so fast? Did I something wrong ? What can I do better ?
My code for deepsleep, connection to WiFi and Mqtt where taken from my temp./light/hum. sensor project which
where messued with 24 uA consumption while in deepsleep mode and had (5000 wakeups without problems.
I noticed that the LED of the ESP is still on while in deepsleep. Even if I add to switch it off before sleeping.

Code: Select all....
// Thats the "outro" part:
// LED off:
pinMode(2, OUTPUT);
digitalWrite(2, LOW);

StartDeepSleep();
WiFiOff();

void StartDeepSleep()
{
  Serial.printf("Starting Deepsleep seconds: ");
  Serial.println((int)DEEPSLEEP);
  //ESP.deepSleep(CalcSecSleepTime(), WAKE_RFCAL);
  ESP.deepSleep(CalcSecSleepTime(), WAKE_RF_DISABLED );
  delay(100);
}

uint64_t CalcSecSleepTime()
{
  uint64_t accumulator = DEEPSLEEP * 1000000;
  return accumulator;
}

void WiFiOff()
{
  Serial.println("diconnecting client and WiFi.");
  WiFi.forceSleepBegin();
  wifi_station_disconnect();
  wifi_set_opmode(NULL_MODE);
  wifi_set_sleep_type(MODEM_SLEEP_T);
  wifi_fpm_open();
  delay( 1 );
}



Thanx for your help !

Re: PIR wake on motion. - Some questions.

PostPosted: Fri Sep 27, 2019 5:40 pm
by QuickFix
Did you use an actual Wemos D1 mini like in the picture or a separate ESP-12 module and used the Wemos image for ease of drawing?

To find the culprit you might want to measure the actual current consumed by your setup and gradually take things out of the equation.
An ESP-12 itself will draw about 400mA to 600mA at boot, but what does the PIR module use?
Also, if using a Wemos, there's also a USB -> UART chip (and circuitry around it) that might use a considerable amount of power even when not in use.

And are the batteries actually empty after 300 wake-ups or below the working threshold of the LDO on the Wemos board?

As we say over here in The Netherlands: "Meten is weten" (which translates to: "Measuring is knowing"). :idea:

Re: PIR wake on motion. - Some questions.

PostPosted: Sat Sep 28, 2019 6:51 am
by WhiteLion
Hello from germany ;)

QuickFix wrote:Did you use an actual Wemos D1 mini like in the picture or a separate ESP-12 module and used the Wemos image for ease of drawing?


I use a seperate ESP-12 modul + HT7333 as volatage regulator.
Both together were measured at about 24 uA.

QuickFix wrote:To find the culprit you might want to measure the actual current consumed by your setup and gradually take things out of the equation.
An ESP-12 itself will draw about 400mA to 600mA at boot, but what does the PIR module use?


The datasheet of the PIR say 50 uA at quiescent current. There is no more information about other current.
so I guess the operation current is the same. Image

QuickFix wrote:Also, if using a Wemos, there's also a USB -> UART chip (and circuitry around it) that might use a considerable amount of power even when not in use.


Since I use a ESP-12 I and hat a programmer FTDI232 which was connected the hole time (but only TX,RX and GND). So can the programmer suck energy from GND only ? - I guess not but am unsure.

QuickFix wrote:And are the batteries actually empty after 300 wake-ups or below the working threshold of the LDO on the Wemos board?

The still have energy dropped from 4.5v to 4.1v ... that is not enought to power the PIR which uses 5v. I found out PIR have a HT7333 to regulate to 3.3v like ESP. So I want to connect the PIR directly to the HT7333 I already have for getting 3.3v for ESP.

QuickFix wrote:As we say over here in The Netherlands: "Meten is weten" (which translates to: "Measuring is knowing"). :idea:


deepsleep measurement is a problem for me because I only have multimeters jamming a wakeup. I saw a viedo of Andreas Spiess where he told to buy a special tool for this... As I understod the video its not possible to measure deepsleep volates with a multimeter. link

I am still wondering why the LED is still running when on deepsleep.


EDIT: Ok I measured some stuff and fixed some problems.
1. My deepsleep time was to big. That leads to power consumption problems while deepsleep.
2. Some cable connections of breadboard were weak and caused different problems.
3. The PIR sensor potis are not adjustable like they should be and work only in a small range well.
This last point is a problem, because I have to set the trigger time to lowest. This means permanent
wake ups sucking the battery empty very fast. - At least if the sensor is frequently passed.

The PIR works fine on 3.3v