Diverting Solar to Charge an Electric Car

follow up from here: Diverting Solar to Charge an Electric Car | Archived Forum

Hi, let me join the fun and present my implementation of electric car energy management system:

It basically revolves around this Node-Red scheme and a custom made EVSE built with a ESP8266:

So after my EVSE is turned on, it connects t my home wifi, connects to the MQTT broker and sends a “EVSE Ready” message that is relayed to my mailbox to let me know it’s alive.

After that I can connect to the EVSE using a browser and determine the charge mode – Manual – Power – Solar.

2016-03-30-223427

  • Manual does nothing,
  • Power optimizes the power delivered to the car according to the remaining power available.
  • Solar doesn’t allow negative power (injection), but always charges the car at a absolute minimum of 6A.

It is impossible to charge at lower power so I might as well keep the car charging jut to avoid injection of energy. I have a Nissan Leaf, and fortunately it’s not as unefficient as the Zoe.

When a charge starts, a new message is sent from the EVSE, captured by Node-RED and sent to my email. Aditionally the EVSE starts to send every 10 seconds all the statistics to MQTT. NODE-RED captures that and posts the data to emoncms.

This data is further processed in “MAGIA!!” function that, along with the total house consumption, determines if the EVSE needs to adjust the charging amps. If the power is above the contracted rate it will immediately slow down the charge. If there is margin to increase the charge amps it will be throttled to 1 change per minute.

From my experience i find the Power mode to be the most interesting. I can charge the car at peak usage times, like lunch or dinner at a about 25Amps. My contracted power is 30Amps and the leaf can go as high as 29 amps. The Solar diverter keeps the car charging slowly and cannot be more precise than 1amp. Still it works at preventing injecting surplus energy to the grid.

Let me know what you think.

PS: moderators, can you please help transforming the links into images. I , as a “new” user, couldn’t post more than 1 image and more than 2 links…

BR

Edit - attached images to post per OP’s request. BT- moderator

3 Likes

Not any more, your profile has been updated.

Paul

I quite don’t understand all of that, but it sounds really interesting! How much does it cost to make?

I’d like to buy a 2nd hand EV and charge it from my rooftop solar PV, but the main thing that had put me off is that I couldn’t find a suitable charging system. I was going to wire up a standard external socket and manually set the car charging at 6A whenever it looked sunny… :disappointed:

This is great, was it your screenshot I saw on twitter?

Any details of the EVSE setup your using, are you using a Viridian charge controller?

If so are you using a voltage to the IC pin?

I want to get something like this up and running eventually, at the moment I am using “Wife Remote” - MQTT emails her when we have a lot of export to plug in if the car and her are at home…

See the link in my post above to the charge controllers from ecoharmony, this is the best way to get a variable charge rate EVSE you can integrate with I have found so far.

EDIT: This may also interest others looking at similar project:
https://store.openevse.com/

Thanks for that. I’d love to see a HOWTO article showing which components to buy and step-by-step how to build a simple charger, that can integrate with openenergymon.

Hi! Unfortunately i have found no use for my twitter account since i opened it so definitely it was not me.

I was so happy with the discussion of this topic here that i jumped directly to the end, sorry guys for that.

What makes all of this work is my custom made EVSE build from scratch with mqtt built in as a bidirectional communication protocol. I can start and stop charge and change amps over wifi. Additionally it has energy sensor running from a pzem-004 with serial interface that you can find at ebay for a nice price. So actually right now this isn’t something available as a product, and i’m not aware of any product with this remote functionality built in ready to use.

What i am finding out is that diverting surplus energy to a car can only be made with rough calculations, the granularity is 1A and the minimum charge power is 6A. Perhaps that is too much to ask for in a rainy day even for a decent pv array. Adding to that we have the inefficiency of slow charging from the built in chargers of the EV’s. The only positive factor actually is the idea of charging the car for free from solar, and from eventually and otherwise wasted PV energy.

Well if you did decide to make it into a finished product to buy, I’d certainly be interested and I think a lot of other people would be too. Or perhaps a kit with detailed instructions that people can put together?

The Viridian/Mainpine controller comes in 16/32/63A and has charge control in 1Amp steps according to the documentation:

> The maximum current that the EPC will advertise to the EV can be configured from 6A to the
> maximum rating of the EPC (as selected when purchasing) in 1A steps by connecting a simple
> resistor1
> between the IC and 0V terminals of the EPC. This functionality can be integrated into smart
> systems allowing for control of EV charging current, as well as limiting the maximum current
> available from the EPC. The IC pin can also accept a 0-5V input enabling the Viridian EPC to be
> integrated into a wide variety of systems.

So that should give a flexible option, I intend to explore this further when I get time, but its way down the list of jobs - and your looking at around £300-£350 in parts for just the EVSE it seems.

Hi, in my opinion the best approach in the short term would be to build a openevse, it is very similar to building a emontx and is relatively cheap. It has a API called RAPI where you can set/get data. They have also implemented a aditional Esp8266 that takes care of wireless communication with the EVSE. Between that and this Viridian the openevse may result in a much cheaper/powerfull implementation.

And between my self made EVSE and openEVSE the last one would be better since it is fully compliant with the norm in every aspect that i am aware of. The only thing missing would be MQTT implementation, but you just need to get Node-RED to reach the EVSE or implement a add-on on top of the ESP8266 code that is available from the openevse creators git.

BR

Hi. Thank you for sharing the above regarding charging an EV. I have decided to try to do this myself, using SmartEVSE and the emonPi. SmartEVSE has some really good algorithms that are used to dynamically control the charging current. It cannot be directly used with excess Solar as their CT’s are DC powered and not bi-directional. I need to emulate and trick the required SmartEVSE input from the emonPi, which I believe is possible using Node-Red MQTT calls. However I do not know how to physically join the SmartEVSE (which has a 2 wire terminal connection for its own CT input) to the emonPi, nor do I know how to direct the required Node-RED output to a suitable physical connection terminal. I am happy to remove the emonPi case to expose possible additional terminals if this is required. Can anyone provide any guidance on how to physically and programmatically output from emonPi? Many thanks for any assistance.

K

Hi Keith, i’m sorry i’m unable to help you with your integration, from what i see from smartevse it has a external box with CT’s that is somehow connected to the EVSE. If you understand what goes into that connection maybe you can simulate the desired operation, i don’t know.

But if your goal is to divert surplus energy from solar prepare to be dissapointed. It sure looks cool, but in practice what will happen is:

  • you will buy energy from the grid at possible higher price to meet the minimum 6A charging of the EV. And part of that energy is wasted in inneficiency because:
  • Charging at 6A has less overall efficiency, for the Nissan Leaf the numbers go down to 78% efficiency @ 6A and for the Renault Zoe, you get a ridiculous 54% efficiency at 10A!!

the really good feature that comes out of this is the ability to automatically control the maximum energy you can use without tripping the utility company circuit breaker. The possibility of charging depending on solar is actually a side effect of this system and is great for marketing purposes lol

I have been working on the EVSE side on my free time to make it available as open source and kind of forgot this node-red part, the charge algorithm function actually needs improvements. Maybe if there is interest i can share the actual code of the function.

BR

Hi BR. Thanks for the reply. I am aware of the communication protocol between the CT sensorbox and the Smart EVSE, and I am not sure if Node RED will be able to emulate this connection. You are correct about the benefit of maximising the charge rate; here in Oz I have a 63A grid supply plus a 20A Solar feed; allowing the Smart EVSE to determine the charge rate has given me over 50A (connection cable limited). Without this program and using connected electrical load rules I had to changeover between air-conditioning or the 32A max EVSE. I often manually adjust the Tesla charge rate to match the available solar power; by starting at 8A, incrementing up to 18A for a number of hours then decrementing back to 8A I can gain over 16kWh on a good winters day without using the grid, 22kWh plus in summer. My requirement is to automate this, and on a bad day (passing clouds) just have a few instances of a minimum 6A, when I might end up paying for a few kWh at 17c AUS per hour (non-peak rate). The Smart EVSE algorithms are really excellent and it is just the connection between this and the emonPi I need to resolve. Have you been able to physically connect between your solution hardware, and if so, how did you arrange the output from emonPi?

K

Maybe you need a “driver” o talk to the EVSE. What kind of communication protocol is implemented? Is it available and documented?

My evse is MQTT native so integrating it with node-red is really easy.

No dia 06/08/2016, às 13:38, Keith [email protected] escreveu:

keithfromoz Keith
August 6
Hi BR. Thanks for the reply. I am aware of the communication protocol between the CT sensorbox and the Smart EVSE, and I am not sure if Node RED will be able to emulate this connection. You are correct about the benefit of maximising the charge rate; here in Oz I have a 63A grid supply plus a 20A Solar feed; allowing the Smart EVSE to determine the charge rate has given me over 50A (connection cable limited). Without this program and using connected electrical load rules I had to changeover between air-conditioning or the 32A max EVSE. I often manually adjust the Tesla charge rate to match the available solar power; by starting at 8A, incrementing up to 18A for a number of hours then decrementing back to 8A I can gain over 16kWh on a good winters day without using the grid, 22kWh plus in summer. My requirement is to automate this, and on a bad day (passing clouds) just have a few instances of a minimum 6A, when I might end up paying for a few kWh at 17c AUS per hour (non-peak rate). The Smart EVSE algorithms are really excellent and it is just the connection between this and the emonPi I need to resolve. Have you been able to physically connect between your solution hardware, and if so, how did you arrange the output from emonPi?

K

Visit Topic or reply to this email to respond.

In Reply To

cab123
August 6
Hi Keith, i’m sorry i’m unable to help you with your integration, from what i see from smartevse it has a external box with CT’s that is somehow connected to the EVSE. If you understand what goes into that connection maybe you can simulate the desired operation, i don’t know. But if your goal is t…
Visit Topic or reply to this email to respond.

Again, many thanks for your interest. Smart EVSE is open source. Their Charge Controller connects to the CTs via their sensorbox which is also open source. Both programs are here:

The sensorbox program (“CurrentTX.c”) is well commented and has the following:
“Send buffer over RS485. Use PPP in HDLC-like Framing for transfers for protocol spec see:
http://tools.ietf.org/html/rfc1662
compatible with existing RS485 line used on SMA solar inverters.
baudrate is 1200 bps”
In my silly naive way I thought that NodeRED (designed to connect things together) would have a node that converted to this protocol, and that being Raspberry Pi based getting data in and out would be configurable. I am still hoping, as the combination of the Smart EVSE and emonPi would satisfy a growing demand to control EV charging at a user (not programming) level. I have always been optimistic…

K

So you need to tap into RS485 communication, i have had a similar chalenge
in the past, when i needed to get my solar inverter statistics to post to
emoncms. For my specific inverter, a Aurora PVI, the communication is
RS485. I used a dongle like this one (
http://www.ebay.com/itm/USB-to-RS485-TTL-Serial-Converter-Adapter-FTDI-interface-FT232RL-75176-Module-Ne-/161264238508?hash=item258c18ffac:g:c5gAAOSwT~9Wj4nl)
and then connect to raspberry pi USB port.

But in my case it was easier, since there is already a program that queries
the inverter an delivers data. I only had to make a small script that
executes the programand sends the results to emoncms and a MQTT topic to be
used by node-red directly.

Maybe you can do a similar hardware connections, and ask the smarevse
developer if there is any chance to make a scipt available to talk to the
EVSE.

From there it would be simple to make it available for processing in
node-red.

If you can make the evse work at the bash on the rpi i can assist you into
making a simpe script to talk to the EVSE through MQTT

Best Regards

Hi Keith,

I hope you don’t mind me answering your email on this thread. Hopefully, it will be of benefit to other users.

Node RED gathers data from the emonPi inputs by selecting the mqtt node and setting up the node using Server: localhost:1883, Topic:emon/emonpi/XXXX (the input name).

Correct :slight_smile:

Q1: What do I do to set up a Node RED input for a feed, or a virtual feed (NOT AN INPUT)?

Sorry, I don’t quite understand. Do you want to send data from NodeRED to Emoncms? This can be done using MQTT or nodeRED Emocnms node. This has been covered in this thread:

I want to use the serial output node.

Q2: What do I do to select a Raspberry Pi serial output (presumably a pin pair, but anything available will do as long as I can get a serial output)?

The RaspberryPi only has a single hardware UART which is used to communicate with the emonPi. To have a second serial output you will need to either use software serial which I don’t recommend or add another hardware serial port. This can be done by adding a USB to UART adapter then using nodeRED serial out to output serial data to /dev/ttyUSB1 or whatever the adapter is mounted.

1 Like

Hi, and thank you.
What I tried to convey was that I understand how to input to Node RED an item of data from the emonPi input, but I want to input an item of data from a virtual feed. This is because a virtual feed can be constructed from multiple inputs and feeds within emonPi, and I would like this value as an input to Node RED. I cannot calculate the required value within Node RED as it is an interaction between several inputs/feeds. Can Node RED access a feed value, and if so how?

K

NodeRED Emoncms node can be used to access latest feed value from Emoncms.

You will need to log virtual feed to a feed in Emoncms than node the feed ID number. Emoncms nodeRED node can then be used to read this feed using Emoncms APi. The emoncms node is pre-installed on nodeRED running on emonPi / emonBase:

Hi, why do you want to build the charging algorithms in emoncms?

You need to bring the smartevse to node-red environment and keep it there for making EV-charge algorithms. With a script or by manipulating a serial interface directly it doesn’t matter.

Also you can export any emoncms feed to MQTT and use it on node-red. Depending on the source of your original feeds you can even publish them directly to emoncms AND MQTT.

In my opinion this is much simpler and powerfull approach.