Power quality monitoring explains a whole class of factory problems that otherwise look random: drives that trip during storms, capacitor banks that fail early, transformers running hot at moderate load and power factor penalties on the utility bill. This explainer covers the main power quality phenomena, what instruments measure, and how to stream power quality data over MQTT so that events and trends reach the people who can act on them.
What Power Quality Means
In an ideal supply, voltage is a perfect sine wave at nominal amplitude and frequency, balanced across the three phases, and current is in phase with voltage. Real supplies deviate from that ideal for two reasons: disturbances coming from the grid, and disturbances created inside the plant by its own loads. Modern factories generate much of their own trouble, because variable speed drives, rectifiers, welding equipment, LED lighting and switched-mode power supplies all draw non-sinusoidal current.
The Phenomena You Will Encounter
| Phenomenon | What it is | Typical causes | Typical consequences |
|---|---|---|---|
| Harmonics | Current and voltage components at multiples of the fundamental frequency, summarised as THD | Drives, rectifiers, UPS, LED drivers | Overheating of transformers, cables and neutral conductors; capacitor damage; nuisance trips |
| Voltage sags (dips) | Short reduction in RMS voltage, from half a cycle to a few seconds | Faults on the grid, starting of large motors | Drive and PLC resets, contactor drop-out, scrapped batches |
| Swells | Short increase in RMS voltage | Switching off large loads, faults on other phases | Stress on insulation and electronics |
| Interruptions | Voltage close to zero | Protection operation, grid outages | Full stops, restart time |
| Transients | Very short, high-amplitude spikes | Lightning, capacitor switching | Component failure, data corruption |
| Unbalance | Unequal phase voltages or currents | Uneven single-phase loading | Motor heating, reduced motor life |
| Flicker | Rapid voltage fluctuations visible in lighting | Arc furnaces, welders | Complaints, sensitive equipment issues |
| Low power factor | Reactive and distortion power raise current for the same real power | Lightly loaded motors, harmonics | Higher losses, utility penalties, reduced capacity |
Harmonics and THD
Total harmonic distortion (THD) expresses the harmonic content relative to the fundamental. Current THD (THDi) at a drive input can be high while voltage THD (THDu) at the main busbar stays modest; voltage distortion grows when many distorting loads share a weak supply. Triplen harmonics (3rd, 9th, 15th) add up in the neutral of four-wire systems, which is why neutral conductors in offices and data rooms sometimes carry more current than phase conductors. IEEE 519 and IEC standards set recommended limits; which apply depends on your region and the utility contract.
Power factor: displacement and distortion
Classic power factor correction with capacitors fixes displacement power factor, the phase shift between voltage and current of the fundamental. With heavy harmonic loads, true power factor also suffers from distortion, and adding capacitors can create resonance that amplifies harmonics. Monitoring both displacement power factor (often shown as cos phi) and true power factor tells you which problem you have.
What to Measure and Where
- Point of common coupling (incomer): a power quality analyzer to the measurement class your utility and contracts require. IEC 61000-4-30 defines measurement methods and Class A for instruments whose results must be comparable and defensible.
- Main distribution boards: multifunction meters with THD, per-phase values and power factor. Many sub-meters already provide these.
- Sensitive or problematic loads: a portable analyzer for a few weeks, or a fixed meter if the problem recurs.
Analyzers produce two kinds of data. Aggregated values (10-cycle, 150-cycle, 10-minute RMS, THD, power factor, unbalance) form continuous trends. Events (a sag on L2 to 72 percent for 140 ms) are discrete records, sometimes with a captured waveform.
Streaming Power Quality Monitoring Data over MQTT
MQTT fits both data kinds well. Aggregates are periodic telemetry; events are sporadic messages that must not be lost. A topic layout following ISA-95:
connectmq/plant1/utilities/main-incomer/pq/telemetry every 10 s to 1 min
connectmq/plant1/utilities/main-incomer/pq/event on each sag, swell, interruption
connectmq/plant1/utilities/main-incomer/pq/status retained: online / offline
A telemetry payload:
{
"ts": 1760600000,
"v_l1": 229.8, "v_l2": 231.1, "v_l3": 230.4,
"thd_v_l1": 2.9, "thd_v_l2": 3.1, "thd_v_l3": 3.0,
"thd_i_l1": 18.4, "thd_i_l2": 17.9, "thd_i_l3": 19.2,
"pf_true": 0.91, "cos_phi": 0.97,
"unbalance_v_pct": 0.6,
"hz": 50.01
}
An event payload:
{
"ts": 1760600123.482,
"type": "sag",
"phase": "L2",
"residual_pct": 72.0,
"duration_ms": 140,
"source": "PQA-INC-01"
}
Publish events with QoS 1 so they are delivered at least once, and include a millisecond timestamp from the analyzer, not the gateway, so you can correlate a sag with a drive fault logged by a PLC. Waveform captures are large binary files; keep them on the analyzer or a file share and publish only a reference in the event, rather than pushing megabytes through the broker.
Turning events into alerts
The Node.js subscriber below listens to all power quality topics in a site, classifies events by severity and publishes a compact alarm on a separate topic that dashboards and andon screens can show. It uses MQTT.js with MQTT 5 against the public test broker.
// pq-alarms.mjs - npm install mqtt
import mqtt from "mqtt";
const prefix = "connectmq/demo/pq-8w2m/plant1";
const client = mqtt.connect("mqtts://broker.connectmq.com:8883", {
clientId: "pq-alarms-8w2m",
protocolVersion: 5,
});
const limits = { thdV: 5.0, pfTrue: 0.9 };
client.on("connect", () => {
console.log("connected");
client.subscribe(`${prefix}/+/+/pq/#`, { qos: 1 });
});
function publishAlarm(asset, severity, text) {
const topic = `${prefix}/alarms/pq`;
const payload = JSON.stringify({ ts: Date.now() / 1000, asset, severity, text });
client.publish(topic, payload, { qos: 1 });
console.log(severity, asset, text);
}
client.on("message", (topic, buf) => {
const parts = topic.split("/");
const asset = parts.slice(-4, -2).join("/");
const kind = parts.at(-1);
if (kind !== "event" && kind !== "telemetry") return; // ignore status messages
let msg;
try {
msg = JSON.parse(buf.toString());
} catch {
return;
}
if (kind === "event") {
const severe = msg.type === "interruption" || msg.residual_pct < 70 || msg.duration_ms > 500;
publishAlarm(asset, severe ? "high" : "medium",
`${msg.type} on ${msg.phase}: ${msg.residual_pct}% for ${msg.duration_ms} ms`);
} else if (kind === "telemetry") {
const thd = Math.max(msg.thd_v_l1, msg.thd_v_l2, msg.thd_v_l3);
if (thd > limits.thdV) publishAlarm(asset, "medium", `Voltage THD ${thd}%`);
if (msg.pf_true < limits.pfTrue) publishAlarm(asset, "low", `True PF ${msg.pf_true}`);
}
});
Test it by publishing a fake event:
mosquitto_pub -h broker.connectmq.com -p 1883 -i pq-test-$RANDOM -q 1 \
-t "connectmq/demo/pq-8w2m/plant1/utilities/main-incomer/pq/event" \
-m '{"ts":1760600123.4,"type":"sag","phase":"L2","residual_pct":65,"duration_ms":140}'
The limit values in the script are placeholders; set them from your utility contract, the applicable standard and the tolerance of your equipment. Without code, the ConnectMQ portal's threshold alert rules can watch numeric fields such as thd_v_l1 or pf_true directly and record each breach in the alerts log. Keep in mind that the free public MQTT broker is only for tests; real plant data belongs on a private, authenticated broker.
Using the Data
- Correlate sags with stoppages. Match event timestamps with machine status changes. If a line stops after every sag deeper than a certain level, ride-through measures on drives or controls (or a small UPS for control power) may pay off quickly.
- Track THD as load changes. Adding drives or removing old capacitors changes harmonic levels. A rising trend at the busbar warns before transformers overheat.
- Watch true power factor. It is often the fastest financial win, because utility penalties are explicit on the bill.
- Feed energy reporting. Power quality data lives next to the kWh counters from electrical sub-metering and in the same dashboards as factory energy monitoring, so energy and reliability teams look at one picture.
Implementation Checklist
- Identify your utility contract terms for power factor and harmonic limits.
- Install or select an analyzer at the incomer with the right measurement class.
- Check which existing multifunction meters already provide THD and power factor.
- Define topics for telemetry, events and status, with analyzer timestamps.
- Publish events with QoS 1 and keep waveforms off the broker.
- Set initial thresholds conservatively and refine after a few weeks of data.
- Review events weekly together with maintenance and production downtime records.
Infrastructure Matters
Power quality events often coincide with network and power disturbances, so the data path must reconnect cleanly and the broker must stay reachable. A cloud MQTT broker outside the plant's own power and IT incidents, with gateways that buffer events locally until they reconnect, is a robust pattern. If you are new to the architecture, start with what an MQTT broker does. For how power quality fits into broader digital operations, see the smart manufacturing guide.
Stream Power Quality Data with ConnectMQ
ConnectMQ gives you a managed MQTT 5 broker with TLS, live topic exploration, an ISA-95 devices view and threshold alerts, ready for analyzer gateways and alarm services like the one above. Create a free Serverless broker, no credit card needed, and start streaming your first power quality monitoring data.
Frequently Asked Questions
What is the difference between power quality monitoring and energy monitoring?
Energy monitoring measures how much power is consumed and when. Power quality monitoring measures how good the supply is, including harmonics, sags, swells, unbalance and power factor, which affects reliability and equipment life.
Do I need a Class A power quality analyzer?
For results that must be compared with utility measurements or used in disputes, IEC 61000-4-30 Class A instruments are the reference. For internal trending and troubleshooting, multifunction meters with THD and event logging are often sufficient.
Can waveform captures be sent over MQTT?
Technically yes, within the broker's message size limit, but it is rarely sensible. Publish event summaries over MQTT and store waveforms on the analyzer or a file server, referenced in the event message.
How fast must power quality data be published?
Aggregated values every 10 seconds to 1 minute are enough for trends. Events should be published as soon as the analyzer records them, with the analyzer's own precise timestamp.



