I Can't Online

Hi All,
I’m a new member here. I need help to online my application. my application wasn’t online yet
I used ESP32 and 1 servo. The code:

#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "TMPL6kB0H5WUZ"

#define BLYNK_TEMPLATE_NAME "CHIFEED"

#define BLYNK_AUTH_TOKEN "wBzApJGlxrRxurAGnc2ovMFSPNJB5PAo"

#include <Blynk.h>

#include <BlynkSimpleEsp32.h>

#include <ESP32Servo.h>

#include <ESP32PWM.h>

#include <WiFi.h>

#include <WiFiAP.h>

#include <WiFiClient.h>

#include <WiFiGeneric.h>

#include <WiFiMulti.h>

#include <WiFiSTA.h>

#include <WiFiScan.h>

#include <WiFiServer.h>

#include <WiFiType.h>

#include <WiFiUdp.h>

#include <Wire.h>

char ssid[] ="OPPO A76";

char pass[] ="d4ugk3wd";

char auth[] = "BLYNK_AUTH_TOKEN";

Servo servo;

BLYNK_CONNECTED() {

Blynk.syncVirtual(V1);

}

BLYNK_WRITE(V1)

{

// here you get default value 1

servo.write(param.asInt());

}

void setup() {

Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

servo.attach(22);

}

void loop()

{

Blynk.run();

delay(500);

}

Please Help me

@LILI Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

Start by removing these lines of code…

Then add this line of code at the beginning of your void setup…

Serial.begin(115200);

Once uploaded, open your serial monitor, set the baud rate to 115200 baud and see what it’s telling you.

If you plan on sharing your serial monitor output then copy/paste the text and use triple backticks again.

In future, you’d be better using the Blynk examples that are installed as part of the library, rather than taking a shotgun approach to installing every conceivable liberty without knowing which ones are needed.

Pete.

Thank you… I will try it
In the serial Monitor:

[14] Connecting to Uchnul123

Brownout detector was triggered

ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

configsip: 0, SPIWP:0xee

clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00

mode:DIO, clock div:1

Here it’s trying to connect to your WiFi, but before it is able to do that the brownout detector is triggered and the device reboots.

A brownout is when the supply voltage drops below an acceptable level, or the power supply can’t supply enough current.
This could be caused by a bad power source, poor quality or bad USB cable, or having too many peripherals (sensors, relays etc) being powered from the board.

Pete.

1 Like

Hai Pete
Thank You for your answer.
I tried to use adaptor and power bank but its still failed. In the ESP32 board, I just use one servo motor with the pin:
VCC to 3v3
GND to GND
OUT to D22

my friend said to use Vin pin for the VCC on the servo motor. So, what do you think? which one that I should use?

*Sorry english is not my first language

The 3.3v pin is intended to be the 3.3v input for your ESP32 board, but it can also be used as a 3.3v supply for peripherals if you’re supplying the board with 5v via the USB connector or 5v pin.
In this situation the 5v supply is converted to 3.3v by the onboard voltage regulator, and this 3.3v supply is used to power the ESP32 chip. If you draw too much current from the 3.3v pin then it will overload the onboard voltage regulator and may damage it, or cause the ESP32 chip to give a brownout alert because it’s not getting enough power.

I would suggest that you remove all the connections from the board apart from the USB cable and try running a simple Blynk ESP32 standalone sketch to ensure that you can get your board online.
Once you have that working then try adding-in your servo code and connecting-up your servo to see what causes the board to stop working.

I would expect that you’d need to either power your service from the 5v pin, or if it needs 3.3v then power it from a separate supply, but ensure you have a common ground between the ESP32 and this additional power supply.

Pete.

Hay Pete, thank you very much… it’s work wonderfull… :star_struck:

And right now I tried to use another sensor with servo, but the program is not working, please help me to check it.
The code:

#define BLYNK_TEMPLATE_ID "*****"
#define BLYNK_TEMPLATE_NAME "*****"
#define BLYNK_AUTH_TOKEN "************"

#define BLYNK_PRINT Serial

#include <Wire.h>

#include <BlynkSimpleEsp32.h>
#include <WiFi.h>
#include <WiFiClient.h>

#include <ESP32Servo.h>
#include <ESP32PWM.h>



char ssid[] ="********";

char pass[] ="*******";

Servo servo;

int servoPin = 25;
int rainPin = 35;

bool isRaining = false;

BLYNK_WRITE(V3) {
  int rain = param.asInt();
  if (rain == 1){
    servo.write(0);
    isRaining = true;
  } else {
    servo.write(90);
    isRaining = false;
  }
}
void setup()
{
  serial.begin(115200);
  servo.attach(servoPin);
pinMode (rainPin, INPUT);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}


void loop()
{
  Blynk.run();
  int rainValue = digitalRead(rainPin);

  if (rainValue == HIGH) {
    isRaining = true;
    Blynk.logEvent ("rain","Jemuran tutup");

  } else {isRaining = false;
  Blynk.logEvent("rain","Jemuran buka");
}

if (isRaining == true) { 
rainValue == HIGH)
} 
{
  servo.write(90);
else {
  servo.write(0);
}
}

Please help me…

What EXACTLY does this mean?
Is it not compiling, not producing any serial output, not connecting to Blynk, not producing the results you’re expecting, or something else?

In addition, you need to read this…

And you should also redact sensitive information such as your Blynk Auth token, WiFi credentials etc, when posting code to a public forum.

Pete.

Thank you Pete.
So I tried to write another program, and its working but then I upload to ESP32 and it do nothing :sweat_smile:
Please help me to check it.
The code:

#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "***"
#define BLYNK_TEMPLATE_NAME "***"
#define BLYNK_AUTH_TOKEN "***"

#include <Wire.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <ESP32Servo.h>
#include <ESP32PWM.h>
#include <BlynkSimpleEsp32.h>

char ssid[] ="***";
char pass[] ="***";

#define RAIN_SENSOR_PIN  35 
#define SERVO_PIN        25 

Servo servo; 

BLYNK_CONNECTED() {
Blynk.syncVirtual(V2);
}
BLYNK_WRITE(V2)
{
  servo.write(param.asInt());
}

int angle = 0;          
int prev_rain_state;    
int rain_state; 

void setup() {
  Serial.begin(115200); 
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);             
  pinMode(RAIN_SENSOR_PIN, INPUT); 
  servo.attach(SERVO_PIN);         

  servo.write(angle);
  rain_state = digitalRead(RAIN_SENSOR_PIN);
  
}

void loop() 
{
  Blynk.run();
  {
  prev_rain_state = rain_state;             
  rain_state = digitalRead(RAIN_SENSOR_PIN); 

  if (rain_state == LOW && prev_rain_state == HIGH) { 
    Serial.println("Rain detected!");
    servo.write(90);
  }
  else
  if (rain_state == HIGH && prev_rain_state == LOW) { 
    Serial.println("Rain stopped!");
    servo.write(0);
  }
}
}

Once again, you need to explain what “it do nothing” actually means.

You also need to take on board the “keep your void loop clean” principal.

Pete.