Skip to content

Instantly share code, notes, and snippets.

@stormsson
Created August 23, 2018 22:04
Show Gist options
  • Save stormsson/a249a6380eb4a602c49c2360f33a611e to your computer and use it in GitHub Desktop.
Save stormsson/a249a6380eb4a602c49c2360f33a611e to your computer and use it in GitHub Desktop.
Arduino energy monitor SCT-0130-030
//Arduino Misuratore di potenzza e corrente elettrica con SCT-013-030
//use EmonLib
// https://www.progettiarduino.com/76-arduino-amperometro-con-sct-013-corrente-e-potenza.html
#include "EmonLib.h"
#include <Wire.h> // Libreria wire già presente in Arduino ide
EnergyMonitor emon1;
// network tension
int rede = 225.0; // IT 220-230V, some countries 110V
// Input Pin
int pin_sct = 1;
void setup()
{
Serial.begin(9600); // Open Serial
//Pin, calibrazione - Corrente Const= Ratio/Res. Burden. 1800/62 = 29.
// 1800 and 62 Ohm values are in the SCT-013-030 datasheet
// after testing with external clamp, 28 seems more accurate
emon1.current(pin_sct, 28);
}
void loop()
{
// Current value (A)
double Irms = emon1.calcIrms(1480);
// show current
Serial.print("Corrente : ");
Serial.print(Irms); // Irms
// Power values (W)
Serial.print(" Potenza : ");
Serial.println(Irms*rede);//Scrivo sul monitor seriale Corrente*Tensione=Potenza
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment