Advertisement
Intermediate Time: 3–4 weeks Mechanical Engineering

Building Energy Monitoring System

Build a comprehensive building energy monitoring system with CT sensors, power quality analysis, dashboard, and anomaly alerts.

Energy MonitoringIoTSmart MeterCT SensorPower QualityBuilding Automation
DifficultyIntermediate
Duration3–4 weeks
Components10 items
Steps4 steps

Introduction

Build a comprehensive building energy monitoring system with CT sensors, power quality analysis, dashboard, and anomaly alerts. This comprehensive guide covers everything from design through implementation, testing, and deployment.

Theory & Background

CT (Current Transformer) clamps around a live wire — measures current via electromagnetic induction (no electrical connection to live circuit). SCT-013-030: 30A input → 1V output (through 33Ω burden resistor). Calibrate: compare CT reading with a reference clamp meter on a known load (1kW heater). Calibration factor = reference_current / CT_raw_reading. AC current waveform is sampled at 10kHz by ADC, RMS calculated: I_rms = sqrt(mean(i²)). Sample at least 2 complete cycles (40ms at 50Hz) for accurate RMS.

Advertisement

Components & Requirements

10 components required for this project.

#ComponentPurposeQty
1Current Transformer (SCT-013-030, 30A)Non-invasive current measurementx6
2ZMPT101B Voltage Transformer ModuleAC voltage measurementx2
3Arduino Mega + ADS1115 ADCHigh-resolution energy measurementx1
4Raspberry Pi 4Data processing and IoT gatewayx1
5InfluxDB (time-series database)Energy data storagex1
6GrafanaEnergy dashboard visualizationx1
7Telegram Bot APIAnomaly alerts on phonex1
8RS-485 + Modbus (for digital meters)Professional energy meter interfacingx1
9DIN Rail enclosurePanel-mounted professional installationx1
10Circuit breakers (MCB) × 6Circuit protectionx6

Step-by-Step Implementation

Follow these 4 steps carefully.

1
CT Sensor Theory and Calibration

CT (Current Transformer) clamps around a live wire — measures current via electromagnetic induction (no electrical connection to live circuit). SCT-013-030: 30A input → 1V output (through 33Ω burden resistor). Calibrate: compare CT reading with a reference clamp meter on a known load (1kW heater). Calibration factor = reference_current / CT_raw_reading. AC current waveform is sampled at 10kHz by ADC, RMS calculated: I_rms = sqrt(mean(i²)). Sample at least 2 complete cycles (40ms at 50Hz) for accurate RMS.

2
Power Factor and Reactive Power

True power (W) = V_rms × I_rms × cos(φ) (power factor). Apparent power (VA) = V_rms × I_rms. Reactive power (VAr) = V_rms × I_rms × sin(φ). Power factor cos(φ): 1.0 = purely resistive (heater), < 1.0 = inductive (motors) or capacitive. Measure instantaneous power: p(t) = v(t) × i(t), integrate over cycle: P = mean(v×i). Compare P with |S| = V_rms × I_rms to get power factor directly without phase measurement. Poor power factor (< 0.8) incurs penalty charges from utilities.

3
Real-Time Dashboard and Analytics

Grafana panels: real-time power per circuit (W), energy today (kWh), power factor, total building power vs time. Derived analytics: load profile (power vs time of day), load duration curve (how long above various power levels), peak demand (maximum 15-minute average power — utility billing basis), standby power (overnight consumption when building unoccupied — target < 2% of peak). Cost calculation: kWh × tariff rate → daily/monthly cost estimate.

4
Anomaly Detection and Alerts

Rule-based alerts: circuit load > historical average by 30% → inspect. Overnight consumption > 500W (suspicious — HVAC leak, equipment left on) → alert. Power factor < 0.75 → notify for capacitor bank installation recommendation. Motor startup anomaly: normal startup current = 6× running current for < 3 seconds. If high current persists > 10 seconds → motor stuck or bearing failure. Machine learning anomaly detection: train isolation forest on 30 days of baseline data, alert when new day deviates significantly.

Code & Implementation

Core code for energy_monitor.ino:

energy_monitor.ino C/C++
#include <Wire.h> #include <Adafruit_ADS1X15.h>  Adafruit_ADS1115 ads;  const float CAL_FACTOR = 30.0 / 1.0;  // SCT-013-030: 30A per 1V const float VREF = 2.5;               // Midpoint voltage (voltage divider)  float measureRMS(int channel, int samples = 500) {   float sum_sq = 0;   for(int i = 0; i < samples; i++) {     int16_t raw = ads.readADC_SingleEnded(channel);     float voltage = (raw * 0.0001875) - VREF;  // ADS1115 resolution: 187.5µV/bit at ±6.144V     float current = voltage * CAL_FACTOR;     sum_sq += current * current;     delayMicroseconds(100);  // 10kHz sampling   }   return sqrt(sum_sq / samples); }  float measurePower(int v_channel, int i_channel, int samples = 500) {   float sum_p = 0;   for(int i = 0; i < samples; i++) {     float v = (ads.readADC_SingleEnded(v_channel) * 0.0001875 - VREF) * 230;  // Scale to 230V     float cur = (ads.readADC_SingleEnded(i_channel) * 0.0001875 - VREF) * CAL_FACTOR;     sum_p += v * cur;     delayMicroseconds(100);   }   return sum_p / samples;  // True power in Watts }  void setup() {   Serial.begin(115200);   ads.setGain(GAIN_TWOTHIRDS); // ±6.144V range for ADS1115   ads.begin(); }  void loop() {   float I1 = measureRMS(0);  // Circuit 1 current   float I2 = measureRMS(1);  // Circuit 2 current   float P  = measurePower(2, 0);  // True power (circuit 1)   float S  = 230 * I1;            // Apparent power   float PF = abs(P) / S;          // Power factor    // Transmit as JSON to Raspberry Pi   Serial.print("{\"I1\":"); Serial.print(I1, 2);   Serial.print(",\"I2\":"); Serial.print(I2, 2);   Serial.print(",\"P\":"); Serial.print(P, 1);   Serial.print(",\"PF\":"); Serial.print(PF, 3);   Serial.println("}");   delay(1000); }

Testing & Troubleshooting

Test Building Energy Monitoring System by verifying each subsystem individually before full integration.

!
Troubleshooting Tips

Verify power voltages, check ground connections, use serial monitor for debug.

Real-World Applications

*Commercial building energy management
*Industrial facility energy audit
*Hospital critical power monitoring
*Data center power usage effectiveness (PUE)
*Smart home energy awareness
*Utility demand response program
*Solar-grid energy balance monitoring
*EV charging load management

Extensions & Next Steps

  • Integrate with solar generation monitoring for net energy tracking
  • Add weather correlation to separate weather from behavioral energy changes
  • Build automated load shedding for peak demand management
  • Implement digital twin of building energy model for optimization
  • Add thermal comfort sensors to correlate HVAC usage with comfort

Interactive Playground

Coming Soon

An interactive simulator will be available here — simulate circuits and run code in-browser without hardware.

Frequently Asked Questions

How much energy can a building monitoring system typically save?
Building energy monitoring without action: 0% savings. Monitoring with awareness and manual action: 5–15% reduction (identify wasted standby power, peak demand reduction, equipment scheduling). Automated demand response integration: 10–20% reduction (automatically reduce non-critical loads during peak tariff hours). Combined monitoring + optimization + occupancy integration: 20–35% reduction commonly reported in commercial buildings. ROI: monitoring equipment cost Rs 20,000–50,000 for a commercial building, annual savings Rs 50,000–200,000 → payback 3–6 months.
Advertisement