Introduction: Smart Home Energy Monitoring & Management System

Picture of Smart Home Energy Monitoring & Management System

Consumer electronics, office equipment and other plug loads consume 15 to 20 percent of total residential and commercial electricity while not in primary mode. Much of this energy is consumed when these devices operate in low-power modes but are not actually in use. One way to reduce this unnecessary electricity consumption is to use a smart energy management system.

The main goal of our project “Smart home energy monitoring and management system” is to develop a system such that it will be capable to keep a track of each and every appliance in the home and the user will be able to acquire all appliance energy consumption parameters. Along with this, the energy consumption parameters of each individual appliance will be sent to gateway where an intelligent algorithm will be running to manage all the appliances as per user requirements. The user can monitor the energy parameters of each individual load using an android smartphone which will also work as a data setter to set various user programmable parameters like high/low cut-off voltage, etc.

By automatically turning off loads when not in use, the system can provide energy savings in homes and offices. Applications for this system include workstations, open office cubicles, home offices, and home entertainment systems.

Step 1: Analysis of Project Scope

Introduction

In light of the increasing cost of electricity and the Global Warming campaigns to reduce general electricity usage, there is a growing interest in analyzing power consumption in households. By analyzing the electricity usage of each individual appliance separately, more accurate conclusions can be drawn on their efficiency and need for replacement. Furthermore this can also determine whether an appliance is drawing unusually high amounts of power when turned off and whether it should rather be unplugged. In this way electricity consumption and cost can be reduced.

Problem Statement

Most conventional prepaid power meters currently installed in households only display the total real time usage of its power and the amount of electricity available. There is no way to see what the day’s, week’s or month’s consumption was on these meters and often these power meters are placed in an inconvenient location which makes regular viewing somewhat difficult. These power meters also lack the ability to monitor appliances individually; thus hiding vital information about individual appliances.

Project Objectives and Scope

A Smart Meter System is required which can analyze multiple appliances in a household getting readings such as voltage, current, active power, apparent power, reactive power, power factor and frequency. With the help of a wired / wireless connection, the device can connect to a central gateway and the gathered information can be uploaded and processed by the gateway management system. The data can then be displayed on the platform’s graphical android-based user interface. The platform allows users to access the data from any android enabled device. To reduce cost the system requires energy metering nodes that can communicate with the gateway wirelessly or in wired way in such a way that only one Wi-Fi access point is needed for a household containing many monitored appliances. Furthermore it is required that the current information regarding the appliances can also be viewed on a local display with a menu interface. The remote energy metering node will be considered to be successful if the following criteria are met:

• Wired/wireless communication between nodes and gateway

• Correct measurements of Voltage, Current and Power

• A working user interface on the gateway with a display and menu

• Reliable wired/wireless communication between gateway and remote meter nodes.

If time permits, the following additional features may be added so as to improve the project, keeping in mind that omission of these features will not affect operation:

• Building safe mechanical structure to package the gateway station

• Building safe mechanical structure to isolate the energy metering nodes

• To increase power efficiency of the device and to minimize power usage when appliance is turned off

Definition of Smart Meter and Smart Meter Systems

Smart Meters are electronic measurement devices used by utilities to communicate information for billing customers and operating their electric systems. For over fifteen years electronic meters, have been used effectively by utilities in delivering accurate billing data for at least a portion of their customer base.

Initially, the use of this technology was applied to commercial and industrial customers due to the need for more sophisticated rates and more granular billing data requirements. The use of electronic meters came into service to the largest customers of the utility and over time gradually expanded to all customer classes. This migration was made possible by decreasing cost of the technology and advanced billing requirements for all customer classes. The combination of the electronic meters with two-way communications technology for information, monitor, and control is commonly referred to as Advanced Metering infrastructure (AMI). Previous systems, which utilized one-way communications to collect meter data, were referred to as AMR (Automated Meter Reading) Systems. AMI has developed over time, from its roots as a metering reading substitute(AMR) to today’s two-way communication and data system.

Although the Smart Meters are relatively new to the utility industry, they are treated with the same due diligence and scrutiny associated with electronic meters and older electromechanical counterparts. These meters have always met or exceeded national standards such as American National Standards Institute (ANSI) C12.1 for meter accuracy and design. In addition, equipment used to certify meter performance must be traceable to the National Institute of Standards and Technologies (NIST), a federal agency that works with industry to properly apply technology and measurements. Other standards in use for the Smart Meter installations include National Electric Code (NEC) for home electrical wiring, National Electrical Manufacturers Association (NEMA) and Underwriters Laboratories (UL) for enclosures and devices, and National Electric Safety Code (NESC) for utility wiring. Through the leadership of utility metering professionals and metering manufacturers, the meticulous and deliberate development of these solid state electronic measurement devices has resulted in meter products that have advanced functionality, are stable and have tighter accuracy tolerances, and are more cost effective for advanced features than the legacy electro mechanical technologies.

Step 2: Introduction to System Design

Picture of Introduction to System Design

The system consists of three main parts. The Gateway, the energy nodes, and an android application interface. Figure 1 below shows how these parts all interact with each other.

Energy metering node

The energy node unit has the task of taking power measurements when requested and sending them then to the gateway. It waits for a request from the gateway via UART (a wired connection). When a request is received it reads the measurements from the EMIC and then sends this information back to the gateway.

Gateway Unit

The gateway is responsible for collecting data and then sending it to the android application interface. It also has a console access that can show all the relevant information along with a small interface. The requests information from the energy node via wired communication. The energy node then sends the information back to the gateway. The gateway then forwards this information on to the android application interface. This process happens in regular intervals which can be set in the menu interface. Because the gateway and the energy nodes are separate a single system can comprise of many energy nodes. The advantage of this is that the cost to monitor another additional appliance is low because only the energy node needs to be purchased.

Android application interface

An android application is designed which is responsible for reading the gateway for each energy node connected and is also responsible for setting various gateway configurations and parameters like various thresholds, etc.

Step 3: Energy Node Design Introduction

Picture of Energy Node Design Introduction

The energy node unit is responsible for reading the measurements of the EMIC and relaying this information once requested from the gateway. The energy node unit is composed of three main parts – the energy measurement IC itself, the sensing circuit and the isolation circuit. The energy node was designed in such a way that it can be connected directly to the Base Station with wires to operate as a standalone system.

Energy Measurement frontend (EMIC)

The CS5490 from cirrus logic is used as the frontend for the energy measurement. From the literature review it was clear that an easy way to measure power was to use an EMIC as no further calculations are needed and nothing else needs to be taken into consideration. An EMIC only needs to be set up and calibrated and then the registers can be read to get the relevant information. There were a few EMICs under consideration such as the MCP3903 from microchip. It uses SPI communication with a total of 8 pins dedicated to communication (SCK, SDO, SDI, CS, Reset and 3 data ready lines). Most EMICs used SPI communication. However the one logic chip that stood out was the CS5490 from CIRRUS LOGIC. It uses UART for communication and seems to be more powerful than other EMICs. Some of the features that this IC has are:

• Energy Measurement Accuracy of 0.1%

• Supports Shunt Resistor and CT

• On-chip Measurements/Calculations:

– Active, Reactive, and Apparent Power

– RMS Voltage and Current

– Power Factor and Line Frequency

– Instantaneous Voltage, Current, and Power

• Over current, Voltage Sag, and Voltage Swell Detection

• Ultra-fast On-chip Digital Calibration

• UART Serial Interface

• On-chip Temperature Sensor

• Single 3.3 V Power Supply

• Low Power Consumption: 13 mW

The CS5490 incorporates independent 4th order Delta-Sigma analog-to-digital converters for both channel, reference circuitry, and the proven EXL signal processing core to provide active, reactive, and apparent energy measurement. In addition, RMS and power factor calculations are available. Calculations are output via a configurable energy pulse, or direct UART serial access to on-chip registers. Instantaneous current, voltage, and power measurements are also available over the serial port. The two-wire UART minimizes the cost of isolation where required.

The CS5940 only requires 3 pins in total Rx,Tx and Reset. EMICs are generally connected to mains to get the voltage readings and as such there is a need to isolate the IC from the microprocessor communicating with it. Optocouplers were used in this project to establish an isolated connection between the gateway (Beaglebone black) and the IC. The optocoupler can isolate two circuits from each other as it transmits the data using light and it has a light sensitive transistor all housed in a small package. Conveniently this also operates as a level shifter as the Beaglebone black operates at 3.3V and some parts at 5V logic and the energy metering IC only at 3.3V logic solving two problems with one device.

A configurable digital output provides energy pulses, zero-crossing, energy direction, or interrupts functions. Interrupts can be generated for a variety of conditions including voltage sag or swell, over current, and more. On-chip register integrity is assured via checksum and write protection. The CS5490 is designed to interface to a variety of voltage and current sensors, including shunt resistors, current transformers, and Rogowski coils.

The EMIC does require some circuitry to do the measurements. For Voltage measurement a voltage divider was used between the two lines and for current measurement a shunt resistor was used. The IC can take a maximum of 250mV peak to peak on both the voltage measurement and current measurement inputs so the CT or Shunt Resistor, and voltage dividers must be chosen in such a manner that the maximum values will never be reached otherwise the IC can break.

Step 4: Energy Node Circuit Description

Picture of Energy Node Circuit Description

A shunt resistor was chosen as it is more stable than a Hall Effect sensor and smaller than a Current Transformer. The shunt resistor had to be in a range in that if maximum allowable current is drawn from a device the voltage drop over the shunt resistor is less than 250mV peak to peak as this is the EMICs max current voltage input.

Vmax = Imax * Rshunt

Thus, Rshunt = Vmax / Imax

Choosing Imax as 17A and Vmax as 250mV it follows

R = 10 mΩ

So a shunt resistor that is smaller equal to 10mΩ will be used here. The EMIC has an internal adjustable gain of 50x so that a smaller shunt resistor can be used which also has the benefit of less power dissipation on the resistor.

The high-voltage AC line is attenuated using a voltage divider sensor comprised of 1.76Mohm and a 1Kohm resistor before being supplied to the CS5490 voltage channel input. The divider ratio is determined by the maximum input range of the CS5490 voltage channel (176mVRMS) and the maximum line voltage. The division ratio is determined by Equation below.

Vout = Vin * (R2 / (R1+R2)) < 176mV RMS

For a line voltage, Vin = 260 Vrms, and R2 = 1K, R1 can be solved. See Equation below:

R1 = [1000 * {(260V / 176mV) – 1 }] = 1.47Mohm

To give a 120% margin and to select common resistor values, R1 = 120% * 1.47M = 1.76Mohm resistor is selected. The voltage sense resistor (R2) must be referenced to the same potential as the current sensor and CS5490 power supply (located either on the Line or Neutral).

The microprocessor and relay circuit has a logic level of 3.3V and 5V whereas the EMIC has a 3.3V logic level and as such a level shifter is needed. Furthermore the energy metering IC is connected to the mains however it has to have the microprocessor chip isolated from the mains because the noise from the mains can damage the microprocessor and especially the reliability of the other components. So there is a need for a device that can do both isolation and level shifting. Fortunately an optocoupler can do precisely this. A light source in the optocoupler is switched on when a signal is transmitted to it. This light source activates a transistor connecting both ends on the receiving side. The choice of optocoupler was mainly due to availability and size. Another important factor was the rise and fall time of transferring the signal across the optocoupler.

The EMIC is set up to have a default baud rate of 600. Because the baud rate is so low, optocouplers can be in the microsecond range. The optocoupler for this project was the MCT2E; it has rise and fall times of 3 and 4 us respectively and as such it is acceptable to communicate reliably at a baud rate of 600. It was also chosen as it was easily available and had a small package with only 6 pins.

Step 5: EMIC Calibration, Scaling and Compensation

Picture of EMIC Calibration, Scaling and Compensation

Energy meters are part of electricity distribution networks, which measure electricity consumption. Usage of the energy meter in the electricity distribution network requires the energy meters to be adaptable to various configurations. This depends on the part of the distribution network and the type of end consumer for which the energy meters are installed. These configurations include a wide range of voltage and current, across which the meter should be functional, as per the specifications. The above requirements demand the metering engine to be adaptable, so that the transducers converting the input signal are selectable, depending on the specification, while still recording the actual values of the input line signal.

The meter design is comprised of many components, which may vary in their characteristics due to the various factors across the meter design. The components that form part of the circuitry include:

• Current Transformer (CT) or Shunt used as a current transducer

• Resistive voltage divider as voltage transducer

• Resistors

• Capacitors

• Inductors

These variations in characteristics have an impact on measured signals, which may

result in offset addition, amplitude alteration and change in signal phase. Considering all the above factors, the standard value calibration needs to be carried out to achieve meter output. Calibration is the process where the line parameters are set to known values and the various signal conditioning parameters such as gain, offset compensation, and phase compensation factors are calculated.

Calibration is self-contained within the CS5490, and all calculations are performed by the device and stored in internal registers. Compensations require that the MCU perform some of the calculations and then store the results back into the CS5490 registers. Since the CS5490 does not have non-volatile memory (NVM), permanent storage of calibration and compensation must be placed in the MCU NVM and re- loaded after any AFE reset condition. In general, each calibration and compensation requires the following steps:

• 1. Configure the CS5490 initial conditions

• 2. Apply the analog input with stimulus from an accurate source

• 3. Enable the desired calibration

• 4. Execute calibration

• 5. Read the results

• 6. Calculate the new register values for compensations

• 7. Store the results in the AFE and NVM

It is common to perform calibration and compensation simultaneously. For example, since an AC gain calibration and phase compensation require a similar input signal to be applied to the current and voltage channels, calibration and compensation are performed simultaneously.

1. Normal Operation Procedure (Performed at Every Reset in the Field)

The following procedure outlines the steps required to put the meter in normal operation mode. Figure 2.3shows a simplified flow chart for the normal operation in the field.

1. Reset the CS5490.

2. Restore configuration and control registers.

3. Restore the VGAIN and IGAIN registers from the non-volatile memory.

4. If needed, restore the offset registers from NVM.

5. If needed, restore the phase compensation registers from the NVM.

6. If needed, restore the no load compensation to the POFF and QOFF registers from the NVM.

7. Send the single conversion command to the CS5490.

8. Confirm that the register checksum is valid, or return to step 1.

9. Send the continuous conversion command to the CS5490.

10. Enable and clear DRDY.

11. Poll DRDY.

12. If DRDY is set, clear DRDY.

13. Read IRMS, VRMS, and PAVG. Scale the IRMS, VRMS, and PAVG back into true value by:

Amps = Full_Scale_Current * (IRMS /0.6)

Volts = Full_Scale_Voltage * (VRMS /0.6)

Watts = Full_Scale_Power * (PAVG /0.36)

14. Loop back to "Poll DRDY" step.

2. Full Calibration and Compensation Procedure (Performed Once)

The following procedure shows the steps required to perform calibration and compensation. A flow chart showing the full calibration procedure is shown in Figure 2.4.

Figure 2.4 Main calibration procedures

1. Power up the CS5490 device.

2. Reset the CS5490 device.

3. Verify the register checksum to confirm the reset is successful.

4. Restore configuration and control registers.

5. Connect the reference line voltage and load current to the meter with a phase angle of 60o current lagging.

6. If the reference load current is not the full load, set the Scale register to a ratio of 0.6 x 223xreference load current ÷ full scale current. See Non-full-scale Gain Calibration if the reference line voltage is lower than the maximum line voltage.

7. Perform continuous conversion (0xD5 command) for 2 seconds.

8. Stop the continuous conversion (0xD8 instruction).

9. Read IRMS, VRMS, PAVG, and PF, and confirm the reference voltage and current signals are correctly attached by verifying if the IRMS, VRMS, PAVG, and PF are in a reasonable range.

10. Clear DRDY status bit.

11. Send AC gain calibration command (0xFE) to the CS5490.

12. Wait for DRDY to be set.

13. If needed, perform phase compensation, AC offset calibration, and power offset correction.

14. Send continuous conversion (0xD8 command).

15. Verify measurement accuracy. Check the setup or fail the meter if the accuracy is not within specifications.

16. Read VGAIN, IGAIN, IACOFF, POFF, QOFF, PC, and register checksum and save them into flash/EEPROM.

17. Calibration completed.

3. System scaling

Hardware Scale: The CS5490 inputs are scaled using attenuation circuits that apply maximum input amplitude of 176mVRMS or 35mVRMS, which is dependent on an AFE gain setting of 10x gain or50 x gain, respectively.

AFE Scale: The AFE registers record input levels that are displayed as a ratio of the most recent measurement to the maximum RMS voltage and RMS current. The maximum RMS register value is generated using a 0.6 ratio. The register value is read as a 24-bit hexadecimal number, which is proportioned to represent a 0.6VRMS full scale. At maximum voltage (0.6) and maximum current (0.6) the maximum power is PMAX = VRMSMAX × IRMSMAX = 0.6 × 0.6 = 0.36.

MCU Scale: The MCU is required to read all registers and interpret the 24-bit hexadecimal numbers based on full-load conditions. Knowing the maximum hardware scaling and the most recent AFE register values in relation to the full-scale input, the MCU routines are able to calculate the actual power measurements.

Step 6: Gateway Design

Picture of Gateway Design

The gateway is responsible for collecting data and then sending it to the android application interface. It also has a console access that can show all the relevant information along with a small interface. The requests information from the energy node via wired communication. The energy node then sends the information back to the gateway. The gateway then forwards this information on to the android application interface. This process happens in regular intervals which can be set in the menu interface. Because the gateway and the energy nodes are separate a single system can comprise of many energy nodes. The advantage of this is that the cost to monitor another additional appliance is low because only the energy node needs to be purchased.

The application for the gateway is designed completely using C language. The flowchart for the application is shown in figure enclosed.The application starts with the initialization of the GPIO pins of the Beaglebone black board using the “sys” file system. The directions of the GPIO pins are then set to accommodate the functionality used on the pin. For example the pins at which the relays were connected were chosen as outputs while the pins at which switches were connected were chosen as inputs.

After the GPIO pins initialization, we open the two serial ports nodes which can be accessed in the linux file system as “/dev/ttyOx” where x is the UART number. These two serial ports are the ones at which our energy metering nodes are connected directly using UART. Thus only after opening these ports, we would be able to access these ports. After then we read the previous configurations of the serial ports and set a new one to match our EMIC capability. After successful settings of the serial ports, we load the calibration constants onto our two EMIC boards and thus initializing the two CS5490 EMICs ready for energy measurements.

After successful loading of the calibration constants, we set a signal handler for emergency stopping the gateway server application. Here we do all wise deallocation of the resources like server file descriptors, serial ports and all that we have used in our application.

As gateway is also responsible for storing the meter readings in a database, here we use sqlite database for storing the reading from the meter in a structured format. After the initialization of the signal handlers, we open / create the database files for corresponding meters with the name “METERx” where x is the meter number. If the database file was not there initially, it is created else it is opened. Now the tables for corresponding month and year are created / opened with the format “month_year”. For a new month/year, the application automatically creates the corresponding table in the database.

Now to implement parallelism in the gateway application, we implement three threads running three different applicational functionalities. Here we initialize three threads. The first one is the “timer thread” which is responsible for maintaining the reference time delay in the program for periodic update of the database and user interface for the meter readings. Next thread “switch polling thread” is responsible for continuous monitoring switches if they are pressed or not, and thereby executing the corresponding load switching functionality. The third thread “server thread” is responsible for creating, binding, listening and maintaining a TCP/IP connection with the android client application for data updation and retrieval.

For the prototype demonstration, we have chosen Beaglebone black, a development board from Texas Instruments as the gateway processor. It has been equipped with a minimum set of features to allow the user to experience the power of the processor and is not intended as a full development platform as many of the features and interfaces supplied by the processor are not accessible from the BeagleBone Black via onboard support of some interfaces. BeagleBone Black is not a complete product designed to do any particular function. It is a foundation for experimentation and learning how to program the processor and to access the peripherals by the creation of your own software and hardware. It also offers access to many of the interfaces and allows for the use of add-on boards called capes, to add many different combinations of features. A user may also develop their own board or add their own circuit.

Board features includes:

1. AM335x 1GHz ARM® Cortex-A8

2. 512MB DDR3 RAM

3. 4GB 8-bit eMMC on-board flash storage

4. 3D graphics accelerator

5. NEON floating-point accelerator

Connectivity:

1. USB client for power & communications

2. USB host

3. Ethernet

4. HDMI

5. 2x 46 pin header

Software Compatibility:

1. Debian

2. Android

3. Ubuntu

4. Cloud9 IDE

Step 7: ANDRIOD APPLICATION DESIGN

Picture of ANDRIOD APPLICATION DESIGN

Introduction

This Application will be responsible for communication from gateway through Wi-Fi. First it will ask for login and password so that unauthorized user won’t be able to use it. Then it will send command for specific data as required by user and then it will display the data send by gateway in different form .There are various Buttons for various types of data to be displayed, on each click a specific command will be sent so that gateway will recognize that which data to be sent to user from Database. Also there is provision for turning ON and OFF the meters according to user needs from application. This meter is smart in the sense that we can set a limit of energy consumption in the application the meter will send that limit to gateway, gateway will keep track of energy consumption on reaching that limit it will automatically turn OFF the appliances.

In the above picture we can see that Meter1 is enabled while Meter2 is not, thus we will be able to use buttons of meter 1 only; Buttons related to meter 2 are disabled to prevent them from accidental use. Also there are three buttons to send commands for retrieving current usage data, data usage of previous weeks of current month and previous day data consumption. There is also a switch for each meter to turn it ON and OFF, this will cause the appliance to be turned ON/OFF according to our wish. The current usage will be shown on the same screen and the data that will be shown is Power, Voltage, Current, and Energy. The other commands will cause data to be displayed on different Activity in form of graphs. At the bottom the text box is to set limit for monthly consumption, at button below that will show the Energy consumption of previous month.

For showing data in form of graphs we have used Achartengine library Which we have to copy in libs folder of project and we have to add its graphical activity in our mainfest file. We have used Achartengine because it is free, lite and supports various types of graphs.

To send command and receive data we have used Stream Sockets, because in case of UDP sockets there may be chance that data may be lost which will cause application to behave abnormally. Data sending and receiving is a time consuming process so for each communication a thread will be created, Communication will happen in its handler and results will be published by its runnable in main thread. On close of each thread its socket will also be closed. We have also used some background images, which needs to be copied /bin/res/drawable-mdpi folder.

ANDROID WIDGETS USED-

1. TEXT BOXES - To display various messages.

2. EDIT BOXES – To take Input for user.

3. BUTTONS – To perform some action accordingly.

4. SWITCHES – To turn on and off appliances.

5. TOGGLE BUTTONS – To perform action on toggle on/toggle off.

6. RELATIVE LAYOUT – To arrange various widgets on screen.

7. LINEAR LAYOUT – To arrange various widgets on screen.

VARIOUS API & METHODS USED-

1. findViewById

2. onClick

3. onPause

4. onResume

5. onKeyDown

6. onCheckedChange

7. setOnClickListener

8. setOnCheckedChangeListener

9. startActivity

10. putExtra

11. getExtra

12. And many more

Mechanisms used

SOCKETS- Sockets are a method of IPC that allow data to be exchanged between applications, either on the same host (computer) or on different hosts connected by a network.

Sockets exist in a communication domain, which determines:

1. The method of identifying a socket (i.e., the format of a socket “address”)

2. and the range of communication (i.e., either between applications on the same host or between applications on different hosts connected via a network).

SOCKET TYPES-Are of two types

1. TCP Socket

2. UDP Socket

We have used TCP Socket due to-

TCP Sockets provide a reliable, bidirectional, byte-stream communication channel. By the terms in this description, we mean the following: Reliable means that we are guaranteed that either the transmitted data will arrive intact at the receiving application, exactly as it was transmitted by the sender (assuming that neither the network link nor the receiver crashes), or that we’ll receive notification of a probable failure in transmission.

Bidirectional means that data may be transmitted in either direction between two sockets. Byte-stream means that, as with pipes, there is no concept of message boundaries.

THREADS- All the network related task should not be performed in main thread because then our application will become irresponsive .Thus we should use

1. Asynchronous Task or

2. Threads

We have used here Threads, for each click to perform a network operation a thread will be created which will be responsible for data transfer. Also for each thread we need to implement a handler and a runnable method.

HANDLER- Handlers are used to schedule the actions in thread, in broad sense we can say that it queues the list of actions to be performed. Or to enqueue an action to be performed on a different thread.

RUNNABLE – These are executed at some point in the future, from a handler we directly cannot our user interface for that we need runnables.

Step 8: Final Implementation

Picture of Final Implementation

The connections of other parts of the circuit like switches, relays and metering node to the gateway is shown in figure above.

The load switch1 is responsible for switching ON/OFF load1. A 5v relay is connected in series of the mains with load1 so that when switch1 is pressed the gateway algorithm senses the switch press and thus toggle the state of relay1 thus turning ON/OFF the relay. Similarly load switch2 is responsible for switching ON/OFF load2. A 5v relay is connected in series of the mains with load2 so that when switch2 is pressed the gateway algorithm senses the switch press and thus toggle the state of relay2 thus turning ON/OFF the relay.

Two energy metering nodes as described in section 2.2 .The energy metering nodes receives its isolated power and non-isolate power from the gateway itself. Because the EMIC works in direct connection with the mains power sensing circuitry, so all of its pins are being exposed to mains current. Thus to make it not harm the gateway circuitry, optoisolator based isolation circuit is being provided and thus a safe IO connection is made to the gateway. Also the power supply used to power the EMIC is isolated by utilizing the isolated DC/DC converter from Texas Instruments.

Both the energy nodes named “METER1” for load1 and “METER2” for load2 are based on UART and thus are connected to the UART4 and UART2 on the Beaglebone Black respectively. Both the RXD and TXD pins are galvanically isolated from the mains and thus the beaglebone circuit is well protected from any mains signal.

Both the meters as well as the load control circuited are powered from the 5v rail of the beaglebone itself and the beaglebone receives its power from a 5v, 1A regulated DC supply.

The gateway is responsible for collecting data and then sending it to the android application interface. It also has a console access that can show all the relevant information along with a small interface. The requests information from the energy node via wired communication as described above. The energy node then sends the information back to the gateway. The gateway then forwards this information on to the android application interface. This process happens in regular intervals which can be set in the menu interface. Because the gateway and the energy nodes are separate a single system can comprise of many energy nodes. The advantage of this is that the cost to monitor another additional appliance is low because only the energy node needs to be purchased.

The CS5490 EMIC provides a two-wire, asynchronous, full-duplex UART port. The CS5490 UART operates in8-bit mode, which transmits a total of 10 bits per byte. Data is transmitted and received LSB first, with one startbit, eight data bits, and one stop bit.

The baud rate is defined in the SerialCtrl register. Afterchip reset, the default baud rate is 600, if MCLK is4.096MHz. The baud rate is based on the contents ofbits BR[15:0] in the SerialCtrl register.

Upon power-up, the CS5490 requires an initial register configuration before executing power measurements. One of the key configurations is adjusting the system scaling for the power meter application. The key scaling constants are identified through calibration and compensations performed at the power meter manufacturer. Afterthe configuration and calibration constants are established, the calibration constants are downloaded during a normal power-on reset. The application will start conversions and report power and input performance over time. During power conversions and calculations, the analog inputs are sampled at 512 kHz, decimated down to 4kHzhigh-rate conversion cycles. The high-rate samples are averaged to produce a 1 second low-rate power accumulation measurement, which is used to update registers and, when enabled, generate pulses that represent the power results (N = 4000, MCLK = 4.096 MHz). The CS5480/84/90 performs signal conditioning along the digital data path, which improves the accuracy of the power meter measurements. Signal conditioning is provided in the high-rate path (gain, phase, and DC offset) and in the lower rate path (no load current RMS offset, AC offset, active and reactive power offset).The CS5484 full scale RMS register values are commonly reported as 0.6 when the inputs are at a maximum level.

Now to fetch real time energy data from the energy nodes, the gateway has to follow a sequence of steps which are described in the section below:

1. Reset the CS5490.

2. Restore configuration and control registers.

3. Restore the VGAIN and IGAIN registers from the non-volatile memory.

4. If needed, restore the offset registers from NVM.

5. If needed, restore the phase compensation registers from the NVM.

6. If needed, restore the no load compensation to the POFF and QOFF registers from the NVM.

7. Send the single conversion command to the CS5490.

8. Confirm that the register checksum is valid, or return to step 1.

9. Send the continuous conversion command to the CS5490.

10. Enable and clear DRDY.

11. Poll DRDY.

12. If DRDY is set, clear DRDY.

13. Read IRMS, VRMS, and PAVG. Scale the IRMS, VRMS, and PAVG back into true value by:

Amps = Full_Scale_Current * (IRMS /0.6)

Volts = Full_Scale_Voltage * (VRMS /0.6)

Watts = Full_Scale_Power * (PAVG /0.36)

Step 9: CONCLUSION AND FUTURE WORK

Increasing the energy consumption awareness in every household is an important step to make the user able to man- ages his energy consumption. We have brought this concept even one step further by allowing users to observe not only the overall house hold consumption but also each device’s consumption. Thus users are able to learn the energy profile of each device and to identify the devices that consume most power at home.

Based on this knowledge, users have the possibility to develop better strategies for saving energy costs. Further, our system considers possible future changes in the energy market demonstrating novel functionalities for energy aware smart homes. For example, energy providers’ systems could communicate directly with the smart home applications announcing special price offers during off-peak times. Users could then configure their smart devices to respond to these offers. As smart homes become even smarter, systems could learn over the time and calculate the most efficient ways to configure the home appliance or to provide users with recommendations on how to save energy. Besides the technical challenges, it is necessary to keep in mind the users’ requirements. A smart home application has to be developed in a user centric way and must not be purely technology-driven. It is a thin line between an effective, user - supporting home automation system and an annoying, overly intrusive one. Now, after having a running prototype we will shift focus to user evaluations, to gain deeper knowledge on how to design energy efficient smart homes. We also applied novel interaction techniques, which allow users to use their mobile phones as magic lenses to view the energy consumption of their appliances just by pointing gestures. When users require more details or when they like to compare energy consumption between devices, they can easily transfer the information to a larger display such as a TV. Users are also able to control the appliances such as turn on, off, start washing, play movie etc. This seamless communication among devices allows users to interact with the appliances using various kinds of device types.

Step 10:

Comments

Kiran5432 (author)2017-07-10

Hello everyone,

Can anyone please tell me how i calibrate my CS5490 bare IC for 250V, 15A load, using 200W bulb as reference load(dont have full load) for calibration...Thanks in advance

manju shetty (author)2016-10-17

can we do it with raspberry pi

wilgubeast (author)2014-08-26

Comprehensive. Not gonna lie, you lost me around step 4. But SO COMPREHENSIVE. Thanks for sharing.

Thank you :)

WaleedF4 (author)abhishek7xavier2016-09-20

can u help in a similar project

Anupam123 (author)2016-04-17

hi abhishek it's a great project but there are certain things unclear about it ....

1. why is RS232 used here and how it is connected

2. what is load circuit

3. can i replace the energy node circuit with ready made digital meters

kindly clear my confusion so that i could work on this

ClaudioDonate (author)2015-12-09

Hello, I have some questions. What did you use for the calibration load? I need a 5 A load for calibration and I'm at a lost. And, why the 60o current lagging for the calibration? Would it be ok to use 5 incandescent lamps in parallel that draw 1A each, after they have stabilized? Thanks you for your awesome project, I'm doing one similar but with an arduino. Cheers!

Hello claudio, can you share us your similar project with adruino?

shriom (author)2015-09-05

How can i contact for better understanding of this project?

shriom (author)2015-09-05

I wan't to make this project but i couldn't understand properly ...can you help me?

joe00961 (author)2014-09-01

Great project.

I was trying to work with the CS5490 for a project of mine, but I am stuck on calibration, can you help?

thank you

abhishek7xavier (author)joe009612014-09-04

Calibrating the CS5490 is very easy,just refer this document:
http://www.cirrus.com/en/pubs/appNote/AN366REV2.pdf

joe00961 (author)abhishek7xavier2014-09-04

Thanks
In fact I tried to but for some reason I am still not getting good results.
It might be my board though

abhishek7xavier (author)joe009612014-09-05

Actually for accurate results,you have to calibrate it at atleast half the load u designed it for.Say u designed the meter for 16A,then you should atleast calibrate it at 8A,then only u'll get accurate calibration and good results.I calibrated the same way and getting awesome results :)

Tchernyavsky (author)2014-08-28

It is interesting!

Balu Royal (author)2014-08-27

i apreciate your idea and hardwork , you need the best prize

Hey thanks :), i don't want any prize. I just want to keep sharing my projects with people !!

About This Instructable

35,758views

123favorites

License:

Bio: Nothing special ^_^
More by abhishek7xavier:Heart rate monitor with PC connectivitySmart home energy monitoring & management systemDIY ClockBlock (a multipurpose rechargeable timepiece)
Add instructable to: