Week14.networking and communications

Group Assignment

This week, I will use an ESP32-S3 and a servo motor. The goal is to create a server that allows servo motor control. For this, Wi-Fi protocols (IEEE 802.11) will be utilized.

Wi-Fi is a set of wireless communication standards defined under IEEE 802.11, enabling data transmission between devices in a local area network (LAN) or providing internet access. ESP32-S3 supports this standard, allowing it to be used for both creating its own network and connecting to an existing one.

It has several operating modes:

STA Mode (Station Mode) - Used to connect the ESP32-S3 to a router or another access point. Suitable for interaction through an existing network.

SAP Mode (Access Point Mode) - The ESP32-S3 creates its own Wi-Fi network that clients can connect to. Suitable for standalone systems.

Dual Mode (STA + AP).

The ESP32-S3 can transmit data to servers via HTTP, MQTT, or WebSocket. The user connects to the ESP32-S3 network and opens a web interface for control. The ESP32-S3 receives new firmware versions via Wi-Fi. It uses Wi-Fi Direct or access points to create a local network between multiple devices.

S1. Establish a communication process between two devices.

2. For this I will use two seed studio xioa esp32c3 controllers.

3. We’ll program the ESP32 board using Arduino IDE, so before proceeding with this tutorial you should have the ESP32 add-on installed in your Arduino IDE.

3.1. In your Arduino IDE, go to File> Preferences

3.2. Enter the following into the “Additional Board Manager URLs” field:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

1.3 Then, click the “OK” button:

Open the Boards Manager. Go to Tools > Board > Boards Manager…

Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

That’s it. It should be installed after a few seconds.

in more detail, the process of connecting the board to Arduino is described by the link

2. Testing the Installation

2.1.Plug the ESP32 board to your computer. With your Arduino IDE open, follow these

steps:

2.2.Select your Board in Tools > Board menu (in my case it’s the XIAO-Esp32c3)

2. Select the Port (if you don’t see the COM Port in your Arduino IDE, you need to install the CP210x USB to UART Bridge VCP Drivers):

Next, I will use a simple sketch to connect the board to the Internet

link

Pixlr

AP Mode will be used here to create a custom access point.

Let's program the sketch now so that ESP works as an access point

Pixlr

let's try to find our access point on the phone

Pixlr Pixlr

now let's create a sketch for debugging the server

link

Pixlr Pixlr

The next step is to create a web server to control the servo motor. STA Mode will be used here.

To create a web server for controlling a servo motor, it is necessary to use communication protocols between the ESP and the client. HTTP/HTTPS are the basic protocols for organizing interaction between the ESP32-S3 and clients. HTTP (Hypertext Transfer Protocol) is an application-level protocol for exchanging textual and multimedia data between the client and the server. The browser sends requests to the ESP32-S3 server. The server processes the requests and returns responses.

How does it work?

The browser sends an HTTP request to the ESP32-S3 (for example, to the / page). The server returns an HTML page. The user clicks a button, which triggers a request to /servo.

The built-in ESP libraries are used to create the server.

The server processes the /servo request and executes the command for the servo motor. I created a sketch. In which I created a server on which there will be a button for

controlling the laser pointer. File is here

Pixlr