The Program below works perfectly with a good wifi connection and operating through a Blynk Device with a couple of sliders and an LED.
The ESP is powered externally.
I also have a larger project that is much more complex, that works perfectly, as long as the USB cable is plugged in.
As soon as the Cable is disconnected from the DevKit, The program stops executing!
According to the Blynk App, the WiFi Is still connected.
I am really stuck trying to figure this one out. Anybody ever run in to this problem?
#include <Arduino.h>
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#define BLYNK_TEMPLATE_ID "TMPLm9Jxxxxx"
#define BLYNK_TEMPLATE_NAME "ESP8266TRUCKBLYNK"
#define BLYNK_AUTH_TOKEN "xxx_xxx"
#define BLYNK_PRINT Serial
#define RAINING 2
int rainLed = 0;
int tempset = 50; //Temp Threshold Value
int humidset = 55; // Humidity Threshold Value
int tempValue; // Temp Slider Value returned by Blynk
int humidValue; // Humidity Slider Value
char auth[] = BLYNK_AUTH_TOKEN;
//char ssid[] = "NETGEAR44-pro"; // type your wifi name
char ssid[] = "NETGEAR44"; // type your wifi name
char pass[] = "xxxxxxx"; // type your wifi password
// This function creates the timer object. It's part of Blynk library
BlynkTimer timer;
void myTimer()
{
// This function describes what will happen with each timer tick
// e.g. writing sensor value to datastream V5
//VENTED=venteD;
Blynk.virtualWrite(V2, tempset);
Blynk.virtualWrite(V3, humidset);
Blynk.virtualWrite(V6, rainLed);
}
BLYNK_WRITE(V0)
{
tempValue = param.asInt(); // Get value as integer
}
BLYNK_WRITE(V1)
{
humidValue = param.asInt(); // Get value as integer
;
}
void setup() {
pinMode(RAINING,OUTPUT); //onboard Led
Serial.begin(115200);
Serial.println("");
Blynk.begin(auth, ssid, pass);
Serial.println(F("Connected to Host!"));
timer.setInterval(500L, myTimer);
delay(1000);
}
void loop() {
Blynk.run();
timer.run();
rainLed = digitalRead(RAINING);
if (humidValue >= humidset) {
digitalWrite(RAINING,HIGH);
}
else
{
digitalWrite(RAINING,LOW);
}
Serial.print("Rain LED = ");
Serial.println(rainLed);
Serial.println("");
Serial.print("Humidity Slider Value = ");
Serial.println(humidValue);
Serial.println("");
/*
Code for Temp Comparison
*/
delay(300);
}
This is definitely a power supply issue. Are you sure that your PS is capable of supplying the power your esp demands? If there are sensors, LED, etc connected to your esp then they demand lot of power.
While you plug in your USB cable, both external PS and USB will be working together to supply power. When you disconnect USB is demands more power and brownout may get triggered.
I am using a 3.3V 1A Buck Converter.
The voltage on the 3.3v pin of the ESP remains steady at 3.2v when disconnected from the USB cable.
Unless I’m missing something, It does not look like it is a supply issue.
I think you were right about the Brownout being triggered. I separated the Peripheral 3.3V from the 3.3V pin of the ESP and powered the peripherals with my 3.3V Supply and the processor with 5V through vin.
Working fine now.
Thank you everyone.