Medidor de energia eletrica - com sensor SCT 013-30

Boa tarde gente estou com dificuldade de realizar uma montagem de um medidor de energia elétrica com o arduino usando o sensor de corrente SCT 013-30. So nao ta funcionando mt bem,,, e o khw coloquei em // pois nao sei como colocar na programação.

A programaçao segue abaixo:

/** Incluindo Bibliotecas **/
#include //Carrega a biblioteca LCD

LiquidCrystal lcd(9, 8, 5, 4, 3, 2); //Define os pinos que serão ligados ao LCD

#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1; // Create an instance
//unsigned long ltmillis, tmillis, timems, previousMillis;
//char charBuf[30];

long valorCorrente;
float amper;
long amper_aux;
float potencia;
float consumo;
float consumo_aux;

//float tarifa = 0.3907;

void setup()
{

/* Inicializa LCD */
lcd.begin(16, 2); //inicia o lcd

/* Inicializa a Serial */
Serial.begin(9600); //inicia a porta serial
emon1.current(1,56.00); // Current: input pin, calibration. 42.861429 estava 111.1 de 0.8 a 0.9 é o 0.2 //61.00

}

void loop ()
{

//Calculate amount of time since last realpower measurment.
//ltmillis = tmillis;
//tmillis = millis();
//timems = tmillis - ltmillis;
double Irms = emon1.calcIrms(1480); // Calculate Irms only
// double kwhTotal = kwhTotal + (((Irms*127.0)/1000.0) * 1.0/3600.0 * (timems/1000.0)); // calculo o khw gastos

// Apparent power
Serial.print("I: ");
Serial.println(Irms); // imprime a corrente na porta serial
Serial.print ("Potencia: ");
Serial.println (potencia); //imprime valor da potencia
Serial.print ("R$: ");
Serial.println (consumo); // imprime valor em reais

delay (15000);

potencia = Irms * 220;
potencia = potencia / 1000;

consumo_aux = potencia * 0.3907;
consumo = consumo + consumo_aux;

/*** Interface do display ***/
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("Corrente: ");
lcd.print(Irms);
lcd.print(" A");
delay(1000);

lcd.clear();
lcd.print("Potencia: ");
lcd.print(potencia);
lcd.print("KWh");
lcd.setCursor(0, 1);
lcd.print("R$: ");
lcd.print(consumo);
delay(1000);

}

Exibições: 498

Responder esta

Respostas a este tópico

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço