Design of Real-time Electricity Prices and Wireless Communication Smart Meter

Under the background of smart grid’s real-time electricity prices theory, a real-time electricity prices and wireless communication smart meter was designed. The metering chip collects power consumption information. The real-time clock chip records current time. The communication between smart meter and system master station is achieved by the wireless communication module. The “freescale” micro controller unit displays power consumption information on screen. And the meter feedbacks the power consumption information to the system master station with time-scale and real-time electricity prices. It results that the information exchange between users and suppers can be realized by the smart meter. It fully reflects the demanding for communication of smart grid.


Introduction
The idealized load requirements play a significant role in energy saving and low-carbon economy.The smart electricity's guiding ideology is using the informatization means, price leverage and interactive strategies to mobilize the power users to participate in demand-side's response and idealize the load requirements [1,2].An important process in the China's smart grid development is real time pricing release [3][4][5][6].So the smart grid requires advanced metering system to achieve real-time interactive communications [7][8][9].Against this background and according to the literature [10], this paper design a smart meter based on the wireless two-way communication to achieve real-time electricity prices.
The smart meter is defined in "Functional specification for smart Watt-hour meter" as "An energy meter can display, storage and output data, be made up of measuring unit and data processing unit, not only can measure active and reactive electric energy, but also has two or more functions like time-sharing and measure the required amount (average power within a specified time)".In this paper, the design of smart meters has the following features: a) Calculates the active and reactive electric energy, analysis capabilities of the fundamental active power, fundamental reactive power, harmonic active power and harmonic reactive power, input via the keyboard and displayed on the display.b) Information will store in the MCU (micro controller unit) to record the user's power utility information at any time.
c) Perform wireless communication with the system master station to upload users' power consumption information, and receive real time price information and command issued by system master station [11].
d) Interrupted by the real-time clock chip, summarize the user's power consumption information and cost each month

Hardware Structure
This paper will take 0.38 KV low voltage three-phase four-wire grid system as example.The system hardware structure is shown in Figure 1.
Systems and smart meters are isolated by voltage transformer and current transformer.Energy metering chip (ATT7022B) collects date and communicates with MCU (Freescale MCS12DG128) by SPI bus.MCU get the real-time from the real-time chip (RX-8025SA) by I 2 C bus and store the date collected by Energy metering chip in the MCU Flash E 2 PROM.Flash E 2 PROM's capacity is 256 K byte and it meets the information storage's requirements.Then these data will sent to the system master station by RS-232 serial port via a wireless module (model for XL05-232AP2).And it will also accept the command issued by system master station.Users can query the current electricity prices, costs and other information through the keyboard, and displayed on the screen.

Configuration Diagram of Each Module
1) Energy metering module Energy metering chip select ATT7022B.It is a high precision, strong function, multi-functional, anti-tampering energy metering chip.It's applicable to Three-phase four-wire system and is communicating with MCU through the SPI interface.It's able to measure each phase's information including active power, reactive power and apparent power in fundamental, harmonics and full-wave.While it can measuring frequency, current and voltage RMS, power factor and phase angle.It reaches the three-phase multifunction energy meter's standard.
The ATT7022B integrates 16-bit AD converter and the current channel valid values' linearity error is less than 0.5% when it's in the range of 2 mV to 1 V. Meanwhile the voltage channel valid values' linearity error is less than 0.5%when it's in the range of 10 mV to 1 V.Each ADC's AC signal is inputted by pin V x P and V x N (x represents 1, 2 ... 7).At the same time V x P and V x N must be superimposed 2.4 V DC bias voltages.The bias voltage REFO is provided by an external reference voltage.
The energy metering chip and MCU hardware connection diagram is shown in Figure 2.
Primary system's voltage and current transform by the transformer and be sampled by the three-phase metering chip then input differentially.The 1.2 K resistor and 0.01 uF capacitors constitute an anti-aliasing filter in VxP and VxN's input circuit.Its structure and parameters must be symmetry and take good temperature performance components to ensure obtain good temperature characteristics.Measurement chip power in +5 V and SCK pin provides synchronous clock signal.The /CS pin transports chip select signals, which are passed in MOSI and MISO lines.
2) Real-time Clock Module The real-time clock chip is power in + 5 V, and highprecision 32.768 kHz crystal oscillator is internal, corresponds to the I 2 C-BUS's high-speed mode (400 kHz).The chip's year, month, day, week, hour, minute, second are respectively expressed as BCD code, and Transmit fixed-cycle interrupt instruction to the MCU.
In this paper, MCU collect power utility information and received real time price from system master station, then stored in the MCU's Flash EEPROM with the real-time clock chip's read-out time.Thus, the information stored in the memory with a time scale and the users query conveniently through the keyboard.Then the clock chip interrupts the MCU's IRQ pin per month (assuming on the 1st).After interrupt MCU aggregate the power consumption and electricity prices and sent them to the host through the wireless.3) The wireless communication module Wireless communication module function as an intermediary for smart meters to exchange data with the master system.MCU and the wireless communication module are connected as shown in Figure 4.
The MCU and wireless module are isolated by the optocoupler isolation device, to avoid interference by serial communication.The wireless module's model is XL05-232AP2, and it is an UART interface, half-duplex wireless transmission module.It works in the 433 MHz public band, in line with European ETSI standards (EN300-220-1 and EN301-439-3) and meets the wireless control requirements.We don't need to apply frequency usage license.The module's serial rate is 1200 bps, data format is 8 N1, transmission distance is 6000 m and it is power in + 5 V.It is suitable for a small amount of data, low-rate, long-distance communication, to meet the smart meters and the master system's wireless communication requirement.In the master system configured the same type of wireless modules, you can form a many-to-one communication mode.

4) Keyboard and screen
The keyboard is composed by a 3 × 3 keys matrix and is connected to the MCU by 6 data line.The screen is the YB12864-Z LCD display module, integrated a ST7920 controller and its operating voltage is +5 V.The LCD controller integrated the character base.Characters can be written directly in the program and the lengthy code conversed from matrix Printer software do not need any more.The screen mainly completes the task of display energy information and real-time tariff.
Keyboard and display hardware is shown in Figure 5.

5) Power Management Module
The design of the power circuit is particularly important to the smart meters performance.The VCC (Volt Current Condenser)'s operating voltage must be stable at +5 V 5% (All devices operating voltage are + 5 V).supply REFO reference potential in the way of resistive voltage division.By adjusting the variable resistor R 2 we can get + 2.4 V power.

The Main Program
Figure 7 is the main program flow.Initialization include the MCU pin state initialization, AD, RS-232, I 2 C bus, SPI bus initialization, the real-time clock's initial value settings, energy metering chip initialization and display chip initialization and so on.Procedures and working principles are described below.

1) Energy metering program design
The ATT7022B's SPI communication Format is 8-bit address, 24-bit data, MSB in the front, LSB in the back, when each register read and write one time, CS need action one time.SCLK is low at the beginning of commu-nication and CS change low from high.After 32 clock pulses, SCLK and CS change from low to high, a register read or write operation is done.The ATT7022B takes the data sent by microcontroller from the DIN line on the falling edge of the clock signal, and sends data to microcontroller from the DOUT line on the clock signal's rising edge.
The ATT7022B can read all measured values from the measurement parameter register and do three times data updates per second.These parameters are each phase's and split phase's power, fundamental's, harmonics' and full-wave's active power, reactive power, apparent power, power factor, phase angle, voltage angle, the loss of pressure detection, frequency and temperature, etc.Because the measured quantities are so many, we must organize and storage the data metered, processed and recorded reasonable to check easily [12].
2 fixed cycle interrupt at the same time.On the 1st of the month a falling edge transition occurs to the MCU's /IRQ pin.The MCU receives interrupt instruction, then sent the power consumption information aggregation and cost statistics to the System Master.
3) Design of wireless communication procedures Wireless receive mode is set to receiver through the serial port interrupt.When the system master sent data through the wireless module (including commands and real-time price), the register R 1 is set to enter the interrupt response and the SBUF register receive data in predefined format.Then MCU will read the real-time clock module's time, store received information and time information in the MCU's Flash E 2 PROM.The MCU needs to send the acquired information to the System Master via wireless after executing the program so that the Master can always monitor the energy meter's status and users' power consumption information.The data received by smart meters or the System Master will automatically re-send to the transmission side.The sender will compare the received data and the previously transmitted data.Only exactly the same the data is considered successfully sent, otherwise it will re-send the data.
4) Keyboard and display program design Action of the 9 keys on the keyboard will cause the PortM0 to PortM5's potential changes and MCU will respond accordingly MCU control YB12864-Z LCD display module through 8 data lines and 4 control lines.Under normal circumstances, the LCD module's backlight is turned off.Its backlight will turn on when keys are operated, and the screen shows relevant information.

5) Alarm processing
The Alarm includes side voltage power failure alarm and the frequency alarm.Metering chip's internal voltage detection circuit will judge whether the A, B, C threephase are power failure according to the set threshold voltage.It will be represented by Bit0/1/2 of state flag register (Sflag).When a phase loss of power, the corresponding flag bit become 1.Take B phase for example, if the B phase loss of power, the Sflag's Bit0/1/2 will change into 010(B) and send the abnormal information to the System Master through the wireless module.The frequency alarm begin to work if the metering chip detects the frequency fluctuation is over 50HZ 5%.

Figure 1 .Figure 2 .
Figure 1.The structure diagram of system hardware.

Figure 6 Figure 3 .
Figure 3.The hardware design of real-time clock.

Figure 7 .
Figure 7.The main program flow.