Networking and Communications
Group Assignment
Through this group assignment, we gained hands-on experience working with ESP-NOW — a fast, lightweight communication protocol that lets ESP32 boards talk to each other directly without Wi-Fi or internet. Our goal was to establish one-way communication between two ESP32-S3 boards: first testing it with a “hello” message, then using a button to trigger a motor on the receiver side.
What We Learned
-
ESP-NOW is ideal for simple, device-to-device communication, especially in offline or low-power setups. It worked smoothly once the initial setup was right.
-
We understood the importance of MAC addresses — without the exact receiver MAC, the sender won’t know where to send data. We used the serial monitor to get the MAC of the receiver and entered it manually in the sender code.
-
Testing with a simple “hello” message helped us confirm that data was being received, which gave us confidence before connecting hardware like motors.
-
We successfully combined wireless communication with physical interaction, where pressing a button on one board remotely triggered a motor on the other. This gave us insight into how ESP-NOW can be used for real-world applications like remote controls or sensor-based systems.
-
It also improved our team coordination and debugging skills — we had to divide tasks, troubleshoot upload issues, and test wiring as a group.
What to Avoid
-
Upload errors happened because of selecting the wrong COM port in the Arduino IDE. It’s a small mistake but caused delays, so now we always double-check the port before uploading.
-
Skipping basic tests was risky — if we had jumped straight to triggering hardware, we might’ve wasted time debugging the wrong issue. Starting with a basic text-message test is a smart move.
-
We initially hardcoded the MAC address without verifying it — just one wrong digit, and communication failed. Always confirm the MAC from the serial output.
-
Our motor was drawing too much power directly from the ESP32, which caused instability. We learned that separate power sources and using a transistor circuit are better practices for handling motors or other high-draw components.
What Can Be Improved or Explored Next
-
Two-way communication would make the setup more interactive — for example, the receiver could send back an acknowledgment when the motor activates.
-
Instead of a manual button, we can try using real-world sensors (like a motion detector or temperature sensor) on the sender side to automate the trigger.
-
We can explore multi-device communication, where one ESP32 sends data to multiple receivers, or handles responses from them.
-
For more advanced use cases, we could look into data encryption and validation, which ESP-NOW supports but we haven’t tested yet.
-
And lastly, adding power-efficient features like deep sleep could help if we ever plan to run this setup on batteries.
For more details on networking and communication, Devanshi page where we have covered the setups, protocols, and example codes in depth.
Indiviadual Assignment
Here is a link to Miled PCB Board
Setting Up XIAO ESP32
Here’s how I set up my XIAO ESP32 board to work with the Arduino IDE. Super simple — follow these steps and you’ll be ready to upload code in minutes.
This site helped : Seeed Website
Step 1: Install the ESP32 Board Package I opened Arduino IDE and went to:
- File → Preferences → Additional Board URLs.
In the "Additional Board URLs" box, I pasted the following link:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
Then, I headed to:
Tools → Board → Board Manager,
searched for ESP32, and installed the package named ESP32 by Espressif Systems.
Step 2: Select the Right Board and Port
Once installed, I selected the correct board:
From the top menu:
- Tools → Board → ESP32 Arduino → Seeed XIAO ESP32C3
Then I connected the board with a USB-C cable, and selected the correct PORT from:
- Tools → Port
Make sure the XIAO ESP32 is plugged in properly — it should show up here.
Step 3: Upload a Basic Test Sketch
To test if everything was working, I uploaded this super simple code: Initial code
After uploading, I opened the Serial Monitor (115200 baud), and saw the message:
Boom! That confirmed everything was set up correctly.
Getting the MAC Address of XIAO ESP32
After setting up my XIAO ESP32 with the Arduino IDE, the next thing I needed was its MAC address — super useful for networking stuff, especially when you want to assign static IPs or identify your board on a network.
What I Did:
-
Uploaded the code- Macaddress code
-
Opened Serial Monitor at 115200 baud
-
Hit the Reset button on the board once
And boom — the MAC address popped up!
Triggering LED on One ESP Using Button Press on Another
For this task, I worked on establishing wireless communication between two ESP32-S3 boards using ESP-NOW, a protocol developed by Espressif that allows devices to send data directly to each other without needing a router.
The objective was to press a button connected to one ESP32 (the sender) and turn ON an LED connected to another ESP32 (the receiver). Instead of using traditional networking or internet-based messaging, I learned how to send structured data using MAC addresses, enabling low-latency, local peer-to-peer control.
This method is highly efficient for local IoT applications like remote sensors, switchboards, or automation systems where quick responses are needed without going through Wi-Fi access points.
Connection
Sender ESP32-S3 (with Button)
Component | ESP32 Pin | Description |
---|---|---|
Push Button | GPIO 12 | Used to trigger data transmission |
GND | GND | Connected to one side of the button |
Receiver ESP32-S3 (with LED)
Component | ESP32 Pin | Description |
---|---|---|
LED Anode | GPIO 4 | Receives digital HIGH to light up |
Resistor | In series | 220Ω to limit current through LED |
LED Cathode | GND | Connected to ground |
Sender Code Detail
In the sender ESP32, I configured a button connected to GPIO 12 to act as the trigger. When pressed, the ESP32 would send a signal to the receiver ESP32 using ESP-NOW. I ensured that the data sent from the sender contained a signal to turn on the LED.
Key considerations included proper setup of Wi-Fi in STA mode and peer address configuration, where the sender needed to know the receiver’s MAC address to establish communication.
Reciever Code Detail
On the receiver side, the ESP32 was configured to listen for incoming messages from the sender. When the LED control signal was received, the receiver would turn the LED on and off as per the received data.
The receiver ESP32 utilized a callback function to process the incoming data and trigger the appropriate output on GPIO 4. I paid attention to ensuring smooth reception and correctly handling any data from the sender.
Error while Coding
As port which was selected was wrong, due to which codes also got shuffled, this error message came.
Make sure you double check, so then code is uploaded in right esp and then it showed sent and recieved once conected to right port.
Finally It Worked
Hero Shot
Programming Processes I Used
1.Telling the ESP32 Which Pin to Use
set up one of the ESP32’s pins to act as an output. This basically means I gave the board control over that pin to send out signals.
2.Using Logic to Control Behavior
used simple logic (like true/false conditions) to decide what the board should do next. This helped me understand how the ESP32 can make decisions based on what's happening in the code.
3.Breaking the Code into Smaller Pieces
wrote parts of the code in separate functions. This made everything easier to manage and understand, instead of putting all the logic in one big block.
4.Checking Output Through Serial Monitor
used the Serial Monitor to print messages and check if the code was working properly. It was a great way to catch errors and see what the ESP32 was doing in real time.
5.Right ports are connected
while uploading the code,had to select the correct COM port in the Arduino IDE. If the wrong port is selected, the ESP32 won’t respond. This step was important to ensure smooth communication between the board and my computer.
6.Organizing the Program with Setup and Loop
learned how the code runs in two parts — setup() runs once at the start, and loop() keeps running again and again. This is how all ESP32 (and Arduino) programs are structured.
What I Learned
-
learned how ESP-NOW allows direct communication between ESP32 devices using their MAC addresses.
-
figured out how to retrieve and use MAC addresses using WiFi.macAddress() for targeting specific boards.
-
understood how to send and receive structured data (struct) which can hold multiple values in one transmission.
-
realized the importance of using STA mode in Wi-Fi for ESP-NOW to work.
-
practiced debugging issues like wrong MAC addresses, unstable power supply, and ESP-NOW initialization failures.
Things to Keep in Mind
Each ESP32 board must have Wi-Fi set to Station (STA) mode before initializing ESP-NOW.
The MAC address of the receiver must be hardcoded into the sender’s code and must be exact.
Avoid using delay() heavily in production projects as it may block other processes.
ESP-NOW doesn't require internet, but both boards need to be powered and within communication range (~20–30m indoors).
Testing using Serial.print() is very useful — I used it frequently to verify button input and data transmission.
Code Workflow and Adaptation
Most of the code used in this activity was adapted with the help of ChatGPT.
Initial examples for ESP-NOW sender and receiver communication were taken as a base and then modified to suit the project requirements — including updating GPIO pins, adding a button input on the sender, and triggering an LED on the receiver.
This approach helped streamline the development process, making it easier to understand how device-to-device communication works. It also allowed quick experimentation and debugging, making the setup more efficient and reliable.