Page 1 of 1

espWROOM-32 battery power problem

Posted: Mon Feb 21, 2022 1:45 am
by jg1112
I have a very simple touch sensor program that works fine and lights an led to show the sensor works; while hooked up to the computer via usb cable it works fine. When using a power bank with the same usb cable the board lights up but does not read the touch sensor. I have tried other cables with the same result.

// ESP32 Touch Test
// Just test touch pin - Touch0 is T0 which is on GPIO 4.
bool touchStarted = false;
unsigned long touchTime = 0;
int threshold = 15;
int touchMinDuration = 100;
int i;
void setup()
{
pinMode(22, OUTPUT); // Set GPIO22 as digital output pin
Serial.begin(115200);
delay(1000); // give me time to bring up serial monitor
Serial.println("ESP32 Touch Test");
}

void loop()
{
int t = touchRead(T0);
//Serial.println(touchRead(T0)); // get value of Touch 0 pin = GPIO 4
if (t < threshold && !touchStarted) { // on fresh touch
touchStarted = true;
touchTime = millis();
} else if (t >= threshold && touchStarted) { // untouched
if (millis() - touchTime > touchMinDuration)
touched();
touchStarted = false;
}
delay(10);
}

void touched()
{
Serial.println("Touched");
flashLed();
}
void flashLed()
{
digitalWrite(22, HIGH);

for (i = 0; i < 10; i++)
{
digitalWrite(22, HIGH);
delay(50);
digitalWrite(22, LOW);
delay(50);
}
}

Re: espWROOM-32 battery power problem

Posted: Wed Apr 06, 2022 2:06 pm
by tepalia02
Hi, that means your power bank is not being able to provide sufficient current to the WROOM. Have you checked the batteries? Are they fully charged?