Designing a Smart Meter Interface with Sub 1 GHz Wireless
Contributed By Digi-Key's European Editors
The smart meter is at the heart of creating the smart home. Being able to measure the overall power usage by the home and feed that data back to the utility is a key element in managing the load on the utility grid and ultimately reducing bills for the consumer.
Adding wireless connectivity to an electricity meter is relatively straightforward with the latest RF modules. These provide all the RF connectivity that is certified for use in a particular geography. However, these modules need to be connected to the meter to get the data directly, or to the sensors that are picking up the current consumption. This can be done relatively easily with a low-cost 8-bit microcontroller.
Using the unregulated sub 1 GHz frequency band has a number of advantages for a smart meter design. The lower frequencies carry lower data rates for longer distances, giving the system designer significant advantages. A smart meter only needs to send out small amounts of data a few times a day, so the data rate is low. This allows a much longer range to be used and is very different from protocols such as ZigBee that can carry more data at 2.4 GHz. Using the sub 1 GHz bands also avoids potential interference from 2.4 GHz sources such as Wi-Fi, Bluetooth, and microwave ovens, and this further reduces the power needed to establish a reliable wireless link.
The latest RF chips from Texas Instruments have been demonstrated to carry low rates of data (a few kbyte/s) over distances of up to 10 km at these lower frequencies. This has two advantages: more devices can be connected to a single hub or concentrator, or the power consumption of the RF transceiver can be reduced dramatically. This allows the system architect to optimize the balance of power consumption and reach. For example, several streets of houses could be connected via a sub-1 GHz link to a concentrator in the street, avoiding the need for broadband hubs in every home.
Modules support different wireless network topologies such as point-to-point, point-to-multipoint, peer-to-peer, and mesh networks depending on the system architecture. Mesh networks allow neighboring units to link together and carry data, greatly extending the reach. This hits the data rate, but for a smart meter network, the reach is far more important to saving costs than the data rate and there is plenty of headroom to support mesh networking.
The A1101R04C from Anaren is a good example of a sub 1 GHz RF module that can be used for a smart meter design, integrating the crystal, internal voltage regulator, matching circuitry, and filtering into a surface-mount design that can be easily mounted on a board.
The 9 x 12 x 2.5 mm module uses an external antenna through a U.FL connector for the European band of 433.05 to 434.79 MHz, is ideal for achieving low-power wireless connectivity without having to deal with extensive RF design and regulatory compliance, and provides quick time to market.
Figure 1: The A1101R04C sub 1 GHz RF module.
The modules are 100% tested to provide consistent performance and the modular approval allows the OEM to place the module with an approved antenna inside a finished product without having to perform costly regulatory testing for an intentional radiator.
For applications such as a smart meter where the unit is installed in the home, an omnidirectional antenna pattern allows the unit to work equally well in any direction. Similarly for peer-to-peer or point-to-multipoint applications, an omnidirectional pattern is desired so all nodes have a fair chance of communicating. The A1101R04C has an approved near-omnidirectional monopole antenna, but it is important to note that the end radiation pattern depends not only on the antenna, but also on the ground plane, enclosure and installation environment.
Antenna matching provides the correct loading of the transmit amplifier to achieve the highest output power, as well as the correct loading, for the receiving low noise amplifier (LNA) to achieve the best sensitivity and desired range. Power management in the module ensures a stable supply for the internal functions, as well as providing means for a low-power sleep mode (in which case, most of the transceiver is powered off).
The physical layer provides conversions between data, symbol, and RF signal while the MAC layer is part of the Logical Link Layer and provides frame handling, addressing and medium access services. The registers and commands for both the physical and MAC layers are exposed to the microcontroller via the SPI serial interface, and this can be handled by an 8-bit microcontroller such as the Microchip PIC12. Details of how the PIC12 is used and how the SPI interface is implemented are discussed in detail below.
The physical and MAC layer functionality are accessed via the SPI bus through addressable registers as well as execution commands. Data received or to be transmitted are also accessed through the SPI bus and are implemented as a FIFO register (64 bytes each for Tx and Rx).
To transmit, a frame of data is placed in the FIFO; this may include a destination address. A transmit command is given, which will transmit the data according to the initial setup of the registers. To receive data, a receive command is given, which enables the unit to “listen” for a transmission, and when one occurs, put the received frame in the FIFO. When neither transmit nor receive is required, the device can enter either an idle mode, from which it can quickly reenter receive or transmit mode, or a low-power sleep mode, from which a crystal startup is also required prior to transmit or receive operation.
Using the module
The module is based on the CC1101 transceiver IC from Texas Instruments. All the control lines for the transceiver are provided at module level for full control of its operation.
Figure 2: The CC1101 transceiver in the A1101R04C sub 1 GHz RF module.
After initial setup of registers, the module can be run in several different ways. For applications of infrequent data transmissions the transceiver would be in “sleep” mode to save power (200 nA). From there it would awaken and then enter “idle” mode. As part of the wake-up process, the crystal oscillator is started (approx. 240 μs) and the microcontroller interface is powered up. Before transmit or receive, the frequency synthesizer needs to be started (“FS_Wakeup”) and, having been powered off (or idle for a while), the control loop of the VCO/PLL needs to be calibrated.
A data frame is loaded into the transmit FIFO and the TX mode is entered. The transceiver will transmit the data and enter “idle” mode after completion. When transmit is complete, RX mode is entered to wait for the acknowledge frame. Once a frame is received, the transceiver will again enter “idle” mode. If no acknowledge frame is received within a given timeout, the data frame would be re-transmitted. If the acknowledge frame indicates that the data was received, the next data frame will be transmitted. After the last data frame has been transmitted successfully, the transceiver will again be put in “sleep” mode.
In order to comply with the output power limitations in Europe, the maximum output power is 10 mW (10 dBm) if the module operates on a 10% Duty Cycle. If 100% Duty Cycle, full-time operation is desired, then the output power should be limited to 1 mW (0 dBm) for the signals with less than 250 kHz bandwidth and -13 dBm/10 kHz for the signals of greater than 250 kHz.
It is important to note that the output power of the module changes with ambient temperature. To obtain the best possible range and at the same time maintain certification compliance, it is possible to trim the output power as a function of temperature to maintain an approximate constant output power over temperature. If temperature dependent control is not implemented, the user must use the lowest power value for all temperatures in order to maintain power within certification limits.
Interfacing to the smart meter
The link between the module and the rest of the system is the SPI serial, and this can be handled by a relatively simple microcontroller such as the Microchip PIC12. This can take data from the meter if it is already digital, or use the integrated analog-to-digital converter to convert a signal from a Hall-Effect current sensor such as the Melexis MLX91205 or the Allegro Microsystems ACS711. These can take the measurement of the power directly from an existing meter system.
The PIC12 uses an enhanced mid-range 8-bit CPU core with forty-nine instructions, interrupt capability with automatic context saving and a sixteen-level hardware stack with Overflow and Underflow Reset capability. To help with the flexibility of coding, Direct, Indirect, and Relative Addressing modes are available, and two File Select Registers (FSRs) provide the ability to read program and data memory.
Figure 3: The PIC12 microcontroller showing the SPI interface for linking to the RF module, and the analog-to-digital interface block for linking to external devices such as Hall-Effect current sensors.
The SPI interface is the key to connecting the RF module to the rest of the system. This synchronous protocol allows a master device to initiate communication with a slave device to exchange data. It is implemented in the PICmicro MCU by a hardware module called the Synchronous Serial Port or the Master Synchronous Serial Port. This module allows serial communication between two or more devices at a high speed and is reasonably easy to implement.
Figure 4: The core of the PIC12 microcontroller showing the SSP and MSSP modules.
The clock signal is provided by the master to provide synchronization and controls when data can change and when it is valid for reading. As SPI is synchronous, it has a clock pulse along with the data, making it different than RS-232 and other asynchronous protocols that do not use a clock pulse, and so require accurate timing. This means the clock can vary without disrupting the data as the data rate will simply change along with the changes in the clock rate. This makes SPI ideal when the microcontroller is being clocked imprecisely, such as by a low-cost RC oscillator.
When data is transmitted, the incoming data must be read before attempting to transmit again. If the incoming data is not read, then the data will be lost and the SPI module may become disabled as a result. Always read the data after a transfer has taken place, even if the data has no use in the application. Each device has two data lines, one for input and one for output, but data is always exchanged between SPI devices - no device can just be a “transmitter” or just a “receiver”. These data exchanges are controlled by the clock line, SCK, which is controlled by the master device. Data typically changes during the rising or falling edge of SCK.
Often a slave select signal will control when a device is accessed. This signal must be used for when more than one slave exists in a system, but can be optional when only one slave exists in the circuit. This Slave Select (SS) signal indicates to a slave that the master wishes to start an SPI data exchange between that slave device and itself. The signal is most often active low, so a low on this line will indicate the SPI is active, while a high will signal inactivity. It is often used to improve noise immunity of the system. Its function is to reset the SPI slave so that it is ready to receive the next byte.
The SSP or MSSP controller module allows SPI or I²C to be implemented. The “M” in MSSP stands for “Master” and relates to how it handles I²C data so it does not affect its SPI performance, so either a MSSP or SSP module can be used for SPI.
The SSPSR is the shift register for the SPI module, shifting data in and out of the device. The data travels in a loop to the next shift register, shifted out of the SDO pin of the PIC12 and into the SDI pin of the RF module. Once a byte of data has been exchanged between the two devices, it is copied to the SSPBUF register. The SSPBUF is then read by the user software.
The usage date from the meter is written into the SSPBUF by the user code, and is then automatically transferred to the SSPSR.
With the PIC as the master, this process will initiate the data transfer. The slave select signal is activated by being brought low to initiate an SPI transfer, returning to a high state once the one byte transfer has been made.
The sub 1 GHz unlicensed band is opening up opportunities for low-cost, low-power links for smart meters. Avoiding the interference of the 2.4 GHz band, along with greater penetration, allows longer range and lower power consumption, both contributing to a lower system cost. With pre-approved RF modules, these wireless links can be easily added to electricity meter designs. A low-cost, simple microcontroller can then be used to handle the SPI interface between the module and the rest of the meter, as well as to other sensors. All of these combine to provide a rugged, reliable system design for the smart grid.
Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.