Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions ATM90E36.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
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);

}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions library.json
Original file line number Diff line number Diff line change
@@ -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": "*"
}
8 changes: 8 additions & 0 deletions library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name=ATM90E36
version=1.0
author=Tisham (whatnick) Dhar <tisham@whatnick.com>
maintainer=Domenico Silletti <domenico@silletti.it>
sentence=ATM90E66 support for Arduino
paragraph=ATM90E36 support for Arduino
category=Sensors
url=https://github.com/dsilletti/ATM90E36