Table call button and pager
Build it step by step
0 of 7 doneUpload the table sketch
To two boards, with TABLE_ID 1 and 2.
Add a button to each table board
GPIO 4 and GND.
Wire the pager
OLED on GPIO 21 and 22, buzzer on GPIO 18, clear button on GPIO 4.
Upload the pager sketch
To the third board.
Press the table 1 button
The pager beeps and shows Table 1.
Press the table 2 button
It shows Waiting: 1 under Table 1.
Press the clear button
Table 1 clears and Table 2 shows.
How do you build a table call button and pager?
A button on a table sends a wireless message to a small pager unit that shows the table number and beeps, so the person serving knows who is calling. Two table buttons share one pager. A good small wireless project for a club or family event. You need ESP32 DevKit V1 × 3, Tactile push button 6 mm × 3, Passive buzzer, SSD1306 OLED Display, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 100 minutes.
- Level
- Intermediate
- Time
- About 100 min
- Parts
- 6
Parts list
- Development BoardsBuyESP32 DevKit V1 × 3
- SwitchesBuy
- Motors & ActuatorsBuyPassive buzzer × 1
- DisplaysBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Table unit 1 and 2 button | GPIO 4 and GND on each table board | Press to call |
| Table units | USB power, each with its own table number in the sketch | Same sketch, different TABLE_ID |
| Pager buzzer + and - | GPIO 18 and GND on the pager board | One beep for each new call |
| Pager clear button | GPIO 4 and GND on the pager board | Clears the oldest call |
| Pager OLED SDA and SCL | GPIO 21 and GPIO 22 | I2C data and clock |
| Pager OLED VCC and GND | Pager 3V3 and GND | Power for the screen |
Code
The file holds two separate sketches, one for the table units and one for the pager, so copy each into its own Arduino window. Upload the table sketch to two boards, changing TABLE_ID to 1 on one and 2 on the other, and the pager sketch to the third. When a table button is pressed, the table board sends a two-byte message, a marker byte and its table number, three times, because a radio message can be lost. The pager's receive function only notes which table called, and the main loop adds each new call to a first-in first-out list, beeps once and shows the oldest waiting table in large text, with a count of those still waiting. Pressing the clear button removes the oldest call and shows the next one. A table that calls again while still waiting is not added twice. ESP-NOW needs no router, but a broadcast message can be received by any board nearby, and anyone with an ESP32 could send a fake call, which is fine for a family event or club and means it should never be used for anything safety related. The receiver callback uses the newer core 3 form, and a comment shows the older form. Install "Adafruit SSD1306" and "Adafruit GFX" for the screen. Try adding a light on the table unit that turns on when the pager clears the call.
Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// ===== TABLE UNIT (upload to each table board; change TABLE_ID to 1 or 2) =====
#include <WiFi.h>
#include <esp_now.h>
const uint8_t TABLE_ID = 1; // 1 to 8
const uint8_t BUTTON_PIN = 4;
uint8_t broadcastAddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
bool prevDown = false;
void setup() {
Serial.begin(115200);
pinMode(BUTTON_PIN, INPUT_PULLUP);
WiFi.mode(WIFI_STA);
if (esp_now_init() != ESP_OK) { Serial.println("ESP-NOW failed to start"); return; }
esp_now_peer_info_t peer = {};
memcpy(peer.peer_addr, broadcastAddr, 6);
peer.channel = 0;
peer.encrypt = false;
esp_now_add_peer(&peer);
}
void loop() {
bool down = (digitalRead(BUTTON_PIN) == LOW);
if (down && !prevDown) {
uint8_t msg[2] = {0xA5, TABLE_ID}; // a marker byte, then the table number
for (uint8_t i = 0; i < 3; i++) { // send three times in case one is lost
esp_now_send(broadcastAddr, msg, 2);
delay(40);
}
Serial.println("Called");
}
prevDown = down;
delay(20);
}
/* ===== PAGER (upload to the third board, as a separate sketch) =====
Copy everything below into a new sketch for the second board. */
/*
#include <WiFi.h>
#include <esp_now.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const uint8_t CLEAR_PIN = 4;
const uint8_t BUZZ_PIN = 18;
volatile uint16_t pendingMask = 0; // bit n set when table n has called
uint8_t queue[8];
uint8_t qlen = 0;
bool prevDown = false;
bool dirty = true;
// Core 3.x callback. On core 2.x use: void onReceive(const uint8_t *mac, const uint8_t *data, int len)
void onReceive(const esp_now_recv_info_t *info, const uint8_t *data, int len) {
if (len == 2 && data[0] == 0xA5 && data[1] >= 1 && data[1] <= 8) {
pendingMask |= (1 << data[1]);
}
}
bool inQueue(uint8_t id) {
for (uint8_t i = 0; i < qlen; i++) if (queue[i] == id) return true;
return false;
}
void draw() {
oled.clearDisplay();
oled.setTextColor(SSD1306_WHITE);
oled.setTextSize(1);
oled.setCursor(0, 0);
oled.print(qlen ? "Calling:" : "No calls");
oled.setTextSize(3);
oled.setCursor(0, 18);
if (qlen) { oled.print("Table "); oled.print(queue[0]); }
oled.setTextSize(1);
oled.setCursor(0, 54);
if (qlen > 1) { oled.print("Waiting: "); oled.print(qlen - 1); }
oled.display();
}
void setup() {
Serial.begin(115200);
pinMode(CLEAR_PIN, INPUT_PULLUP);
pinMode(BUZZ_PIN, OUTPUT);
Wire.begin(21, 22);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
WiFi.mode(WIFI_STA);
if (esp_now_init() != ESP_OK) { Serial.println("ESP-NOW failed to start"); return; }
esp_now_register_recv_cb(onReceive);
draw();
}
void loop() {
uint16_t mask = pendingMask;
if (mask) {
pendingMask = 0;
for (uint8_t id = 1; id <= 8; id++) {
if ((mask & (1 << id)) && !inQueue(id) && qlen < 8) {
queue[qlen++] = id;
tone(BUZZ_PIN, 2000, 300); // one beep for each new call
dirty = true;
}
}
}
bool down = (digitalRead(CLEAR_PIN) == LOW);
if (down && !prevDown && qlen) { // clear the oldest call
for (uint8_t i = 1; i < qlen; i++) queue[i - 1] = queue[i];
qlen--;
dirty = true;
}
prevDown = down;
if (dirty) { dirty = false; draw(); }
delay(20);
}
*/Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Table button | Pager beeps once and shows the table |
| A second table | Added to the waiting count |
| Same table twice | Only counted once |
| Clear button | Oldest call removed |
| Out of range | No call shows |
If it does not work
Nothing arrives
Both sketches need WiFi.mode(WIFI_STA) before ESP-NOW starts.
Compile error about esp_now_recv_info_t
You are on core 2: use the older callback form.
Blank screen
Check GPIO 21 and 22 and try address 0x3D.
Table shows wrong number
Check TABLE_ID on each board.
Calls missed at a distance
Move closer, as ESP-NOW range indoors is limited.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the table call button and pager?
ESP32 DevKit V1 × 3, Tactile push button 6 mm × 3, Passive buzzer, SSD1306 OLED Display, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the table call button and pager take to build?
About 100 minutes for a intermediate maker, in 7 steps.
How do I know the table call button and pager works?
Table button: Pager beeps once and shows the table. A second table: Added to the waiting count. Same table twice: Only counted once.
Nothing arrives: what should I check?
Both sketches need WiFi.mode(WIFI_STA) before ESP-NOW starts.
Compile error about esp_now_recv_info_t: what should I check?
You are on core 2: use the older callback form.
Blank screen: what should I check?
Check GPIO 21 and 22 and try address 0x3D.
Table shows wrong number: what should I check?
Check TABLE_ID on each board.
