Skip to main content

Current Sensor Tutorial

This tutorial series builds a complete current-monitoring system on RelayX. An ESP32 reads current, voltage, and power from an INA219 sensor and publishes the readings to a React dashboard. The dashboard displays live values and controls a relay on the device over the internet.

Each part adds one RelayX feature on top of the previous part's build.

What you'll build

A browser dashboard with live gauges and time-series charts, backed by a device on the bench. Clicking Start in the browser closes a physical relay, which energizes a load. The sensor measures the current, and the readings stream back to the dashboard in under a second.

danger

The INA219 senses DC power only. Wiring an AC load (mains bulb, fan running directly off mains, anything plugged straight into a wall outlet) through Vin+ and Vin- is dangerous. Do not attempt it unless you are experienced with mains wiring and have the right equipment. Measure the DC side of your supply, for example the 5V rail out of a phone charger.

The series

PartTopic
1Telemetry and RPCs
2Alerts on live telemetry (coming soon)
3Events and ephemeral alerts (coming soon)

Repository

All source code lives on GitHub at Realtime-Relay/ex-current-sensor-stack. The repository contains two folders: device/ for the ESP32 firmware and dashboard/ for the React app.