Introduction: EF 230 Energy Sensor Intro

Created by James Lee, Rachel Harris, Kenta Funada, and Holly Batte

For this project, you need:

-Two 10k ohm resistors

-One 56 ohm burden resistor

-One 10 microfarad capacitor

-One YHDC 100A current sensor (https://www.amazon.com/YHDC-SCT013-100-Current-Sensor-Transformer/dp/B01CU058UO)

-One MKR 1000 Arduino

-A few wires for connections

This is an image of the energy sensor we used, a YHDC 100A AC sensor. This sensor works by wrapping the core, which is inside of the box opening towards the center of the image, around the live wire for the building whose energy usage you would like to measure. The sensor will then begin recording the current data and sends it to our Arduino.

The second image shows a clear and concise diagram of the wiring setup we used to connect the Arduino to our sensor. The two 10k resistors are on the top edge; the 56 ohm burden resistor bridges the two sensor wires.

Step 1: Sample Inputs

Depicted above is a part of the questionnaire that is contained within our html website. This website takes user input in the form of home info, such as climate or location, matches that info to data collected by the US Department of Energy, and outputs an average power usage of that household of the given criteria.

The other input is the raw energy usage data collected by the sensor. Currently, our code is set up to collect current data every half hour, but that number is easily changed. However much data is collected is then converted to power using P = IV, with V being the standard US voltage of 120 V. This data is then graphed using MATLAB, and the average power usage is graphed as a straight line on the same graph.

Finally, our website also has a few different helpful, energy saving tips that it will output when the energy usage is consistently staying above the average usage value.

Step 2: All the Code

%Microcontroller project code - Holly Batte, Rachel Harris, Kenta Fundata,
%James Lee

%Goal: Read in energy usage in a household in the form of current, display

%power used over time in household compared to average power of similar

%household with some energy efficiency tips

clc, clear all, close all, format compact, format long g

a=arduino;%declare arduino object

%variable declarations (const/initializations) currentPin='A1'

%which arduino pin input is coming from kilos=0.0%number of kilowatt hours used

peakPower=0%maximum power over the time period v=120 %voltage btu2kw=.0335 %conversion factor for millions of BTUs per year to kiloWatts hhour=30 %display values and increment every half hour for daily, weekly or monthly, depending on user selection t=0%time %prompt user for number of people in household, house square footage, house age, whatever will determine baseline

%make initial display prompt='How often do you want data? \n Enter day, week, or month'; str=input(prompt, 's') if str=='day'%user selected day t=48 else if str=='week'%user selected week t=336 else if str=='month'%user selected month t=1440 end end end current=0 maxCurrent=0 minCurrent=1000 %read values from sensor pinMode=configurePin(a,currentPin)%pick input pin for i=[1:1:t]%record data for every half hour %loop contents current=readVoltage(a,currentPin) btu=current/v m=[0:i] m(i)=btu %if loop to find the maximum current if current>=maxCurrent maxCurrent=current else if current<=minCurrent%loop to find minimum current minCurrent=current end end end if maxCurrent<=517 maxCurrent=516 end %calculate data %11.8337 is a placeholder number off the internet, we'll have to test %for it, .707 is RMS constant RMSCurrent=((maxCurrent-516).*.707)./11.8337 RMSPower=110.*RMSCurrent if RMSPower >peakPower peakPower=RMSPower end kilos=kilos+(RMSPower.*(2.05/60/60/1000))

%make text end display

%use math to determine baseline

%make line graph %include baseline %include extracted data x=0:1:t plot(x,m) %allow the user to do stuff with the graph? %research webwrite!! %go to sleep.