Servo motor control using ESP8266 and Blynk app – Step by step instructions
Servo motor control using ESP8266 Blynk
Hello, welcome back. This tutorial is based on IoT and covers how to control a servo motor using ESP8266 and the Blynk app. Nodemcu ESP8266 board and Blynk application are mainly used for this tutorial. Also, the servo motor can be considered an essential component in robot design. So I hope the knowledge in this tutorial will be useful for your creations. Also, the knowledge gained in this project will be of great help to us in our future projects.
The process of this tutorial
- Nodemcu ESP8266 board x 1 — Amazon / Our Store
- Servo motor x 1 — Amazon / Our Store
- Jumper wires — Amazon / Our Store
- Breadboard x 1 — Amazon / Our Store
Step 1
Nodemcu ESP8266 board
Servo motor
Jumper wires
Breadboard
Step 2
Step 3
- OK, first click the “New Project” button. After, enter as you like name and select the device and connection type. Then, click the “Confirm” button.
- Then, we add the widget to this interface. To do this, click on the “+” sign on the right. After, add a “slider” widget.
- Now, click the slider widget. Then, enter the slider name as you like. After, set PIN as “virtual V0” and set the value 0 – 180. Lastly, customize the slider widget to your liking.
Step 4
/*Servo motor control with Nodemcu ESP8266.
* This code created by the SriTu Hobby team.
* https://srituhobby.com
*/
#include <Servo.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
Servo servo;
char auth[] = " ";//Enter your Blynk auth token
char ssid[] = " ";//Enter your WIFI name
char pass[] = " ";//Enter your WIFI password
BLYNK_WRITE(V0){
servo.write(param.asInt());
}
void setup() {
Serial.begin(9600);
servo.attach(D1);
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
}
Code explanation
Step 5
Servo motor control using ESP8266 and Blynk app – Step by step instructions