Submit

14 / 20

Board to board

Send a potentiometer reading directly to a second ESP32.

Run this experiment →
ESP32 teaching illustration with module, GPIO headers and lesson components

Why it’s here

Match both radio channels, send a value, then deliberately mismatch channels.

How it works

Send a potentiometer reading directly to a second ESP32. The receiver does not receive this message. Both peers must use the same Wi-Fi channel. This guided model targets the original ESP32 and Arduino-ESP32 3.x; radio, acoustics, loads and mechanics are simplified.

Try it

  1. Open this experiment
  2. Match both radio channels, send a value, then deliberately mismatch channels.

Connections

  • 2.4 GHz — Two ESP32 boards, matching channel and peer MAC
  • GPIO 34 — Sender potentiometer

Example sketch

#include <WiFi.h>
#include <esp_now.h>
#include <esp_wifi.h>
// Replace with the other board MAC. Upload to both boards on the same channel.
uint8_t peerAddress[] = {0x24,0x6F,0x28,0x00,0x00,0x01};
void receive(const esp_now_recv_info_t*, const uint8_t *data, int len) {
  if (len != sizeof(uint16_t)) return;
  uint16_t value; memcpy(&value, data, sizeof(value));
  Serial.printf("Received: %u\n", value);
}

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  esp_wifi_set_channel(1, WIFI_SECOND_CHAN_NONE);
  if (esp_now_init() != ESP_OK) return;
  esp_now_register_recv_cb(receive);
  esp_now_peer_info_t peer = {};
  memcpy(peer.peer_addr, peerAddress, 6); peer.channel = 1;
  peer.encrypt = false;
  esp_now_add_peer(&peer);
}

void loop() {
  uint16_t reading = analogRead(34);
  esp_now_send(peerAddress, (uint8_t*)&reading, sizeof(reading));
  delay(200);
}

Check your understanding

What happens with different channels?

Show the answer

The receiver does not receive this message. Both peers must use the same Wi-Fi channel.

Sources

Arduino-ESP32 ↗ · GPIO reference ↗

MAKE A THOUGHTFUL CHOICE

Your shortlist, side by side.

Pricing models are indicative. Check each official website for current plans and limits.