ESP-IDF : Connected Servo – Control Servo from remote location

The real power of ESP32 is it’s ability to connect to the network. In the previous blog we have jut seen how to control the servo using ESP32, but haven’t done any activity on network. In this post we will see how to set the servo position from a remote machine.

Why we need this?

IoT is all about remote control and monitoring of devices. For example, one trigger action could be turning the motor on or off. By using servos, we can create this movement. Using ESP32 net work protocol (here we use UDP), we can send these commands remotely and complete the required actions.

network servo using esp32

Objective :

We will design a system which can receive commands on UDP port and set the position of the servo accordingly. We will use nodejs on a windows machine to send the commands. The command will not have any data other than the target angle of the servo (In production environment , it is advised to use some sort of data structure and some authentication mechanism). Though UDP is not reliable we are using this, as I am expecting this to be used in joystick kind of controllers , where the position data is continuously provided. Loosing a message in this type of scenarios doesn’t cause any damage to the system. If your application can’t tolerate loosing data, better use TCP or MQTT to transfer data.