Charging control of an electric vehicle using surplus production from a photovoltaic system

Summary / TLDR

I have successfully programmed a charging control system for my electric vehicle using surplus production from my photovoltaic (PV) system. By leveraging a fork of EVCC, I managed to charge my car 80% from PV surplus and 20% from purchased electricity over the past three month without needing a Wallbox (just using charging brick (Ladeziegel))

Use Case

I have a 5.04 max kWp PV system on my roof and use a Green-up socket with a 1-phase 10-16 A 240 V charging device (Ladeziegel) to charge my electric vehicle (Volkswagen ID.x). This setup supports our short-distance usage, typically I drive only 2-20 km per day. I needed an automated solution to optimize charging times based on the state of charge (SOC) and PV production, aiming to save on energy costs by maximizing the use of surplus solar energy.
I wanted a fully automated solution without investing into high-cost wallbox solution or modifications to my home installation.

Introduction to EVCC

EVCC is a comprehensive platform designed to manage electric vehicle charging using various energy sources, including solar power. It supports multiple chargers and meters, providing flexibility and control for efficient energy management.

Why I Couldn’t Use EVCC as Is

While EVCC offers a robust framework, it lacked specific functionalities I needed for my setup. For details, refer to the discussion here. My primary challenges were:

  • Inability to access consumption data from my Eltako DSZ12E meter locally.
  • Need for integration with SolarEdge and VW WeConnect APIs.
  • For short distances I don’t need a wallbox, and since I only use a 240 V charging device which has no API I couldn’t use the evcc charger plug-ins

Changes in My Fork

I made several modifications to the EVCC codebase to address these issues:

Using SolarEdge REST API as a Meter

My Eltako DSZ12E meter transmits data to the SolarEdge cloud but lacks local access. I utilized Ulrich Schreiner’s go tool (GitHub link) to fetch data from the SolarEdge REST API. Changes include:

  • Nighttime polling interval: 15 minutes
  • Daytime polling interval: 3 minutes
  • Ensured compliance with SolarEdge API request quota (300/day)

You can access my fork here

Using WeConnect API with Charge Brick (Ladeziegel) as a Charger

To avoid the expense of a wallbox, I used the WeConnect API to control charging via my car’s charging device. My solution:

  • Automates charging based on SOC (charge between 30% and 80% when PV production is sufficient).
  • Utilizes S0 800 Imp/kWh meter for monitoring.
  • Uses the WeConnect API as evcc charger be implementing a bridge charger module that talks to WeConnect instead of a charger to start/stop charging.

See the definition of the charger based on charge brick in my evcc yaml here

Deployment

Both, the evcc service and the solaredge service are deployed as systemd services on a Raspberry 3 (which I already had and which is also used for other services).

I run the web console in my home network and can access and control it from my home network. If I occasionally need to control it remotely I can do so using VPN into my home network.
Thus I avoided the complexity of hardening the service against security vulnerabilities.

Summary and Report of My Charging History

Over the past three months, my system has efficiently managed the charging of my electric vehicle. Here are the key results:

  • 80% of the charging was from PV surplus production.
  • 20% was from purchased electricity.
  • Estimated annual savings: 280 Euros (based on energy tariff and PV reimbursement rates).

By adapting EVCC with custom code and avoiding significant hardware investments, I achieved an efficient and cost-effective charging solution without buying a Wallbox - just using public APIs of both my car and my PV.

Feel free to explore my forks and modifications on Github for evcc and solaredge-go-library. Your feedback and suggestions are welcome!