Skip to content

Commit

Permalink
v2.5.5 - fixes power factor calculation
Browse files Browse the repository at this point in the history
 - ATM90E32 library fixed to calculate power factor correctly.
 - Upped version to v2.5.5
 - removed canBeNegative for regular meter so its easy to tell when a current transformer is backwards. If one is backwards, real power calculations will be off because power factor will be off.
  • Loading branch information
CircuitSetup committed Dec 3, 2019
1 parent 52296af commit c7250d4
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Software/EmonESP/src/emoncms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "wifi.h"

//EMONCMS SERVER strings
const char* e_url = "/input/post.json?json=";
const char *e_url = "/input/post.json?json=";
boolean emoncms_connected = false;

unsigned long packets_sent = 0;
Expand Down
11 changes: 5 additions & 6 deletions Software/EmonESP/src/energy_meter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ unsigned long startMillis;
unsigned long currentMillis;

const int period = 1000; //time interval in ms to send data
#ifdef SOLAR_METER
bool canBeNegative = true;
#else
bool canBeNegative = false; //set to true if current and power readings can be negative (like when exporting solar power)
#endif
/*Power values are usually only negative when exporting solar power
Otherwise a CT may be backwards */
bool canBeNegative = true;


char result[200];
char measurement[16];
Expand Down Expand Up @@ -300,7 +299,7 @@ void energy_meter_loop()
if (LineFreq == 389) {
totalSolarWatts = eic_solar.GetTotalActivePower()*2;
}
else (
else {
totalSolarWatts = eic_solar.GetTotalActivePower(); //all math is already done in the total register
}

Expand Down
3 changes: 3 additions & 0 deletions Software/EmonESP/src/energy_meter.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@
37106 - 9v AC Transformer - Jameco 157041
38302 - 9v AC Transformer - Jameco 112336
29462 - 12v AC Transformer - Jameco 167151
For Meters > v1.4 purchased after 11/1/2019 and rev.3
7611 - 9v AC Transformer - Jameco 157041
*/
#define VOLTAGE_GAIN 37106

/*
10170 - SCT-006 20A/25mA
25498 - SCT-013-000 100A/50mA
39473 - SCT-016 120A/40mA
46539 - Magnalab 100A
Expand Down
1 change: 0 additions & 1 deletion Software/EmonESP/src/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#error Platform not supported
#endif


WiFiClientSecure client; // Create class for HTTPS TCP connections get_https()
HTTPClient http; // Create class for HTTP TCP connections get_http()

Expand Down
Binary file modified Software/EmonESP/src/src.ino.esp32.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion Software/EmonESP/src/web_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static const char _DUMMY_PASSWORD[] PROGMEM = "_DUMMY_PASSWORD";

#define TEXTIFY(A) #A
#define ESCAPEQUOTE(A) TEXTIFY(A)
String currentfirmware = "2.5.4"; //ESCAPEQUOTE(BUILD_TAG);
String currentfirmware = "2.5.5"; //ESCAPEQUOTE(BUILD_TAG);

void dumpRequest(AsyncWebServerRequest *request) {
if (request->method() == HTTP_GET) {
Expand Down
2 changes: 1 addition & 1 deletion Software/EmonESP/src/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const byte DNS_PORT = 53;

// Access Point SSID, password & IP address. SSID will be softAP_ssid + chipID to make SSID unique
const char *softAP_ssid = "emonESP";
const char* softAP_password = "";
const char *softAP_password = "";
IPAddress apIP(192, 168, 4, 1);
IPAddress netMsk(255, 255, 255, 0);
int apClients = 0;
Expand Down
2 changes: 1 addition & 1 deletion Software/EmonESP/src_solar/emoncms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "wifi.h"

//EMONCMS SERVER strings
const char* e_url = "/input/post.json?json=";
const char *e_url = "/input/post.json?json=";
boolean emoncms_connected = false;

unsigned long packets_sent = 0;
Expand Down
9 changes: 4 additions & 5 deletions Software/EmonESP/src_solar/energy_meter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ unsigned long startMillis;
unsigned long currentMillis;

const int period = 1000; //time interval in ms to send data
#ifdef SOLAR_METER
bool canBeNegative = true;
#else
bool canBeNegative = false; //set to true if current and power readings can be negative (like when exporting solar power)
#endif
/*Power values are usually only negative when exporting solar power
Otherwise a CT may be backwards */
bool canBeNegative = true;


char result[200];
char measurement[16];
Expand Down
4 changes: 3 additions & 1 deletion Software/EmonESP/src_solar/energy_meter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
//#define ENABLE_OLED_DISPLAY
#define SOLAR_METER


/*
Uncomment to send metering values to EmonCMS, like Fundamental, Harmonic, Reactive, Apparent Power, and Phase Angle
*/
Expand Down Expand Up @@ -61,10 +60,13 @@
37106 - 9v AC Transformer - Jameco 157041
38302 - 9v AC Transformer - Jameco 112336
29462 - 12v AC Transformer - Jameco 167151
For Meters > v1.4 purchased after 11/1/2019 and rev.3
7611 - 9v AC Transformer - Jameco 157041
*/
#define VOLTAGE_GAIN 37106

/*
10170 - SCT-006 20A/25mA
25498 - SCT-013-000 100A/50mA
39473 - SCT-016 120A/40mA
46539 - Magnalab 100A
Expand Down
Binary file modified Software/EmonESP/src_solar/src_solar.ino.esp32.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion Software/EmonESP/src_solar/web_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static const char _DUMMY_PASSWORD[] PROGMEM = "_DUMMY_PASSWORD";

#define TEXTIFY(A) #A
#define ESCAPEQUOTE(A) TEXTIFY(A)
String currentfirmware = "2.5.4"; //ESCAPEQUOTE(BUILD_TAG);
String currentfirmware = "2.5.5"; //ESCAPEQUOTE(BUILD_TAG);

void dumpRequest(AsyncWebServerRequest *request) {
if (request->method() == HTTP_GET) {
Expand Down
2 changes: 1 addition & 1 deletion Software/EmonESP/src_solar/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const byte DNS_PORT = 53;

// Access Point SSID, password & IP address. SSID will be softAP_ssid + chipID to make SSID unique
const char *softAP_ssid = "emonESP";
const char* softAP_password = "";
const char *softAP_password = "";
IPAddress apIP(192, 168, 4, 1);
IPAddress netMsk(255, 255, 255, 0);
int apClients = 0;
Expand Down

0 comments on commit c7250d4

Please sign in to comment.