Hello everyone.
I need some help regarding the working of servo with esp8266 wifi module on Arduino Mega using the Blynk app.
I have connected all the hardware correctly as to my knowledge. The main problem what I am facing is - in every 30 seconds I get a pop-up on blynk app “Device was disconnected” and it automatically gets connected in 30 seconds and following the same pattern. I have already checked if my esp8266 is fine by just operating a LED, and it works fine being connected for all the time. I am facing this issue whenever I am connecting my servo to the board. I assume it to be some power issue which I have no idea about.
Hardware:
- Arduino Mega 2560
- ESP8266 WiFi Module
- Tower Pro Micro Servo 9g (SG90)
Connections:
- Power supply of 3.3V to both Servo and ESP8266 from Arduino board, and same ground connection
- Power supply of 3.3V to ESP8266 and 5V to Servo, and different ground connection
I have tried both of the above connections listed but, still the issue persists.
Blynk Application:
- Slider Widget - OUTPUT (V3) -> 0 - 180
- Button Widget - OUTPUT (D13) -> 0 - 1
The code is a simple one listed below:
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include<Servo.h>
#define EspSerial Serial1
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
//WiFi Connection
char auth[]="My Token";
char ssid[]="My ID";
char pass[]="My Password";
Servo servo;
BLYNK_WRITE(V3){
int value = param.asInt();
servo.write(value);
}
void setup() {
Serial.begin(9600);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
Blynk.begin(auth, wifi, ssid, pass);
servo.attach(8);
}
void loop() {
Blynk.run();
}
I need the solution as early as possible.