Energy Monitoring System (EMS) Abstract

Similar documents
ME 333 Assignment 7 and 8 PI Control of LED/Phototransistor Pair. Overview

Using Z8 Encore! XP MCU for RMS Calculation

Microcontroller: Timers, ADC

VORAGO Timer (TIM) subsystem application note

ELCT 912: Advanced Embedded Systems

PIC Analog Voltage to PWM Duty Cycle

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

Using a PIC for Analog to Digital Conversion

Lab 5 Timer Module PWM ReadMeFirst

NuMicro N76E003 Brushless DC Motor Control User Manual

Timer A. Last updated 8/7/18

Brian Hanna Meteor IP 2007 Microcontroller

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

AC Current click PID: MIKROE Weight: 27 g

P a g e 1. Introduction

TKT-3500 Microcontroller systems

Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs.

PIC ADC to PWM and Mosfet Low-Side Driver

Practical Exercise. STM32F4 Discovery. Alessandro Palla

Web-Enabled Speaker and Equalizer Final Project Report December 9, 2016 E155 Josh Lam and Tommy Berrueta

SUNSTAR 传感与控制 TEL: FAX: Humidity and temperature measurement system using a

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER

Section 35. Output Compare with Dedicated Timer

ATmega16A Microcontroller

802.11g Wireless Sensor Network Modules

17082 AMP Creating Class D Amplifiers with PIC MCUs and Analog

Design Implementation Description for the Digital Frequency Oscillator

Designing with a Microcontroller (v6)

Hello, and welcome to this presentation of the STM32 Digital Filter for Sigma-Delta modulators interface. The features of this interface, which

Analog-to-Digital Converter. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

Course Introduction. Content 20 pages 3 questions. Learning Time 30 minutes

MAXREFDES73#: WEARABLE, GALVANIC SKIN RESPONSE SYSTEM

Characterization of a PLL circuit used on a 65 nm analog Neuromorphic Hardware System

PWMLib PWM Library. Jim Schimpf. Document Number: PAN Revision Number: April Pandora Products. 215 Uschak Road Derry, PA 15627

Digital Acquisition of Analog Signals A Practical Guide

Solar Mailbox project. Pictures of the Solar Mailbox

Design and Development of Smart. Harmonic Analyzer

Generating DTMF Tones Using Z8 Encore! MCU

Physics 335 Lab 7 - Microcontroller PWM Waveform Generation

LINEAR IC APPLICATIONS

Hello, and welcome to this presentation of the FlexTimer or FTM module for Kinetis K series MCUs. In this session, you ll learn about the FTM, its

Real Time Operating Systems Lecture 29.1

Exercise 3: Sound volume robot

Engineer-to-Engineer Note

Microprocessor & Interfacing Lecture Programmable Interval Timer

Analog Digital Converter

Atmel ATmega328P Timing Subsystems. Reading

DIGITAL UTILITY SUB- SYSTEMS

IST TSic Temperature Sensor IC. Technical Notes ZACwire Digital Output

EEL 4744C: Microprocessor Applications Lecture 8 Timer Dr. Tao Li

EE 314 Spring 2003 Microprocessor Systems

Reading Assignment. Timer. Introduction. Timer Overview. Programming HC12 Timer. An Overview of HC12 Timer. EEL 4744C: Microprocessor Applications

Homework 9: Software Design Considerations

Instrument Cluster Display. Grant Scott III Erin Lawler Mike Carlson

dspic30f Quadrature Encoder Interface Module

O 2 SENSORS Zirconium Dioxide (ZrO 2 ) Software & Hardware Design Guide

Hello, and welcome to this presentation of the STM32L4 comparators. It covers the main features of the ultra-lowpower comparators and some

Federal Urdu University of Arts, Science & Technology Islamabad Pakistan THIRD SEMESTER ELECTRONICS - II BASIC ELECTRICAL & ELECTRONICS LAB

Utilizing the Trigger Routing Unit for System Level Synchronization

Using Infrared Array Devices in Smart Home Observation and Diagnostics

MCT U.I. Driver Reference Manual Motor Control Technologies; LLC

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

Characteristic Sym Notes Minimum Typical Maximum Units Operating Frequency Range MHz. RF Chip Rate 11 Mcps RF Data Rates 1, 2, 5.

Gentec-EO USA. T-RAD-USB Users Manual. T-Rad-USB Operating Instructions /15/2010 Page 1 of 24

Oct 30 Announcements. Bonus marked will be posted today Will provide 270 style feedback on multiple-choice questions. [3.E]-1

Dual FOC Servo Motor Control on i.mx RT

Three-Stage Coil Gun

Application - Power Factor Correction (PFC) with XMC TM. XMC microcontrollers July 2016

Lecture #4 Outline. Announcements Project Proposal. AVR Processor Resources

8-bit Microcontroller. Application Note. AVR400: Low Cost A/D Converter

Application Note. The Direct Digital Synthesis Generator

The PicoPak Clock Measurement Module

MicroToys Guide: Motors A. Danowitz, A. Adibi December A rotary shaft encoder is an electromechanical device that can be used to

css Custom Silicon Solutions, Inc.

AC Induction Motor (ACIM) Control using a Digital Signal Controller (DSC)

Outlines. Examples. Hardware Interface. What s Embedded Systems? Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

GCE A level 1145/01 ELECTRONICS ET5. P.M. THURSDAY, 31 May hours. Centre Number. Candidate Number. Surname. Other Names

Lynx. RoIP Gateway DISPATCH LYNX MOBILE. Optional serial ports provide remote control of radio configuration over the VoIP network.

Unit-6 PROGRAMMABLE INTERRUPT CONTROLLERS 8259A-PROGRAMMABLE INTERRUPT CONTROLLER (PIC) INTRODUCTION

High-Torque/High-Power Bipolar Stepper Motor Driver Using 8-bit PIC Microcontroller. Over Temperature Detection COG1 COG1C COG2

ADC Board 4 Channel Notes September 29, DRAFT - May not be correct

M0518. M0518 Board Supporting Package Directory Introduction. Rev M of 11 Rev Nuvoton Technology Corp.

Single Phase Two-Channel Interleaved PFC Operating in CrM Using the MC56F82xxx Family of Digital Signal Controllers

Real Time Implementation of Power Electronics System

AN3252 Application note

Timer A (0 and 1) and PWM EE3376

CS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 8: I/O INTERFACING QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS

Addendum SmartPAC Third Party Communications Firmware

2. Circuit diagram The overall functional diagram is:

Module 13: Interfacing ADC. Introduction ADC Programming DAC Programming Sensor Interfacing

PWM research and implementation on MCS-51

Calhoon MEBA Engineering School. Study Guide for Proficiency Testing Industrial Electronics

Activity 4: Due before the lab during the week of Feb

Figure 1: One Possible Advanced Control System

AWG-GS bit 2.5GS/s Arbitrary Waveform Generator

Timing System. Timing & PWM System. Timing System components. Usage of Timing System

Training Schedule. Robotic System Design using Arduino Platform

GUJARAT TECHNOLOGICAL UNIVERSITY

M051 Series BSP Directory

AN4014 Application Note Adjustable LED blinking frequency using a potentiometer and STM8SVLDISCOVERY Application overview

Transcription:

Energy Monitoring System (EMS) Abstract Dean J. Boman Project ID: 74315 Rev - March 22, 2012 Prepared for: DesignSpark chipkit TM Challenge

Abstract The Energy Monitoring System (EMS) provides real-time home electrical energy usage data to the occupants so informed energy usage decisions can be made. The system hosts a web server that provides a web page with the current energy usage on a circuit-by-circuit basis. In addition, the system interfaces with the overall home automation system so long term monitoring and logging can be accomplished. The Energy Monitoring System consists of the chipkit Max32 development board along with two extension board that hosts the unique interfaces required by the system. A block diagram is shown in Figure 1 and the completed project in shown in Figure 2. The main electrical panel for the home contains 32 individual circuits, so 32 current sensors are used to measure the current consumed by each branch circuit. The branch circuits consist of a mixture of 15 A, 20 A, 25 A, 30 A, 40 A, and 50 A circuits so the sensor sensitivity is tailored to the capacity of the individual branch circuits. The current sensors drive the EMS Interface Board which filters the sensor signal and adjusts the voltage level to be compatible with the Max32 analog to digital converter (ADC) inputs. The EMS Interface Board provides the conditioned signals to the EMS Max32 Board which contains a 32 to 4 analog mux which route the signals to four of the Max32 ADC channels. The EMS Max32 Board also contains an Ethernet interface and power supply. A representative web page display is shown in Figure 3. The software design for the Energy Monitoring System utilizes custom software written in the C language using the Microchip MPLAB development environment to implement all the functions required to measure the real-time energy usage. This custom software is integrated with the Microchip TCPIP stack, which provides the web server interface and all the other standard network functions.

SPI 12 V chipkit Max32 Development Board 4 ADC Inputs Select 4 8 to 1 Muxes 32 Buffer Amp/ 1 KHz Filter Sensor 0 +9 V Buffer Amp/ 1 KHz Filter Sensor 31-9 V EMS Interface Board Electrical Panel Power Supply 120 V AC Input Ethernet Interface EMS Max32 Board Energy Monitoring System Router Legend Part of project Internet Not part of project Purchased item Home Automation System Figure 1 EMS Block Diagram

Figure 2 Photo of Completed EMS Project

Figure 3 Representative Web Page

Sample of Code In order to measure the energy usage of each circuit the current waveform provided to the PIC32 ADC via the EMS Interface Board and current sensors must be sampled sufficiently fast enough such that the RMS current value can be calculated. The filter design on the EMS Interface Board limits the bandwidth to 1 KHz so a 99.8 usec sample period (10 KHz) was chosen. In order to calculate the RMS current the waveform must be measured over precisely one cycle of the 60 Hz AC waveform. To implement the timing for the sampling and RMS calculation timer2 was configured to generate an interrupt at a 99.8 usec rate. The timer is configured with the following code: //Configure timer2 for realtime keeping but setting it for a 99.8 usec interrupt rate T2CON = 0x0040; TMR2 = 0; PR2 = TIMER2_MATCH; IFS0CLR = _IFS0_T2IF_MASK; IEC0SET = _IEC0_T2IE_MASK; //Timer off, 16 bit mode, /16 from peripheral clk //Configure for the 99.8 usec rate //Configure Timer2 Interrupt INTEnable(INT_T2, INT_ENABLED); INTSetVectorPriority(INT_TIMER_2_VECTOR, INT_PRIORITY_LEVEL_2); INTSetVectorSubPriority(INT_TIMER_2_VECTOR, INT_SUB_PRIORITY_LEVEL_0); //Configure for multi-vectored mode INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR); //Enable interrupts INTEnableInterrupts(); //Timer is ready so turn it on T2CON = 0x8040; //Timer on, 16 bit mode, /16 from peripheral clk When the timer times out after 99.8 usec, the interrupt service routine (Timer2Handler) is called, which set various flags as shown in the following code. The TickFlag is set to indicate to the while(1) loop in main() that it is time to sample the ADC, the HalfSecondFlag is used to toggle an LED for indication that the system is operating. Once per second the UpdateRTC() routine is called to update the real time clock. The real time clock is set once per hour based on an external time server. // // Interrupt Service Routines // void ISR(_TIMER_2_VECTOR,ipl2) Timer2Handler(void) { //Update the second counter with the 50 msec timer ticks Sec_counter++; TickFlag = TRUE; if(sec_counter == 5010) HalfSecondFlag = TRUE; if(sec_counter == 10020) { Sec_counter = 0; HalfSecondFlag = TRUE; UpdateRTC(); } } // Reset interrupt flag IFS0CLR = _IFS0_T2IF_MASK;

Within the main() function a while(1) loop continuously looks for the TickFlag to go true. When a TRUE flag is detected a measurement is taken on a specific measurement channel and after 167 samples have been collected (167 samples equals 1 cycle of the 60 Hz AC waveform) the RMS value is calculated using the following equation. Irms 1 N x 166 i 0 I( i) 2 The measurement process starts with measurement channel 0 (as defined by the ChannelIndex variable) by making a call to the ReadCurrent() function at the beginning of a second (as defined by the SecondFlag) and proceeds through all 32 channels. A code snippet from main() that implements this functionality is shown below. // // Main application entry point. // void main(void) {... while(1) { //The TickFlag is set every time the 99.8 usec interrupt from timer2 fires if(tickflag == TRUE) { //The ChannelIndex variable is set to 0 at the top of each second if(channelindex < 32) { //Sample the given channel current measurements for one cycle of the //60 Hz cycle (167 * 99.8 usec is one cycle) ChannelCurrentData[ChannelDataIndex++] = ReadCurrent(ChannelIndex); if(channeldataindex >= 167) { //We have a full cycle of data in memory so calculate the RMS value //Tests show this calculation takes about 330 usec ChannelSquareSum = 0; //First calculate the sum of the square for(i=0;i<167;i++) ChannelSquareSum += pow(channelcurrentdata[i],2); //Now calculate the RMS current ChannelRMSCurrent[ChannelIndex] = sqrt(channelsquaresum/167); } } ChannelIndex++; ChannelDataIndex = 0; } TickFlag = FALSE; //Advance to the next channel //Do the one second tasks if((secondflag == TRUE)) { //Since it is the top of the second we start a data collection ChannelIndex = 0; ChannelDataIndex = 0; SecondFlag = FALSE;... } //if((secondflag == TRUE))

EMS Interface Board Schematic

EMS Max32 Board Schematic

EMS Interconnect