emg sensor with esp32

Currently, I am working on a project to transfer data from an EMG sensor using an ESP32 to a computer wirelessly. I will use the Wi-Fi available on the ESP32. I have three ESPs, two of which will be used as slaves and one as a master to collect data from them. Then, I will send this data to the computer. Additionally, after receiving this data on the computer, I can process and display it in Excel or plot it I think this is long and unprofessional way to do it ... Am i right... And can u segest other ways to do so
Solution:
@wafa_ath Use ESP-NOW protocol for fast and low-latency communication between the ESP32s, One ESP32 can act as the master to collect data from the other two and then send the collected data to the computer over, then Implement a TCP or UDP server on the computer and have the master ESP32 send the collected data directly to the server....
Jump to solution
2 Replies
Solution
Renuel Roberts
Renuel Roberts6mo ago
@wafa_ath Use ESP-NOW protocol for fast and low-latency communication between the ESP32s, One ESP32 can act as the master to collect data from the other two and then send the collected data to the computer over, then Implement a TCP or UDP server on the computer and have the master ESP32 send the collected data directly to the server.
Renuel Roberts
Renuel Roberts6mo ago
#include <WiFi.h>
#include <PubSubClient.h>

const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
const char* mqtt_server = "your_computer_IP";

WiFiClient espClient;
PubSubClient client(espClient);

void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
client.setServer(mqtt_server, 1883);
}

void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();

// Read EMG sensor data
int emgValue = analogRead(34);
char msg[50];
sprintf(msg, "EMG: %d", emgValue);

client.publish("emg/data", msg);
delay(1000);
}

void reconnect() {
while (!client.connected()) {
if (client.connect("ESP32Client")) {
client.subscribe("emg/data");
} else {
delay(5000);
}
}
}
#include <WiFi.h>
#include <PubSubClient.h>

const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
const char* mqtt_server = "your_computer_IP";

WiFiClient espClient;
PubSubClient client(espClient);

void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
client.setServer(mqtt_server, 1883);
}

void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();

// Read EMG sensor data
int emgValue = analogRead(34);
char msg[50];
sprintf(msg, "EMG: %d", emgValue);

client.publish("emg/data", msg);
delay(1000);
}

void reconnect() {
while (!client.connected()) {
if (client.connect("ESP32Client")) {
client.subscribe("emg/data");
} else {
delay(5000);
}
}
}
Want results from more Discord servers?
Add your server