update modules
This commit is contained in:
parent
74eb332790
commit
68d43dd583
|
@ -4,3 +4,6 @@
|
|||
[submodule "src/InfluxDB-Client-for-Arduino"]
|
||||
path = src/InfluxDB-Client-for-Arduino
|
||||
url = https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino.git
|
||||
[submodule "scr/PZEM-004T-v30"]
|
||||
path = scr/PZEM-004T-v30
|
||||
url = https://github.com/mandulaj/PZEM-004T-v30.git
|
||||
|
|
|
@ -15,11 +15,11 @@ InfluxDBClient client(INFLUXDB_URL, INFLUXDB_DB_NAME);
|
|||
// Data point
|
||||
Point sensor("solar_status");
|
||||
|
||||
void ConnectToWiFiMulti(){
|
||||
void ConnectToWiFiMulti() {
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFiMulti.addAP(SSID, WiFiPassword);
|
||||
Serial.println("Connecting Wifi...");
|
||||
while(WiFiMulti.run() != WL_CONNECTED) {
|
||||
while (WiFiMulti.run() != WL_CONNECTED) {
|
||||
delay(100);
|
||||
}
|
||||
Serial.println("");
|
||||
|
@ -28,7 +28,7 @@ void ConnectToWiFiMulti(){
|
|||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
void ConnectToInflux(){
|
||||
void ConnectToInflux() {
|
||||
// Add constant tags - only once
|
||||
sensor.addTag("Phase", "Solar 1");
|
||||
|
||||
|
@ -46,14 +46,24 @@ void setup() {
|
|||
Serial.begin(115200);
|
||||
ConnectToWiFiMulti();
|
||||
ConnectToInflux();
|
||||
analogReadResolution(ADC_BITS);
|
||||
emon1.voltage(Vpin, 234.26, 1.7); // Voltage: input pin, calibration, phase_shift
|
||||
emon1.current(Apin, 111.1); // Current: input pin, calibration.
|
||||
analogReadResolution(12);
|
||||
pinMode(Apin, INPUT);
|
||||
Serial.println(ADC_COUNTS);
|
||||
emon1.voltage(Vpin, 406, 1.7); // Voltage: input pin, calibration, phase_shift
|
||||
emon1.current(Apin, 66); // Current: input pin, calibration.
|
||||
}
|
||||
|
||||
void loop() {
|
||||
emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
|
||||
emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
|
||||
Serial.println(analogRead(Vpin));
|
||||
emon1.calcVI(20, 2000); // Calculate all. No.of half wavelengths (crossings), time-out
|
||||
Serial.print(emon1.Vrms);
|
||||
Serial.print(" Volts | ");
|
||||
Serial.print(emon1.Irms);
|
||||
Serial.print(" Amps | ");
|
||||
Serial.print(emon1.Vrms*emon1.Irms);
|
||||
Serial.println(" Watts");
|
||||
Serial.println(emon1.calcIrms(1480));
|
||||
//emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
|
||||
delay(5000);
|
||||
|
||||
//influx to be implemented...
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit d4590976d412fafa91df66f1592314aae790b642
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 02d21ad457d4bc42b386c9952e21e552d7847e41
|
Loading…
Reference in New Issue