This document describes a software and hardware solution using the STM32x microcontroller and the STPM01 power meter for measuring mains power consumption, and provides hardware and firmware guidelines to interface the STPM01 with the STM32x microcontroller.