I have a TTGO-T2-SSD1331 esp32 Wroom.
When powered with my laptop (USB), the oled display and the ESP32 show and refresh analog read value every second and does that indefinitely.
When I power the esp with external 3.3 volt power supply, the display show and refresh the analog value every second but the esp32 go to sleep after exactly 30 sec. Then I have to manually wake the controller using the reset pin to make it work again.
What is going on? Is this a default setting? Is there a way to know what sleep mode this is and change it? I don't use deep sleep mode or any sleep command in my code above!
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1331.h>
#include <SPI.h>
#define sclk 14
#define mosi 13
#define cs 15
#define rst 4
#define dc 16
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
Adafruit_SSD1331 display = Adafruit_SSD1331(cs, dc, mosi, sclk, rst);
// Potentiometer is connected to GPIO 34 (Analog ADC1_CH6)
const int potPin = 34;
// variable for storing the potentiometer value
int potValue = 0;
float VS = 0;
void setup() {
display.begin();
display.fillScreen(RED);
delay(300);
display.fillScreen(GREEN);
delay(300);
display.fillScreen(BLUE);
delay(300);
display.fillScreen(BLACK);
delay(1000);
//display.fillRect(10, 40, 75, 20, RED);
//display.drawRect(0,0,96,64,WHITE);
}
void loop() {
// Reading potentiometer value
potValue = analogRead(potPin);
VS = potValue * 3.39 / 3850;
Screen();
delay(1000);
}
void Screen()
{
display.setCursor(0,0);
display.setTextSize(0);
display.setTextColor(WHITE);
display.fillRect(38, 8, 64, 96, BLACK);
//display.fillScreen(BLACK);
display.println("Status:");
display.println("Pres:");
display.println("Temp:");
display.println("pH:");
display.println("Cond:");
display.println("DOcc:");
display.println("DOsat:");
display.println("Depth:");
display.setCursor(45,0);
display.println("Active");
display.setCursor(38,8);
display.println(potValue);
display.setCursor(38,16);
display.println(VS);
display.setCursor(38,24);
display.println("7.5");
display.setCursor(38,32);
display.println("213 uS");
display.setCursor(38,40);
display.println("11.42 mgL");
display.setCursor(38,48);
display.println("98.52 %");
display.setCursor(38,56);
display.println("22.42 m");
}
The power supply is a DPS-1012M regulated DC and I consider it quite reliable. I don't know if it is switching. I will google on this topic.
Edit: It is a Zurich variable output voltage model DPS-1012M and it is not specified how regulation is achieve.
and attach it to pin 33 of my device. I then connect a wire from the power supply to the pin.
The ESP32 do is thing for 30 sec. then go to sleep (don't know which mode) but then wake up because pin 33 state is high. It reboot, do the measurement for another 30 sec. and go back to sleep again. And loop this for an hour now.
I don't think the PSU is the problem but maybe? I am new with ESP32. Is this board very sensitive to voltage changes? I varied the voltage between 3 and 5 volts and the analog read remain very stable. The 3.3 Vout from the ESP regulator was also very stable.
I feel that the ESP have a default setting to go in sleep mode after 30 sec. Is this possible?
In the arduino IDE, we can also change the "core debbug fct". Can this be of any help?
AFAIK the ESP has no default sleep mode if powered from a different power source.
This sounds like the PSU is not detecting enough current draw on its output and going into standby mode. This happens for me with most of my 18650 battery power packs and probably is happening for your PSU.
To Idahowalker: the pin out is fix because there is a SD card and a SSD1331 embedded on this ESP32 board.
About my problem:
I initially connect the external power supply on the mini white jst connector (see picture - I have this exact board version V1.6). On this connector, the unwanted sleep occur every 30 sec. and the wake up alarm I set up reboot the esp32 every time it go to sleep.
I decide to bypass this connector and feed the board 5v pin directly. I read that I can put up to 12 volts there. For now I tried it up to 6-7 volts. When connected this way, the board do not go to sleep anymore.
My PSU is the same in both situation so it can't be the problem. This rewiring showed it is reliable.
When wired to the 5v pin, I have not problem. I can live with this but I think it is important to understand what happen with the jst connector. Has Riva suggest, is there a current sensing thing in there that decide to turn the device off because it don't measure enough activity (current)? Note that the OLED screen is power up and do consume current during the whole process.