Diverting Solar to Charge an Electric Car


I’ve been working on the node-red logic and with a new approach i was able to successfully charge my car at 6600W during lunch ( a critical hour, microwave-oven and washing machine working randomly), with 6900W contracted from the utility company. Only 300W of headroom!!

This is the new scheme:

So on top of the image there is a independent flow that collects Amperes from the house consumption that is stored in a global variabe to be used by other flows. To keep thing sane a timeout has to be implemented to reset the variable in case of a disaster.
Today this value is collected from a emonTx → RF → emonhub → separate Server with a rate of 10 secs
In the future i will want to update this value as quickly as possible, maybe every second.

The logic is triggered at every incoming message from the EVSE (10s) but i re-inject the same message to obtain a faster response. Also in the future i will need a refresh rate of 1msg/s.

If there is margin to increase the power, the increase will be limited to 2Amp / minute. This is much better than the previous “take all available power now” method, however a better algorithm is still needed to handle long high power activity periods, probably a back-off global timer can help.

Another interesting implementation is the fact that it can now handle multiple EVSE’s. Each EVSE can be assigned a name, that is used, among other things, to build the MQTT topic. Every EVSE connected will be routed to it’s own Node ID on emoncms, and is controlled independently by Node-RED. I’m thinking of defining a list of priorities so Node-RED can serve available power based on the priority of the EV. That would be sweet! My car would always charge faster than yours… lol!!

If anybody wants to test this just copy-past the flows to node-red, reconfigure email-emoncms-mqtt and use the following MQTT commands to simulate a charge:

The JSON global string named “evse_charge” to represent a charging EVSE:

    "portable_evse": {
        "mod": "P",
        "amp": "12",
        "pri": "H",
        "ttl": 3
    "garage_evse": {
        "mod": "N",
        "amp": "16",
        "pri": "L",
        "ttl": 3

Start charge:
mosquitto_pub -t evse/portable_evse/from -m "start,16,P"

This will send a email and create a JSON object from EVSE “portable_evse” with the following attributes:
Initial amp setting 16A
Initial charge mode: P (take all available power)

mosquitto_pub -t evse/portable_evse/from -m "stats,1847,1583,1345,5,9,2987,229,13.13,16,P"

This will update emoncms node “portable_evse” the elements are:

1847  = elapsed time (seconds)
1583  = energy (wh)
1345  = energy_liquid (wh)
5     = percent of battery(%)
9     = km charged (Km)
2987  = power (w)
229   = voltage (v)
13.13 = current (a)
16    = evseAmps (a)
P     = charge mode [M,N,P,S]

and pass the last 2 variables to the next function → "P,16"

End charge:
mosquitto_pub -t evse/portable_evse/from -m "stop,12992,14354,13220,69,97,111.12"

This will reconfigure the EVSE with original settings, delete the JSON object and send a email with the stats:

12992  = elapsed time (seconds)
14354  = energy (wh)
13220  = energy_liquid (wh)
69     = percent of battery(%)
97     = km charged (Km)
111.12  = Total energy of the EVSE (kWh)

The House amps need to be present for the algorithm to work:

mosquitto_pub -t evse/portable_evse/from -m "emoncms/to/2 1537,6,1,0,0,23751"

1537 = Power CT1  
6  - Current CT1
1  = pf CT1
0  = Power CT2
0  = Power CT3
23751 = Vrms X 100

At the bottom of the flows there are a lot of debug inject nodes to dump/check/inject variables and check operation.If it’s too fast the 10sec inject node at the top can be disabled and the variables will stick in memory.

This is still in heavy development, and sorry for the portuguese comments on the code.

node-red_evse.zip (5.9 KB)

Hi Cab123, great going, looks like you have created in NodeRed an equivalent to the Smart EVSE.

Responding to the post above from Glyn, attached is a photo of my final setup. I run two NodeRed programs, and decided to arrange a physical switch between the two so that I do not have to go into a computer to select which one to use. The two programs are connected to the EVSE via two emonPi UART boards, with a select switch to choose either output.

One program is designed to use the maximum possible charging rate available, which is limited to 49A (11kW) due to wiring limitations. I find that when I charge at the maximum rate overnight to utilise my off peak power rate, this maximum charge rate is nearly always available even if we are running an aircon unit. At other times it acts like your NodeRed solution, reducing and increasing the charge rate to provide a stable 55A draw from the grid. Like yourself I decided to create some headroom - in my case, 8A, or 2kW, under the 63A maximum possible. I can completely recharge the battery from a depleted state to the full 90kWh range charge overnight.

The second program utilises the same Smart EVSE algorithms to follow the solar output and maximise the charge rate to use all available solar energy. Below is the emonPi Solar graphic from 3 November showing a days charging (8:10am to 4:30pm) using only solar power. The ability of the Smart EVSE to respond to changes initiated by emonPi via NodeRed is clearly shown. The response to a few morning clouds, when the charge rate is kept at a minimum to prevent tripping, is clearly seen. Also visible at midday is the effect of turning on a twin boiler espresso coffee machine. The two thermostats cutting in and out are clearly visible between 12:30 and 1pm, as are other domestic machines being used during the day that create initial spikes that are quickly brought under control by the Smart EVSE and the emonPi serial feedback connection.

On this day, I achieved 33.06kWh charge to the EV, which equated to a gain of 157kms. Between 9am and 4pm, the energy to the car was 29.1kWh, and during this period I sold 547W to the grid. Smart EVSE was therefore able to ensure utilisation of 98% of the solar output.



That last graph is amazing! Excellent work!

I really envision this to have high demand when EV’s start to populate the homes of many.

1 Like

question Cab123, perhaps you know - I almost bought an electric car a month ago i still might, but was wondering, from the looks of these charger systems they are simply providing AC current to the car charging system. and then it using a boost converter to bump it up to the require DC voltage of 300 - 400 volts. was wondering would it not be more efficient to go through the high charge dc ports directly at 300 - 400 DC volts . which if you using a string inverter your system might be already sitting at or even if it not and then using dc boost converter or buck to adjust dc voltage – which over all would be more efficient over converting DC to AC and then back to DC again which overall probably boost your charge efficiency 20% if not more –

The issue with using DC directly to charge a car is the complexity envolved. Fast charging protocols like ChaDeMo or CCS (don’t know if underlying protocol is the same) or even the impossible Tesla proprietary protocol would make things really hard to develop on the SW side. If not impossible. And on the HW side we are talking about 400V DC systems. Even pluging directly to the traction battery would be a real mess. It’s way over the skills of even the smartest and definitely unreachable to the DIYers.

On the other hand, AC is readily available to residential consumers on some countries up to 43kW and the complexity is all inside the car’s charger. That and the simplicity of a EVSE that give instructions to the car outweights many times going the fast charging route to get that associated gain in efficiency.

Who knows? :wink:

I was thinking since they are planning and some cars already smart grid capable . as they provide energy back to the grid when required , I would of thought that they would be doing it over the DC port to a compatible 200 - 500 v GTI… so i do not think the DC port has any blocking diode to prevent reverse current , probably just a 200 or 300 amp relay. … one really would not have to worry about ChaDeMo. so much as not likely you would not be pushing +100 amps at 300 volts if you are using solar diverting system . I think the most one would expect is 10 - 30 amps and one would need to build a 300 - 500 volt MPPT solar charger that can interpret the the signal from the cars battery management system. that trigger the opening of the relay from there a basic high voltage MPPT controller should easily do the rest easy enough -I would think like the large lithium batteries banks I have currently I can hook it up to the secondary external BMS but all that does open a close connection to prevent over discharge or over charge of the batteries . but if you stay with in a certain norms , each cell has it own built in BMS to control the charge/ and discharge so cells stay balanced … the ones I have are capable of fast charge ( 80% in ~5 minutes so I am told never tried ) if I use the secondary BMS. but with out it as long as the charge does not exceed 20 amps per cell it not an issue.

so for the heck i looked through service manual for leaf and other it seams it would not be that hard they are using basically the same as JDEMO for the RAV4 just a couple big relays that connect straight to the battery off the main fuse. it be relatively easy to do. I look around to see what a stand alone inverter ( 10kw - $1700), 50 amp mppt/pwm charge controller( $230) compatible with that voltage range and see what I can do… now just to find a cheap used electric car to play around with, my problem they are rare in my province I have to go a 1000 km south, east or west to find a cheap one so that be a while

You will be better off with a battery pack than a EV, i guess…

no worries, that what i notice about this forum it not really geared toward energy saving or even reducing demand and/or resources so much, which is fine. my goals are different then most . . and electric car with a 100 - 400 km (15 - 100 kwh) of stored energy potential while the average user only uses 60 km ( 9kwh) - so one can shift daily over production to nightly consumption… a smart house/grid that relatively self contained using the least resources. ie 8-9 months out of the year using very little energy from the grid.( as I live very harsh environment compared to most on this forum.). – okay sorry for hijacking your thread a bit your input was appreciated…

Well that depends on your personal situation. I believe most of us are working with the car at the office when the sun is shining at home. Where do you store the energy then? And when you arrive home at night with the car depleted where is the excess that you can use at home? And on a sunny weekend will you go with your EV and your family somewhere or you will force yourself at home to harvest some more energy?

My opinion is that it doesn’t make sense to buy a car to store PV energy today, i as a owner cry for more range in my car to get rid of my ICE vehicle. And if you are really into energy saving, you know that it is most important to switch from ICE to EV than to fine tune inefficiencies in the charging process.

well for me my personal situation. I work from home. so generally my car is at home anyway +5 days out of the week , secondly i already have storage bank. as in a small electric utility .and small stand alone set to handle when I am away with the car . thirdly and most importantly for energy security. as I said i live fairly harsh environment. and after particular brutal storms ie ice storm , torrential rain , blizzards or other major weather events-- as they are happen more and more frequently due to the effects of climate change ( currently yearly almost) . the power has being out for several days, not personally for me but for some of my neighbours for weeks. in the summer it not bad but in the winter at -30c that’s life threatening . the cost advantage to buying a battery set in preparation of an even that only currently happens “rarely” makes no sense.So using existing resources is more prudent . also currently my power company does not have smart meter that uses time of day tariffs. but they are slowly moving to that system i would say with in 5 years . and in that case what i am doing now become extremely advantageous in the near future -
also then by your own statement what the point of your project or any project related to emon and electric car charging /diverting as your cars rarely home to take advantage of it ???

by the way when i can pick up a used Nissan leaf for less then 10,000 CAD with less then 30,000 km that 24 kwh of potential power it is a lot cheaper then buying a stand alone lithium battery pack of the same size

Well if you read carefully the discussion in this topic you will find that my goal is to minimize contracted power and maximizing charging power. Today i can’t live without it, i just plug the cord and forget. The car will be charged as fast as possible and i won’t have to compromise the utilization of energy at home.

Other have different goals or will do things in a different way. You asked for my opinion you got it. We disagree, thats fine.

as i said no worries, we have the same end goals just different ways of achieving it.you want to maximize the charging of your EV I am looking at maximizing my solar production and energy security okay again sorry for hijacking your thread - have a good day…

Nice work, the graph speaks for itself. Very impressive. I hope to do the same thing using openEVSE.

So far I’ve successfully been able to vary the charge rate of the openEVSE using RAPI commands:

I’ve just been reading up on the charging efficiency of charging a Nissan LEAF. It seems the charging is more efficient at higher currents.

Here is the full report

Interesting to know, so when reducing the charge rate when diverting from solar maybe it would be best to have a 2Kw cut off?

Please take in account the North American Standard, these tests are made at different frequency and voltage. The chargers for European market operate at different settings and that can have impact on the tests.

Practically all chargers are terrible at low voltage & low amperages. In Portugal and UK the minimum would be 230V / 240V at 6A that scores a efficiency above 80% and that’s fine for diverting in my opinion.

Also L1 and L2 are mutually exclusive, so a cutoff would has no effect, i think!

1 Like

Just seen on Indiegogo there is a company crowdfunding a solar PV charge diversion controller. Looks nice, I like how they have defined three modes of operation:

This is possible using openEVSE at the moment. I’m working to try and make it easier. It would be nice to have an EV specific Emoncms dashboard to show in real-time who much power is being diverted from solar.

1 Like

A custom dashboard would be awesome! And if you could integrate periodic feedback from carwings with the 12 SOC bars would be crazy cool!

1 Like

I’ve just started a new thread to document my current progress using NodeRED and MQTT to control OpenEVSE charge rate based on solar PV production: