From 5a8f9c01114052c0895f1b834d7c38878af720f0 Mon Sep 17 00:00:00 2001 From: Domenico Silletti Date: Wed, 29 Jul 2020 03:13:40 +0200 Subject: [PATCH 1/8] Fixed register writing, set calibration defaults - Fixed a bug that didn't allow to write the registers - Configured all registers with default values --- ATM90E36.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ATM90E36.cpp b/ATM90E36.cpp index 2dacb88..488d4d6 100644 --- a/ATM90E36.cpp +++ b/ATM90E36.cpp @@ -432,15 +432,15 @@ void ATM90E36::begin() CommEnergyIC(WRITE, ConfigStart, 0x5678); // Metering calibration startup CommEnergyIC(WRITE, PLconstH, 0x0861); // PL Constant MSB (default) CommEnergyIC(WRITE, PLconstL, 0xC468); // PL Constant LSB (default) - CommEnergyIC(WRITE, MMode0, 0x1087); // Mode Config (60 Hz, 3P4W) - CommEnergyIC(WRITE, MMode1, 0x1500); // 0x5555 (x2) // 0x0000 (1x) + CommEnergyIC(WRITE, MMode0, 0x0087); // Mode Config // 0x0087 (50 Hz, 3P4W) // 0x1087 (60 Hz, 3P4W) + CommEnergyIC(WRITE, MMode1, 0x0000); // 0x5555 (x2) // 0x0000 (1x) CommEnergyIC(WRITE, PStartTh, 0x0000); // Active Startup Power Threshold CommEnergyIC(WRITE, QStartTh, 0x0000); // Reactive Startup Power Threshold CommEnergyIC(WRITE, SStartTh, 0x0000); // Apparent Startup Power Threshold CommEnergyIC(WRITE, PPhaseTh, 0x0000); // Active Phase Threshold CommEnergyIC(WRITE, QPhaseTh, 0x0000); // Reactive Phase Threshold CommEnergyIC(WRITE, SPhaseTh, 0x0000); // Apparent Phase Threshold - CommEnergyIC(WRITE, CSZero, 0x4741); // Checksum 0 + CommEnergyIC(WRITE, CSZero, 0x421C); // Checksum 0 //Set metering calibration values (CALIBRATION) CommEnergyIC(WRITE, CalStart, 0x5678); // Metering calibration startup @@ -470,26 +470,26 @@ void ATM90E36::begin() //Set measurement calibration values (ADJUST) CommEnergyIC(WRITE, AdjStart, 0x5678); // Measurement calibration - CommEnergyIC(WRITE, UgainA, 0x0002); // A SVoltage rms gain - CommEnergyIC(WRITE, IgainA, 0xFD7F); // A line current gain + CommEnergyIC(WRITE, UgainA, 0xCE40); // A SVoltage rms gain + CommEnergyIC(WRITE, IgainA, 0x7530); // A line current gain CommEnergyIC(WRITE, UoffsetA, 0x0000); // A Voltage offset CommEnergyIC(WRITE, IoffsetA, 0x0000); // A line current offset - CommEnergyIC(WRITE, UgainB, 0x0002); // B Voltage rms gain - CommEnergyIC(WRITE, IgainB, 0xFD7F); // B line current gain + CommEnergyIC(WRITE, UgainB, 0xCE40); // B Voltage rms gain + CommEnergyIC(WRITE, IgainB, 0x7530); // B line current gain CommEnergyIC(WRITE, UoffsetB, 0x0000); // B Voltage offset CommEnergyIC(WRITE, IoffsetB, 0x0000); // B line current offset - CommEnergyIC(WRITE, UgainC, 0x0002); // C Voltage rms gain - CommEnergyIC(WRITE, IgainC, 0xFD7F); // C line current gain + CommEnergyIC(WRITE, UgainC, 0xCE40); // C Voltage rms gain + CommEnergyIC(WRITE, IgainC, 0x7530); // C line current gain CommEnergyIC(WRITE, UoffsetC, 0x0000); // C Voltage offset CommEnergyIC(WRITE, IoffsetC, 0x0000); // C line current offset - CommEnergyIC(WRITE, IgainN, 0xFD7F); // C line current gain - CommEnergyIC(WRITE, CSThree, 0x02F6); // Checksum 3 - - // Done with the configuration - CommEnergyIC(WRITE, ConfigStart, 0x5678); - CommEnergyIC(WRITE, CalStart, 0x5678); // 0x6886 //0x5678 //8765); - CommEnergyIC(WRITE, HarmStart, 0x5678); // 0x6886 //0x5678 //8765); - CommEnergyIC(WRITE, AdjStart, 0x5678); // 0x6886 //0x5678 //8765); - - CommEnergyIC(WRITE, SoftReset, 0x789A); // Perform soft reset -} \ No newline at end of file + CommEnergyIC(WRITE, IgainN, 0x7530); // N line current gain + CommEnergyIC(WRITE, IoffsetN, 0x0000); // N line current offset + CommEnergyIC(WRITE, CSThree, 0x8EBE); // Checksum 3 + + // Done with the calibration, set to 0x8765 for Operation; + CommEnergyIC(WRITE, ConfigStart, 0x8765); + CommEnergyIC(WRITE, CalStart, 0x8765); + CommEnergyIC(WRITE, HarmStart, 0x8765); + CommEnergyIC(WRITE, AdjStart, 0x8765); + +} From 8cc02f313d3751139f7e07b8b2e4c730814ca552 Mon Sep 17 00:00:00 2001 From: Domenico Silletti Date: Fri, 31 Jul 2020 16:15:21 +0200 Subject: [PATCH 2/8] Create library.json --- library.json | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 library.json diff --git a/library.json b/library.json new file mode 100644 index 0000000..1ec676a --- /dev/null +++ b/library.json @@ -0,0 +1,24 @@ +{ + "name": "ATM90E36", + "keywords": "energy meter", + "description": "Arduino library for ATM90E36 IC from Microchip/Atmel", + "repository": { + "type": "git", + "url": "https://github.com/dsilletti/ATM90E36_Arduino.git" + }, + "version": "1.0.0", + "authors": + [ + { + "name": "Tisham Dhar", + "url": "http://whatnicklife.blogspot.com/" + }, + { + "name": "Domenico Silletti", + "url": "https://www.silletti.it", + "maintainer": true + } + ], + "frameworks": "arduino", + "platforms": "*" +} From 7bae6bd5bc722e14b6731e70d4622be992b5a60a Mon Sep 17 00:00:00 2001 From: Domenico Silletti Date: Fri, 31 Jul 2020 16:27:25 +0200 Subject: [PATCH 3/8] Create library.properties --- library.properties | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 library.properties diff --git a/library.properties b/library.properties new file mode 100644 index 0000000..2fc0930 --- /dev/null +++ b/library.properties @@ -0,0 +1,8 @@ +name=ATM90E36 Arduino +version=1.0 +author=Tisham (whatnick) Dhar +maintainer=Domenico Silletti +sentence=ATM90E66 Energy Monitor Support for Arduino +paragraph=ATM90E36 Energy Monitor Support for Arduino +category=Sensors +url=https://github.com/dsilletti/ATM90E36_Arduino From 677e12b566469561b4c4e521dd6243f2458e9304 Mon Sep 17 00:00:00 2001 From: Domenico Silletti Date: Fri, 31 Jul 2020 16:30:20 +0200 Subject: [PATCH 4/8] Create README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..462818a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ATM90E36 Arduino + +Arduino library for the ATM90E36 ATM90E36A energy metering device for three-phase four-wire (3P4W, Y0) or three-phase three-wire (3P3W, Y or Δ) systems. https://www.microchip.com/wwwproducts/en/ATM90E36A From fab6a55cc8f74e95c48872fb2bd8c8f5501a691a Mon Sep 17 00:00:00 2001 From: Domenico Silletti Date: Fri, 31 Jul 2020 16:31:10 +0200 Subject: [PATCH 5/8] Update library.properties --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 2fc0930..ef18a58 100644 --- a/library.properties +++ b/library.properties @@ -1,4 +1,4 @@ -name=ATM90E36 Arduino +name=ATM90E36 version=1.0 author=Tisham (whatnick) Dhar maintainer=Domenico Silletti From 3b12a23fef4d946ad4b2cdc54ee6b3c239b2e52e Mon Sep 17 00:00:00 2001 From: Domenico Silletti Date: Fri, 31 Jul 2020 16:31:42 +0200 Subject: [PATCH 6/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 462818a..55ad57b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# ATM90E36 Arduino +# ATM90E36 Arduino library for the ATM90E36 ATM90E36A energy metering device for three-phase four-wire (3P4W, Y0) or three-phase three-wire (3P3W, Y or Δ) systems. https://www.microchip.com/wwwproducts/en/ATM90E36A From e7fed91fa262df61b4bbc7fb0e6715bf84387dbb Mon Sep 17 00:00:00 2001 From: Domenico Silletti Date: Fri, 31 Jul 2020 16:33:01 +0200 Subject: [PATCH 7/8] Update library.properties --- library.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library.properties b/library.properties index ef18a58..0399b81 100644 --- a/library.properties +++ b/library.properties @@ -2,7 +2,7 @@ name=ATM90E36 version=1.0 author=Tisham (whatnick) Dhar maintainer=Domenico Silletti -sentence=ATM90E66 Energy Monitor Support for Arduino -paragraph=ATM90E36 Energy Monitor Support for Arduino +sentence=ATM90E66 support for Arduino +paragraph=ATM90E36 support for Arduino category=Sensors -url=https://github.com/dsilletti/ATM90E36_Arduino +url=https://github.com/dsilletti/ATM90E36 From b9a47c24f9a2a0fcdeb264f856b8b20807f8ea67 Mon Sep 17 00:00:00 2001 From: Domenico Silletti Date: Fri, 31 Jul 2020 16:33:43 +0200 Subject: [PATCH 8/8] Update library.json --- library.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.json b/library.json index 1ec676a..d2857f4 100644 --- a/library.json +++ b/library.json @@ -4,7 +4,7 @@ "description": "Arduino library for ATM90E36 IC from Microchip/Atmel", "repository": { "type": "git", - "url": "https://github.com/dsilletti/ATM90E36_Arduino.git" + "url": "https://github.com/dsilletti/ATM90E36.git" }, "version": "1.0.0", "authors":