Start a new topic

Firmware for 3 phase charging energy tracking

I've read the few topics on workarounds, but I'd like to explore the possibility of tracking three phase charging properly and accurately.

I'm OK with doing any hardware changes to the PCB design and using the extra unused analog pins on the arduino. My challenge is how to make the firmware changes.

So conceptually, I think it's just a case of tracking three sets of current usage (through three independent current transformers), then calculating the sum of all of them and using this to derive kWh, etc.

The benefit of doing it this way is it's fully compatible and "automatic" whether charging single phase or three phase. L1+L2+L3 will always reflect true consumption, whether single phase or three phse charging - in the case of single phase, then L2 = L3 = 0amps.

How feasible do you think this is?

In an ideal world, it would be good to measure voltage too, but I'd be happy with just setting a fixed value, i.e. 230V.

Hi, Xav! In the newest version of OpenEVSE there is support for a 3-phase current, did you watch it?

1 person likes this
I hadn't seen this!
Is there any documentation on this other than in the code to help me understand?
I'll download it and have a play anyway :)


I did not find the full documentation. In open_evse.h it is said that the inclusion of this function simply changes the formula for calculating energy. I hope this helps you) 

// Enable three-phase energy calculation
// Note: three-phase energy will always be calculated even if EV is only using singe-phase. Ony enable if always charging 3-phase EV and aware of this limitation.
//#define THREEPHASE


Oops, I thought that this function allows the connection of three current transformers, but it turned out not so (  

#ifdef THREEPHASE //Multiple L1 current by the square root of 3 to get 3-phase energy
      m_wattSeconds += (((g_EvseController.GetCurSvcLevel() == 2) ? VOLTS_FOR_L2:VOLTS_FOR_L1) * (ma/1000UL) * dms * 3) / 1000UL;
#else // !THREEPHASE
     m_wattSeconds += (((g_EvseController.GetCurSvcLevel() == 2) ? VOLTS_FOR_L2:VOLTS_FOR_L1) * (ma/1000UL) * dms) / 1000UL;
#endif // THREEPHASE

The usual multiplication of a value from one transformer. 

Why is the multiplication of values ​​from 1 to 3 inaccurate? An electric car with three-phase charging in theory should consume the same energy from three phases, so even with a transformer in one phase the readings will be correct, only when switching from three phases to one phase the controller does not recognize the current change from 3 phases to 1 phase and will continue to multiply the reading. There are several options: 1) if you have several electric vehicles with 1 and 3 phases for charging, you may think of a separate button that switches the counter modes (1 phase or 3 phases), then you do not need to connect three transformers, since the consumption phase should be the same. 2) Take a separate Arduino and connect 3 current transformers to it and download a separate firmware. On the Internet, there are many examples of connecting current transformers to Arduino. You probably saw them). There will only be a minus here that the energy should be output to a separate screen or you need to change the EVSE controller code so that it takes the values ​​of the Arduino counter using UART or I2C. 3) Create a ticket for Github OpenEVSE with the request to help add three-phase power support with the inclusion of three current transformers. I believe that it is better to use 1 current transformer and multiply its values ​​by 3, but the choice is yours)

I went through the same thought process as you! :)

The only solution I see is the third option - proper support with 3x CTs to measure total current. It's the only way you can have a truly "automatic" correct calculation - hence my original post :)

Having something fixed isn't of any use if the charger will sometimes be connected to 1P, sometimes connected to 3P-capable cars.

I don't see how easy it would be to have a second button to switch between 1 and 3P counting. And if you're goint to do that, you might as well just modify the code to take readings of 3x CTs and sum up the total.

The only potential problem I can see is memory capacity. OpenEVSE pretty much maxes out the RAM availability and so there might not be enough capacity to track and log the values of two more variables.

However, in the EU, there's no real concept of Level 1 and Level 2 charging, so that whole aspect is IMO completely superfluous to requirements. Just set a current limit and you're done. So stripping out all the L1/L2/Auto features would probably free up enough capacity for the extra variables for the extra two phases.

The board, as it stands, has a coupe of unused analog pins IIRC, so it seems a relatively straight foward thing to do - memory permitting.

Login or Signup to post a comment