E-Design 314 Project - Building a Smart Prepaid Energy Controller
Managing energy consumption shouldn't be a headache. For my latest E-Design 314 project at Stellenbosch University, I tackled this challenge by designing and building a Smart Prepaid Energy Controller from the ground up. The goal was simple but ambitious: create a device that accurately measures electricity usage, handles secure RFID authentication, and allows for real-time load control.
The Hardware Stack

The project was based on the provided STM32 Nucleo-G0B1RE micro controller with plenty of peripherals for all the necessary functionality. Firstly a stable 5V and 3.3V regulated supply was implemented to provide power to the STM and other components on the board. Custom gain and offset op-amp circuits were designed to condition the mains voltage and current signals for the 12-bit ADC.


Additionally a small SSD1306 OLED interfacing over I2C and a matrix keypad was implemented for the user interface. Futhermore, storage was handled by a SD card interfaced with via SPI and authentication was implemented with a generic SPI RFID reader.
Software

Due to resource constraints on the STM board, efficiency was key. I utilized Direct Memory Access (DMA) to handle high-speed sampling without bogging down the CPU.

Furthermore the system had to be accurate, by implementing linear calibration where I managed to bring the sampling measurement accuracy within a 0.5% margin, good enough for for reliable energy billing.

The system had to also measure the phase between the voltage and current for further accurate reactive power and power factor calculations yielding the following results:

The Result
After some late nights in the lab (and solving a tricky EMI issue with the RFID coil and analogue circuits) the final board pulled a maximum of 198.9mA, proving to be both efficient and robust. It’s been a massive learning curve in signal integrity and embedded integration, and I’m stoked with how the final prototype turned out!