BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Esp connects then disconnects ,repeats over and over

esp8266

#1

Hi,im new to esp and blynk.
at first i tired to upload a simple program by just controlling a led with the esp with the gpi02 pin,it worked perfectly.so i tried to control a servo using the code provided below.the code uploaded well but when i try to connect it to my blynk app it connects then disconnects continuously. in the serial monitor it says connecting then connected then same thing over n over again. i cannot even control the led with this program.Can i know where am i doing wrong?does it have anything to do with firmware and flashing the esp?im pretty lost,power supply is also separate 3.3 v for esp.

• Arduino UNO with ESP8266-01
• Smartphone Android
• Blynk server
• Blynk Library version 0.5.4
esp 2.5.0 beta 2


#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "11aa1f9b8e994cb49538c6fda0dacecd";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "vvz";
char pass[] = "abcdefgh";

Servo servo;

BLYNK_WRITE(V3)
{
  servo.write(param.asInt());
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  servo.attach(9);
}

void loop()
{
  Blynk.run();
}


#2

Servo powered by a separate power supply? One way or another, the servo gives a very big noise. If you can lay out the screen series of the monitor.


#3

does it work if you comment out:

servo.attach(9);

?


#4

If you’ve uploaded code to your ESP-01 already then you’ve overwritten the default AT firmware that it shipped with.
This is needed if you want your ESP-01 to act as a Wi-Fi modem for your Uno, so you’ll need to download a copy of the AT firmware and re-flash your ESP with it.

You’ll then need to set the ESP to the desired baud rate to work with the Uno over software serial (as the Uno has only one serial UART). You then need to flash the Uno with proper code to make it use the ESP as a Wi-Fi modem, and control the servo.

Take a look at the Sketch Builder for some examples of code. I’d start with code to flash an LED that’s connected to the Uno, to ensure that it’s all working correctly to begin with.

Pete.


#5

nope the esp doesnt even connect to my phone


#6

The code you show is for installing directly on an ESP8266 acting as an independent MCU… however your apparent hardware connection is using the ESP-01 as a WiFi shield. So you will need to adjust your libraries used as well as other connection factors in your sketch for that ESP as shield application…

Just use the standard Blynk Servo Example sketch for that ESP as shield format (NOTE: read the comments… you WILL need to adjust for using the UNO with SoftSerial in the sketch)

https://examples.blynk.cc/?board=Arduino%20Uno&shield=ESP8266%20WiFi%20Shield&example=GettingStarted%2FServo


#7

4 posts were split to a new topic: Project disconnects from the Blynk server and does not connect anymore only after a reset


#9

how about the wiring ,of the esp to the arduino.


#10

The usual way, TX from one goes to RX on the other and vice versa.

http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/arduino/esp8266-with-at-firmware

Typically on the the UNO’s side, the pins used for this TX and RX application are determined by the pins chosen with SoftSerial. Often used pins are 2 & 3, or 10, 11

Basically any supported digital GPIO

https://www.arduino.cc/en/Reference/softwareSerial