The Plynx Arduino library: control your board from your phone
If you searched for a way to control an Arduino or ESP board from your phone, this is the short version: install a library, paste a token, flash a sketch, and your board shows up in an app where you can flip pins and read sensors. No web server to write, no protocol to design, no cloud account to reverse engineer. This post walks through the Plynx Arduino library end to end.
What the library is
The Plynx Arduino library is the firmware side of Plynx. It runs on your board and keeps a live connection to a Plynx server, syncing pin state both ways. You set a pin high in the app and the library flips the GPIO on your board. Your board writes a sensor reading to a virtual pin and the app updates in real time.
It targets the boards people actually use for this: ESP32, ESP8266, and classic Arduinos with an Ethernet or WiFi shield. If it can open a TCP socket, it can talk to Plynx.
Installing it
The library is published on GitHub. In the Arduino IDE, download the repository
as a ZIP from
github.com/NickP005/plynx-library,
then use Sketch, Include Library, Add .ZIP Library and pick the file you
just downloaded. If you use PlatformIO, drop the repository URL into your
lib_deps and it will fetch on the next build.
That is the whole install. The examples folder has ready-to-flash sketches for each board family, which is usually the fastest way to get a first blink.
A minimal ESP32 / ESP8266 sketch
Here is a complete sketch that connects to the public Plynx server at
yes.plynx.cc and does nothing but stay online. On ESP32 include
PlynxSimpleEsp32.h; on ESP8266 include PlynxSimpleEsp8266.h instead. The
rest is identical.
#define PLYNX_PRINT Serial
#include <WiFi.h>
#include <PlynxSimpleEsp32.h> // ESP8266: <PlynxSimpleEsp8266.h>
char auth[] = "YOUR_AUTH_TOKEN";
char ssid[] = "YOUR_WIFI";
char pass[] = "YOUR_WIFI_PASSWORD";
void setup() {
Serial.begin(115200);
Plynx.begin(auth, ssid, pass, "yes.plynx.cc", 8080);
}
void loop() {
Plynx.run();
}
Plynx.run() handles the connection, reconnects, and pin sync for you, so keep
it in loop() and avoid long blocking calls next to it. To react to something
you changed in the app, add a handler for a virtual pin:
PLYNX_WRITE(V1) {
int value = param.asInt();
digitalWrite(LED_BUILTIN, value);
}
To push a sensor reading up to the app, write to a virtual pin from your loop:
Plynx.virtualWrite(V2, analogRead(34));
Flash it, open the Serial Monitor at 115200, and watch for Ready. At that
point the board is live and the app can see it.
Getting your token
The auth token is what ties one board to one place in your account. In the
Plynx app, create a project, add a widget such as a Button on virtual pin V1,
and open the project settings. The auth token is there, ready to copy. Paste it
into the auth[] field in your sketch and reflash. One token per board keeps
things clean: give each device its own project token and you can tell them
apart at a glance.
Pointing it at your own server
yes.plynx.cc is the hosted server, which is the easy default. If you run your
own server, the only line that changes is the host and port in Plynx.begin:
Plynx.begin(auth, ssid, pass, "192.168.1.50", 8080); // your server
Use a LAN address for boards on the same network, or an overlay address if you reach the server through something like Tailscale. Everything else in the sketch stays exactly the same, so moving a project between the hosted server and your own box is a one-line edit.
Compatibility, stated plainly
The library speaks the Blynk Legacy protocol. That makes it a drop-in for Blynk-legacy sketches and Blynk-legacy servers. If you have an old sketch written against the classic Blynk library, the wire format is the same, the virtual pin model is the same, and it will connect to a Plynx server without protocol changes. It also means you can point this library at any existing Blynk-legacy server, not only the Plynx one.
Credit where it is due: this protocol and the original client come from the
blynk-library project, which
defined the approach that a lot of hobby IoT still runs on. The Plynx library
implements the same legacy protocol so that hardware from that era keeps working
with a current app and a maintained server, and so that people who prefer a
Plynx.* API and the Plynx app have a clean path.
Next steps
Install the app, create a project, copy the token, and flash the sketch above. Within a couple of minutes you have a phone that reads and controls your board over WiFi.
- Get the app: plynx.cc
- Library and examples: github.com/NickP005/plynx-library
The app is free, there is nothing to unlock, and once the sketch is on your board the round trip from your phone to your hardware is yours to build on.