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); + +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..55ad57b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# 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 diff --git a/library.json b/library.json new file mode 100644 index 0000000..d2857f4 --- /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.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": "*" +} diff --git a/library.properties b/library.properties new file mode 100644 index 0000000..0399b81 --- /dev/null +++ b/library.properties @@ -0,0 +1,8 @@ +name=ATM90E36 +version=1.0 +author=Tisham (whatnick) Dhar +maintainer=Domenico Silletti +sentence=ATM90E66 support for Arduino +paragraph=ATM90E36 support for Arduino +category=Sensors +url=https://github.com/dsilletti/ATM90E36