Using PolyPlugs | Control Outlets/Custom Builds From 1km+
What Is a PolyPlug?
A PolyPlug is an outlet actuator (power switcher) designed to communicate with a PolyCast5 using superior low-power, 1km range LoRa wireless technology.
Simply use your PolyCast5 to send a command to the PolyPlug, then the PolyPlug will execute it. (It can do more, but this is the main idea.) This allows you to turn any outlet on or off, since it has a built-in 15A relay to actuate the power coming out of the outlet.
Now you may be wondering, "okay, but this isn't this just a cool smart plug?" Not at all! PolyPlugs don't use Wi-Fi or Bluetooth to communicate, which is super slow, annoying, and short-range. (You have to take out your phone, go to settings, connect to it, open whatever brand's app, wait for it to sync, click on/off.) No thanks! They use LoRa.
What's the difference?
- LoRa payloads send instantly with one click. No connection needed.
- The range is up to a kilometer.
- Yep, you can control outlets from anywhere in your house (or neighbors houses) knowing the command was received instantly.
- Uses 915MHz penetrating frequency. Walls blocking your signal? Not anymore.
In addition, PolyPlugs are able to receive commands to do things like set schedules, loops, and modes.
This means you can send a command once from your PolyCast5 (e.g. turn on from 7:00:00-7:00:30 every morning to make coffee) and the PolyPlug will do it forever. (Or until you tell it not to.) This makes it perfect for setting routines. It even comes with an away mode that turns on and off at random intervals to make it look like there is a person there when you're out of town.
But what if you're out of town and need to do something? PolyPlugs also have Wi-Fi MQTT for even longer distance communication. Simply sync it with your network once, and you can control outlets from anywhere in the world. (So long as you have a Wi-Fi connection.)
Though this is less convenient than LoRa, as it will take a few seconds to send the command and get confirmation over MQTT. But certainly more distance!
Hopefully now you're convinced that this is pretty cool. But what if you're more of a DIY-er and want to use a PolyPlug's built-in, superior LoRa communication for your own projects?
PolyPlugs For Projects
All PolyPlugs come with numerous broken out GPIOs that will spell out the command they received in binary. Simply connect an Arduino or whatever else to the pins and you're in business!
From here, you can connect the PolyPlug up to anything with pins (everything) but with the added benefit of being able to use superior LoRa communication to control your project. This could be an Arduino UNO, Raspberry Pi, ESP32, STM32, you name it!
Below is some Arduino IDE example code to get you started! If you're unfamiliar with Arduino IDE, it is a coding enviroment that is super easy to set up and use for various devices. I go through the installation for ESP32 here.
// Arduino input pins - wire these to the PolyPlug GPIO outputs
// !CHANGE THE PINS BELOW TO THE ONES YOU ARE USING
const uint8_t PIN_BIT4 = 0; // MSB — connect to GPIO bit 4
const uint8_t PIN_BIT3 = 0; // connect to GPIO bit 3
const uint8_t PIN_BIT2 = 0; // connect to GPIO bit 2
const uint8_t PIN_BIT1 = 0; // connect to GPIO bit 1
const uint8_t PIN_BIT0 = 0; // LSB — connect to GPIO bit 0
static bool was_idle = true; // To only read on the rising edge
void setup()
{
Serial.begin(115200);
// Set pins as inputs
pinMode(PIN_BIT4, INPUT);
pinMode(PIN_BIT3, INPUT);
pinMode(PIN_BIT2, INPUT);
pinMode(PIN_BIT1, INPUT);
pinMode(PIN_BIT0, INPUT);
Serial.println("5-bit bus receiver ready");
}
// Read all 5 pins and reconstruct the value
uint8_t readBus()
{
uint8_t val = 0;
val |= digitalRead(PIN_BIT4) << 4;
val |= digitalRead(PIN_BIT3) << 3;
val |= digitalRead(PIN_BIT2) << 2;
val |= digitalRead(PIN_BIT1) << 1;
val |= digitalRead(PIN_BIT0) << 0;
return val;
}
void loop()
{
if (was_idle && readBus() != 0) {
// Rising edge: small settle delay then sample (pins high for 100ms)
delay(10);
uint8_t value = readBus();
Serial.print("Received: ");
Serial.println(value);
// --- Do something with 'value' (0–31) here ---
was_idle = false;
}
else if (!was_idle && readBus() == 0) {
// Lines cleared: ready for next pulse
was_idle = true;
}
}After updating the pins and uploading the code, you should get something like this on the serial monitor:
Be sure to enable 'USB-CDC On Boot' if you're not using a board with a USB-to-UART bridge.
After that, just edit the --- Do something with 'value' (0–31) here --- part of the code to do literally anything and you're set!
Just like that, you have the power of AES-128-CCM, replay protected, 1km range +22dBm LoRa in your pocket.
Happy casting!