ESP8266 with servo motor | Control servo motor with esp8266

Introduction

Hey geeks, hope you are doing fine. Are you familiar with the working of a servo motor?

HTML Image as link
Qries

If not then this article is for you in which we are going to teach you how to Control servo motor with esp8266 using a nodemcu IoT development board.

Servo motor is different from an ordinary DC motor as it does not rotate continuously. You can also read our article on servo motor in which we explain the features and specifications of a servo motor.

It has an extra wire for the signal which is used to rotate the shaft in a specific direction. Also, do check out more such amazing projects on IoT and Arduino.

The detailed circuit diagram and code for the project are given below. The servo motor can also work well with the other microcontroller boards like Arduino and Raspberry pi, we have our articles on them also.

in this ESP8266 with servo motor tutorial we are going to explain how to work.

1 2 e1631216167283

ESP8266 with servo motor Working

The main advantage of using a servo motor is that we can rotate it in any desired direction as per our needs.

A servo motor can rotate in very small as well as very large angles that are specified by us in the code.

  • when we make this nodemcu with servo motor We use to attach a function to specify the pin of the nodemcu on which the signal pin of the servo motor is connected.
  • The servo motor first comes to the zero position of the shaft and then after a delay of a second,
  • it will move the shaft to the middle position that is ninety degrees. A
  • gain after a delay of a second, the shaft will move to the position of the one-eighty degree.
  • We use the write function to move the shaft of the servo motor.
  • You can modify the values of the position according to you in the code.

You can also check the Robotic arm using servo motors made by us.

Components Required

Nodemcu (esp8266)BUY LINK
Servo motorBUY LINK
Jumper wiresBUY LINK
USB cable for uploading the codeBUY LINK
BreadboardBUY LINK

Components Table/buy link

You can buy the whole components from the given link we have to share the amazon link. from where you can get a good discount on the components for this esp8266 tutorial.

2 1

nodemcu with servo motor Circuit Diagram

ESP8266 with servo motor

Connection Diagram

Nodemcu esp8266Servo Motor
VV, VinVCC
G, GNDGND
D3 PinSignal  
  • The servo motor has three wires,
  • two for the power and one for the control signal.
  • You have to connect these three wires with the pins of the Nodemcu.
  • Connect the red wire with the 3.3 volts pin of the nodemcu.
  • Join the brown wire of the servo motor with the GND pin of the nodemcu.
  • Connect the signal wire (orange wire) of the servo motor with the digital-3 pin of the nodemcu.
  • After completing the connections use a USB cable to power the nodemcu so that the servo motor starts moving.

ESP8266 with servo motor Code

NOTE: Please upload the code which is given below to the nodemcu. You may need to install <Servo.h> library to the IDE software. Check here how to add a zip library to the Arduino IDE.

 //TECHATRONIC.COM  
 #include <Servo.h> // servo library  
 Servo s1;  
 void setup()  
 {   
  s1.attach(0);  // servo attach D3 pin of arduino  
 }  
 void loop()   
 {  
   s1.write(0);  
   delay(1000);  
   s1.write(90);  
   delay(1000);  
   s1.write(180);  
   delay(1000);  
 }  

We hope that you understand this project and please try to make it on your own. If you have any doubts related to this project then ask them in the comments section below. Also, check out our tutorials on Arduino and Raspberry Pi.

Video sample 

Related Posts

ESP32 RC Car

ESP32 RC Car DIY in 10 Steps | ESP32 RC Car Tutorial

He guys welcome back to the Techatronic. So today we are making a very good project the name of this project is ESP32 RC car tutorial. In…

NRF24L01 Wifi Gateway with Arduino

ESP8266 NRF24L01 Wifi Gateway with Arduino NRF24L01 Node

Hello guys. Welcome back to Techatronic. This tutorial will show you how to connect an Arduino board to a NodeMCU ESP8266 wirelessly using the NRF24L01 transceiver module….

Voice Controlled LED Using Google Assistant

Voice Controlled LED Using Google Assistant and ESP32

Hello everyone, welcome back to Techatronic. Today we are going to make an interesting project called ‘Voice Controlled LED Using Google Assistant’. This project may sound like…

Home Security System Using IOT

Home Security System Using IOT / PIR and ESP32

Hello Guys, Welcome to Techatronic. Today we are going to make a cool project that is home security system using IOT, that means we are going to…

IOT DOOR LOCK

IoT Door Lock Using Esp32 and KME Smart

Hey guys, Welcome back to the Techatronic. Today we are going to make an IoT door lock using Solenoid lock and KME Smart web application. You can…

Smart Irrigation System With Email Notification

Smart Irrigation System With Email Notification

Hello everyone, welcome back to Techatronic. Many people love plants and flowers, many must have small plants in their houses and they also need care for being…

Leave a Reply

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