Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

So a quick summary, I am building a home energy meter using a CT and my arduino. I have it connected to a breadboard. The

So a quick summary, I am building a home energy meter using a CT and my arduino. I have it connected to a breadboard. The thing is my CT has a built in resistor so it doesen't input a current to the analog but instead inputs a voltage input which I convert to volts and then later use that to find the current. I am not the greatest at coding but the problem I'm facing now is that I am getting a 0 input on my led screen of all these values which I think is a problem with the input being received for the voltage but I'm not sure. The CT works 100% and with a previous code the arduino sensed this CT so it does work. The CT is using AC while the arduino is running on DC which is why im trying to get the maxVoltage so that i can calculate the RMSCurrent. But so far I am getting a 0 input for my values which i think could just be a logical error for my code.

#include #include LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //Assign LCD screen pins, as per LCD shield requirements unsigned long startMillis; unsigned long endMillis; double peakVoltage; int peakPower = 0; double kilos = 0; void setup(){ lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc. lcd.clear(); lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row) lcd.print("ELEE 2790U"); lcd.setCursor(0,1); // set cursor to column 0, row 1 (the second row) lcd.print("Energy Meter"); startMillis = millis(); } void loop() { int voltage = 0; int minVoltage = 5; int maxVoltage = 0; // read the input on analog pin 1: ///Monitors and logs the voltage input for 200 cycles to determine max and min current for (int i=0 ; i= maxVoltage) maxVoltage = voltage; else if(voltage peakPower) { peakPower = RMSPower; } endMillis = millis(); unsigned long time = endMillis - startMillis; kilos = kilos + ((double)RMSPower * ((double)time/60/60/1000000)); startMillis = millis(); delay(2000); lcd.clear(); // Displays all current data lcd.setCursor(0,0); lcd.print(RMSCurrent); lcd.print("A"); lcd.setCursor(10,0); // Displays Power data lcd.print(RMSPower); lcd.print("W"); lcd.setCursor(0,1); lcd.print(kilos); lcd.print("kWh"); lcd.setCursor(10,1); lcd.print(RMSVoltage); lcd.print("V"); }

image text in transcribed

So 100 2.2 look A A1 lag input Are

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

LO3 Discuss the steps of a typical selection process.

Answered: 1 week ago