Skip to content

Enable / Disable dc relays for 1,2,3 phase connection#53

Open
Tinbum1 wants to merge 2 commits into
OpenEVSE:masterfrom
Tinbum1:master
Open

Enable / Disable dc relays for 1,2,3 phase connection#53
Tinbum1 wants to merge 2 commits into
OpenEVSE:masterfrom
Tinbum1:master

Conversation

@Tinbum1

@Tinbum1 Tinbum1 commented Jun 9, 2026

Copy link
Copy Markdown

To enable 2 other contractors to be added and to be controlled by the 2 DC relays for 1,2,3 phase charging using rapi $SR and $SS and energy calculation.

@Tinbum1 Tinbum1 marked this pull request as ready for review June 9, 2026 11:53

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming 3 Phase based on DC Relays Enabled/Disabled is not possible. Many users in split phase countries (US, Canada, Japan, Mexico, etc.) use either 2 x Singe Pole - Single Throw (SPST) Relays or 1 x Double Pole Single Throw (DPST).

I would reccomend this PR focus on adding the ability to Enabling and Disable each relay including the AC_Relay as well. The feature is good and could be usefull for many use cases. The juicebox replacement boards do not even have the AC relay driver installed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean. The 'assuming 3 phase' is selected in the GUI.

@chris1howell chris1howell Jun 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  // Multiply calculation by 3 to get 3-phase energy.
  // Typically you'd multiply by sqrt(3), but because voltage is measured to
  // ground (230V) rather than between phases (400 V), 3 is the correct multiple.
  mws *= 3;
  if (relay1Enable && relay2Enable){mws *= 3;}
  else if (relay1Enable || relay2Enable){mws *= 2;}
  else {mws *= 1;}   

I am not a programmer but to me that looks like. If relay 1 AND 2 are enabled the multiplier is 3. If relay 1 OR 2 is enabled multiply by 2 and if none multiply my 1.

Note Split Phase (US, Canada, Japan, Mexico, etc.) does not need to multiply current by 2, that already happens on the voltage Single Phase is 120v and Split is 240. Multiplying both current and voltage would be correct for Europe but 2X for Split Phase countries.

@Tinbum1 Tinbum1 Jun 9, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that is only done if

#ifdef THREEPHASE
// Multiply calculation by 3 to get 3-phase energy.
// Typically you'd multiply by sqrt(3), but because voltage is measured to
// ground (230V) rather than between phases (400 V), 3 is the correct multiple.

  if (relay1Enable && relay2Enable){mws *= 3;}
  else if (relay1Enable || relay2Enable){mws *= 2;}
  else {mws *= 1;}      

#endif // THREEPHASE

which is selected in the GUI edit- no at compile. (GUI sets calculations in openevse_esp32_firmware)

Comment thread firmware/open_evse/J1772EvseController.h Outdated
@chris1howell

Copy link
Copy Markdown
Member

I commited to the linco-work branch, we are about to push it out as 9.0.0.
8b84462

Add per-relay enable/disable control via RAPI ($SR/$GR commands)
Allows individual DC1, DC2, and AC relay outputs to be enabled or
disabled at runtime via new $SR and $GR RAPI commands. Settings are
persisted to EEPROM (offset 39) and applied on boot.

GR - get relay enable status
response: $OK dc1 dc2 ac
dc1/dc2/ac: 1=enabled 0=disabled
$GR

SR n 0|1 - enable/disable relay output (saved to EEPROM, applied at boot)
n: 1=DC relay 1, 2=DC relay 2, 3=AC relay
0=disable 1=enable (all relays enabled by default)
$SR 1 0 - disable DC relay 1
$SR 2 0 - disable DC relay 2
$SR 3 0 - disable AC relay
$SR 1 1 - re-enable DC relay 1

Firmware is built here:
https://github.com/OpenEVSE/open_evse/actions/runs/27229032632

@Tinbum1

Tinbum1 commented Jun 9, 2026

Copy link
Copy Markdown
Author

Thanks that looks nice.
New to all of this and still learning but think it will mean I have to alter ( simplify :) ) my pull request at OpenEVSE/openevse_esp32_firmware#1099

edit noticed you say "Settings are persisted to EEPROM (offset 39)" which I can understand. Just wondering how that will work when I was looking to change relay states during charging as PV power increases / decreases and would that degrade chip?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants