ESP8266 NodeMCU – Simple Wifi Servo control

In this tutorial, we will learn how to control a small servo-motor from your smart phone. If you want to control the position of a mechanism, just have to use this tutorial. Good for beginners who want to make stuff move without building a motor controller with feedback & gear box, especially since it will fit in small places. If you need an introduction on servo-motors and how they work, you can cheek this tutorial, ESP8266 NodeMCU – Simple Servo control.

Parts Required

To build the global setup you must have the following parts:

Blynk Android app

There are a lot of android aplications for IOT. We will use blynk APP. Other application for desktop can be used, but we will keep it android for now.

Blynk is a hardware-agnostic IoT platform with white-label mobile apps, private clouds, device management, data analytics, and machine learning. You should check their Website to know more about Blynk.

Figure 1

So to install and configure the app, you must follow the tutorial in their website. However if you follow the blynk tutorial, you will end up using the server. The server is a good option because, is safe, continuous and fast. Although server is currently providing 2.000 of energy, which limit your Dashboard. To solve this problem, you can use public free blynk servers, from this GitHub. Remember that this servers are unreliable and can have intermittent shutdown. I will use the second server, but you can use any of them.

2º Server :
App Port: 9443
Device Port: 8080
Status : Alive (seen 10 Nov 2019)
Energy : 1,000,000
Blynk Email Sending : unknown
Server location : Thailand (TH)
Admin : Krisana Meesuk Department of Electronic Science, Chiang Mai

To change the server for the, in the login in page of the app, when choosing the server, you need to click on the “3 dots” botton and copy the server name and App port, as shown in figure 2.

Figure 2

Affter making the instructions above, you will receive an email with a token. We will use that token in the code for access to the server. To beggin, creat a new project and name it as you desire. In this tutorial, it will be “Wifi Switch”.

Figure 3

Below the project name, you need to especify the hardware. Choose the ESP8266 option.

Figura 4

Go to main screen again. Swipe the main screen to the left to open the widgets menu, and insert a Slider. Press the slider to open the slider settigns, and choose the output pin in the device and the min and max values.

Figure 5

For now on, we just have to program our devices and connect them with the blynk app, and we are fine.


Figure 5

Connect the signal cable (Yelow) to GPIO pin 2 (D4) because it is a PWM pin, Vcc (Red) to 3.3V and GND (Black), like figure 5. Everything will be powered from your PC using micro-usb to usb cable. In this configuration, the servo will be powered directly from the GPIO 2 pin with 3.3V. It is low voltage level but it works. All the current for the will be drawn from the board, and since each GPIO delivers only no more than a few mA, the torque can be low. Let’s try it.


Copy the main sketch bellow to your Arduino IDE project and save it. The Servo.h library is allready included in th arduino IDE. The Blynk library and EPS8266 library must be included by you, I give you the links. Heve fun!!

Leave a Reply

Your email address will not be published. Required fields are marked *