3-Ø Energy Meter
The MCP3903 samples all the 6 channels simultaneously and converts them to 24-bit values. The sampling frequency is 500 Samples/sec. This translates to a datarate of 500*6*24 Bits/sec. The data is read-out using the implemented software SPI block in the MCU.
The front-end of the meter is made up of three pairs of voltage and current input networks. Each of the three line voltages is attenuated by a resistor divider and filtered through identical first order low pass filters.The current channels signals are converted from current to a voltage through current transformers and burden resistors. The voltage developed across these resistors are read out by the ADC.
B. Analog to Digital Conversion This meter design uses Microchip's MCP3903 energy meter ICs. Small-signal inputs can be amplified by the programmable gain amplifier inside the MCP3903 device. Currently gain is set as 1. The MCP3903 device's clock is provided by a 3.3768 MHz active crystal. The MCP3903 device's output data rate is 96Kbps.
B. Communication Protocol Used The MCP3903 communicate with other devices using SPI. It is configured as a slave and Address based register reads can be done.
SPI Implementation A software SPI was implemented in C. This was used to configure the slave ADC and read its registers. The TIMER0 peripheral generates the SPI CLK and GPIO write and read was used for MOSI and MISO respectively. The CS pin was made low for the entire communication duration. The SPI CLK oscillates at 125KHz.
Sampling The sampling rate was fixed at 500 Samples/sec. We need to sample every 2ms. This was achieved by TIMER1 interrupts. Every time an interrupt request was issued, a command was given to invoke 6 reads from MCP3903.
-> This implementation requires that the TIMER0 interrupt needs to have a higher priority compared to TIMER1.
Energy Calculation A function Start_Calculation() was invoked which samples 100 samples each for the 6 channels. The corresponding currents and voltages are multiplied for each sample and the average of all the samples gives the average power.
The energy consumption is the cumulative sum of the above average power scaled by a time factor.
This cycle repeats.
The currents and voltage values were calibrated. The final Energy reading was displayed in the UART interface.
 MCP3903 Datasheet- www.microchip.com/downloads/en/DeviceDoc/25048B.pdf
 SPI Bus Documentation- en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
 Joseph Yiu- The Definitive Guide to the ARM Cortex-M3