Skip to main content
This guide walks you through connecting an ESP32 to PumpLink. By the end, your device will appear in the dashboard and respond to activation commands.

What you need

  • An ESP32 board (any variant — ESP32-WROOM, ESP32-S3, etc.)
  • A relay module wired to your ESP32 (or just an LED for testing)
  • PlatformIO installed in VS Code
  • A PumpLink account — sign up free

Step 1 — Register your device

Sign in to the PumpLink dashboard, go to Devices → Add device, give it a name, and click Register. You’ll see a Device ID and a Password shown once. Copy both immediately — the password is never shown again. If you lose it, you’ll need to regenerate credentials and reflash.
The password is shown exactly once. Store it securely before closing the dialog.

Step 2 — Create your project

Create a new folder and add the following files:

platformio.ini

Change board to match your specific board if needed (e.g. esp32-s3-devkitc-1).

src/config.h


src/ca_cert.h

This is the Let’s Encrypt root CA certificate. It allows the ESP32 to verify the TLS connection to mqtt.pumplink.dev without disabling certificate verification.
The CA certificate above verifies mqtt.pumplink.dev’s TLS certificate chain. You do not need to update this when PumpLink renews its broker certificate — the root CA is valid until 2035.

src/main.cpp


Step 3 — Flash

Open the project in VS Code with PlatformIO, then click Upload or run:
Open the serial monitor (pio device monitor) and you should see:

Step 4 — Verify

Go to the PumpLink dashboard — your device should appear as Online. To trigger an activation without writing any client code, connect to the broker with MQTT Explorer using your device’s username and password (same host and port as your firmware — mqtt.pumplink.dev:41102, TLS enabled). Then:
  1. Subscribe to device/42/# (replace 42 with your device ID) to watch all traffic for your device.
  2. Publish on to device/42/command.
Your relay should click on immediately, and the device should publish to device/42/ack within 10 seconds. Publish off to the same command topic to turn it back off. The serial monitor will show:
This manual publish is just for testing. In production, the backend publishes on/off to the command topic on your behalf when a user triggers an activation from the dashboard or API — see the device contract for the full handshake.

Troubleshooting

Device doesn’t appear in dashboard
  • Check serial monitor for connection errors
  • Verify MQTT_USERNAME is your numeric device ID (e.g. "42" not "device_42")
  • Verify MQTT_PASSWORD is correct — regenerate from dashboard if unsure
TLS handshake fails
  • Confirm mqtt.pumplink.dev resolves from your network
  • The CA cert in ca_cert.h must be complete and unmodified
Relay doesn’t click
  • Verify RELAY_PIN matches your wiring
  • Most relay modules are active HIGH — digitalWrite(HIGH) closes the relay
Ack timeout (device shows offline after activation)
  • The backend expects an ack within 10 seconds of sending "on"
  • Check that topicAck() publishes successfully — look for [MQTT] ack sent in serial

Next steps