Hi All,
I'm working on a little project involving an ESP32 devboard, powered on 4*AA 2400mA NiMH batteries, and equipped with neopixels (12 of them), and a capacitive soil sensor.
The idea is simple, have the best autonomy with those components. In order to do so, the ESP32 only wakes once every hours, make a soil humidity measurement, the leds light up with a color corresponding with the result obtained, the ESP send the result via wifi, and goes deepsleep for an hour, etc, etc,...
I've already replaced the onboard AMS1117 with a more efficient and capable AP2114H-3.3TRG1 LDO. So i don't burn that much current in deepsleep. I've also turned the USB IC off.
Now, from what i can see, the neopixels (WS2812B) have some pretty high quiescent current when OFF. Have tried to use a N-channel irlb8721pbf mosfet on the ground side. But weirdly it stills burns energy.
So i was wondering if you had any idea/proposition in order to solve that issue?
Thanks in advance !
Best solution for ESP32 + Neopixel and battery life
Re: Best solution for ESP32 + Neopixel and battery life
Drive the data in pin HIGH on sleep.
I guess you'll need to make sure it's a RTC GPIO.
Code: Select all
//on wakeup
rtc_gpio_hold_dis(rgb_data_pin);
//on sleep
digitalWrite(rgb_data_pin,HIGH);
rtc_gpio_hold_en(rgb_data_pin); //keep it high in deep sleep
Re: Best solution for ESP32 + Neopixel and battery life
Thank you for this remark.boarchuz wrote: ↑Wed Jan 30, 2019 4:03 amDrive the data in pin HIGH on sleep.
I guess you'll need to make sure it's a RTC GPIO.Code: Select all
//on wakeup rtc_gpio_hold_dis(rgb_data_pin); //on sleep digitalWrite(rgb_data_pin,HIGH); rtc_gpio_hold_en(rgb_data_pin); //keep it high in deep sleep
Are those commands working on arduino IDE or ESD-IDF?
Re: Best solution for ESP32 + Neopixel and battery life
Well they're not 'Arduino' functions but ESP-IDF functions are accessible within the Arduino framework. They will work fine in Arduino IDE, for example.
I forgot to mention you'll need this though: #include "driver/rtc_io.h"
I forgot to mention you'll need this though: #include "driver/rtc_io.h"
Re: Best solution for ESP32 + Neopixel and battery life
Just tried with your advice on GPIO12, no change. With 12 ws2812b neopixels i get 78mA power usage when all leds ON at 50% brightness, 7mA when all OFF.
Here is my test-code:
Code: Select all
#include <Arduino.h>
#include "driver/rtc_io.h"
#include "NeoPixelBus.h"
const uint16_t PixelCount = 12; // this example assumes 3 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 12; // make sure to set this to the correct pin, ignored for Esp8266
const uint8_t mosfetLED = 22;
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
#define colorSaturation 128
RgbColor green(0, colorSaturation, 0);
RgbColor black(0);
void setup()
{
Serial.begin(115200);
Serial.println("Initializing...");
pinMode(mosfetLED, OUTPUT);
digitalWrite(mosfetLED, HIGH);
strip.Begin();
strip.Show();
}
void loop()
{
Serial.println("LEDS ON");
digitalWrite(mosfetLED, HIGH);
rtc_gpio_hold_dis(GPIO_NUM_12);
for (int a = 0; a < PixelCount; a++)
{
strip.SetPixelColor(a, green);
strip.Show();
}
delay(1000);
for (int a = 0; a < PixelCount; a++)
{
strip.SetPixelColor(a, black);
strip.Show();
}
digitalWrite(mosfetLED, LOW);
digitalWrite(PixelPin, HIGH);
rtc_gpio_hold_en(GPIO_NUM_12);
Serial.println("LEDS OFF");
delay(2000);
}
Re: Best solution for ESP32 + Neopixel and battery life
That looks to be about the same as what I'm doing.
I'll have a think, but my first immediate thoughts are:
-Careful with pin 12. If you're using a Wrover, 12 is a strapping pin for internal ldo. In that case, you should be isolating it before sleep to reduce leakage. Use a different pin, and add the isolate code (something like "rtc_gpio_isolate(GPIO_NUM_12)", look it up).
-Do you have an external pulldown resistor on the MOSFET gate? Add one.
-And just to be clear, you have tested the sleep current with a basic deep sleep example and all LEDs disconnected, right? What was the current in that 'ideal' situation?
I'll have a think, but my first immediate thoughts are:
-Careful with pin 12. If you're using a Wrover, 12 is a strapping pin for internal ldo. In that case, you should be isolating it before sleep to reduce leakage. Use a different pin, and add the isolate code (something like "rtc_gpio_isolate(GPIO_NUM_12)", look it up).
-Do you have an external pulldown resistor on the MOSFET gate? Add one.
-And just to be clear, you have tested the sleep current with a basic deep sleep example and all LEDs disconnected, right? What was the current in that 'ideal' situation?
Who is online
Users browsing this forum: No registered users and 64 guests