Bidirectional charger with PV Hybrid inverter and pyPLC

Topics concerning vehicle to home and vehicle to grid technologies and systems
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

I think all the building blocks are there to create a (partially) open bidirectional DC EV charger.

Ingredients
- Commercial battery or hybrid inverter allowing 400V battery voltage (e.g. SMA, Growatt etc)
- Alternative 1: pure PV inverter with settable power limit and some hacked OBC for charging
- Alternative 2: use the cars OBC for charging, would require a true "Combo" CCS plug with AC pins
- BeagleBone or Raspberry running pyPLC in EVSE mode
- Powerline modem
- CCS cable

Whatever supplies DC power also needs to be able to precharge its output to the cars battery voltage. I think many OEM cars won't close their port relays otherwise.

Question: Can the powerline modem be used as-is only with patched PIB? Like capacitive coupling from L to CP?

Here is the datasheet of the Growatt
https://growatt.tech/wp-content/uploads ... 202201.pdf

I think the cars port relays would be permanently closed. Excess PV energy is dumped into the car until it can take no more (denoted by current limit or some upper SoC limit, both communicated by CCS). And when energy is needed it can be drawn from the car until a lower SoC or voltage limit is reached. It's probably most versatile to run this in parallel to the grid but of course an offgrid scenario works as well if you have a small secondary battery to supply your home while the car is gone.

I have the 11 kW MG charger here and ad my dads place a 6 kW SMA PV inverter. So not even a need to spend money on anything :)
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by uhi22 »

The prove-of-concept of a separate software-controllable precharge-supply is available here: https://github.com/uhi22/stepup-test#le ... ut-voltage
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

You've got everything :) Could also replace the bespoke voltage sense board with the input voltage report of the PV inverter
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
lewurm
Posts: 13
Joined: Mon Jul 17, 2023 1:41 am
Has thanked: 19 times
Been thanked: 8 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by lewurm »

Another useful ingredient could be this: https://github.com/dalathegreat/Battery-Emulator
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by uhi22 »

johu wrote: Mon Jun 10, 2024 8:29 am Question: Can the powerline modem be used as-is only with patched PIB? Like capacitive coupling from L to CP?
Yes, this should be fine. Even just running CP and L in the same cable for a meter should most likely be sufficient coupling.
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

As a winter project I'm considering making a BeageBone cape that has the powerline modem and stateC switching on it, maybe also some serial or CAN port.

Could use some input on how to make the apparently existing qca-spi Linux driver work.
https://github.com/qca/qca7000
https://github.com/torvalds/linux/blob/ ... /qca_spi.c

It's been a while since I did kernel hacking
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by uhi22 »

I understood that the spi ethernet driver is already included in current distributions. No idea where I got this info from ;-)

Edit: https://forums.raspberrypi.com/viewtopic.php?t=337718
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

I found the qcaspi module isn't compiled by default so I have to do something like this https://docs.beagleboard.org/latest/boo ... ernel.html

So far I failed to find the appropriate source code.

UPDATE: got the module to load without even the QCA connected

Had to use a kernel version matching the running kernel
https://github.com/RobertCNelson/ti-lin ... nux-4.19.y

and modify the Makefile

Code: Select all

# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Qualcomm network device drivers.
#

obj-m += qca_7k_common.o
obj-m += qcaspi.o
qcaspi-objs := qca_7k.o qca_debug.o qca_spi.o
obj-m += qcauart.o
qcauart-objs := qca_uart.o

obj-y += emac/

obj-m += rmnet/

KDIR  := /lib/modules/$(shell uname -r)/build

all:
	make -C $(KDIR) M=$$PWD
Now just have to find out which SPI device this is expected to connect to and which is the correct /CS and INT pin
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

Hmm, it no longer boots with the QCA overlay configured.
It doesn't seem like it's related to the QCA overlay but with it removed it boots up fine

Code: Select all

U-Boot SPL 2019.04-00002-g07d5700e21 (Mar 06 2020 - 11:24:55 -0600)
Trying to boot from MMC2
Loading Environment from EXT4... Card did not respond to voltage select!


U-Boot 2019.04-00002-g07d5700e21 (Mar 06 2020 - 11:24:55 -0600), Build: jenkins-github_Bootloader-Builder-137

CPU  : AM335X-GP rev 2.1
I2C:   ready
DRAM:  512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Global external warm reset has occurred.
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4... Card did not respond to voltage select!
Board: BeagleBone Black
<ethaddr> not set. Validating first E-fuse MAC
BeagleBone Black:
Model: SeeedStudio BeagleBone Green:
BeagleBone: cape eeprom: i2c_probe: 0x54:
BeagleBone: cape eeprom: i2c_probe: 0x55:
BeagleBone: cape eeprom: i2c_probe: 0x56:
BeagleBone: cape eeprom: i2c_probe: 0x57:
Net:   eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 0 seconds
board_name=[BBG1] ...
Card did not respond to voltage select!
Card did not respond to voltage select!
Card did not respond to voltage select!
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
Card did not respond to voltage select!
Card did not respond to voltage select!
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc1(part 0) is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
Checking for: /boot.scr ...
Checking for: /boot/boot.scr ...
Checking for: /boot/uEnv.txt ...
gpio: pin 55 (gpio 55) value is 1
2068 bytes read in 15 ms (133.8 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt...
gpio: pin 56 (gpio 56) value is 1
Running uname_boot ...
loading /boot/vmlinuz-4.19.94-ti-r42 ...
10095592 bytes read in 655 ms (14.7 MiB/s)
debug: [enable_uboot_overlays=1] ...
debug: [enable_uboot_cape_universal=1] ...
debug: [uboot_base_dtb_univ=am335x-boneblack-uboot-univ.dtb] ...
uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot-univ.dtb] ...
uboot_overlays: Switching too: dtb=am335x-boneblack-uboot-univ.dtb ...
loading /boot/dtbs/4.19.94-ti-r42/am335x-boneblack-uboot-univ.dtb ...
162266 bytes read in 44 ms (3.5 MiB/s)
uboot_overlays: [fdt_buffer=0x60000] ...
uboot_overlays: loading /lib/firmware/M-BB-BBG-00A0.dtbo ...
423 bytes read in 183 ms (2 KiB/s)
uboot_overlays: loading /lib/firmware/BB-ADC-00A0.dtbo ...
867 bytes read in 381 ms (2 KiB/s)
uboot_overlays: loading /lib/firmware/BB-SPI0-QCA7K-0A00.dtbo ...
1695 bytes read in 132 ms (11.7 KiB/s)
failed on fdt_overlay_apply(): FDT_ERR_NOTFOUND
uboot_overlays: loading /lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo ...
1584 bytes read in 366 ms (3.9 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
failed on fdt_overlay_apply(): FDT_ERR_BADMAGIC
base fdt does did not have a /__symbols__ node
make sure you've compiled with -@
uboot_overlays: loading /lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo ...
3801 bytes read in 39 ms (94.7 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
failed on fdt_overlay_apply(): FDT_ERR_BADMAGIC
base fdt does did not have a /__symbols__ node
make sure you've compiled with -@
loading /boot/initrd.img-4.19.94-ti-r42 ...
6589689 bytes read in 433 ms (14.5 MiB/s)
debug: [console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet] ...
debug: [bootz 0x82000000 0x88080000:648cf9 88000000] ...
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree
** Invalid partition 2 **
** Invalid partition 3 **
** Invalid partition 4 **
** Invalid partition 5 **
** Invalid partition 6 **
** Invalid partition 7 **
starting USB...
USB0:   Port not available.
cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT !
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
musb-hdrc: peripheral reset irq lost!
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17
BOOTP broadcast 18
BOOTP broadcast 19
BOOTP broadcast 20
BOOTP broadcast 21
BOOTP broadcast 22
BOOTP broadcast 23
BOOTP broadcast 24
BOOTP broadcast 25
BOOTP broadcast 26
BOOTP broadcast 27
BOOTP broadcast 28
BOOTP broadcast 29

Retry time exceeded; starting again
missing environment variable: pxeuuid
Retrieving file: pxelinux.cfg/01-e4-15-f6-f6-5c-90
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/00000000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/0000000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/000000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/00000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/0000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/00
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/0
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/default-arm-am33xx
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/default-arm
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Retrieving file: pxelinux.cfg/default
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `ipaddr' not set
Config file not found
starting USB...
USB0:   Port not available.
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC e4:15:f6:f6:5c:8e
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17
BOOTP broadcast 18
BOOTP broadcast 19
BOOTP broadcast 20
BOOTP broadcast 21
BOOTP broadcast 22
BOOTP broadcast 23
BOOTP broadcast 24
BOOTP broadcast 25
BOOTP broadcast 26
BOOTP broadcast 27
BOOTP broadcast 28
BOOTP broadcast 29

Retry time exceeded; starting again
I think the actual problem here is "Did not find a cmdline Flattened Device Tree" while on a good boot this says "Flattened Device Tree blob at 88000000"

And my dtc

Code: Select all

/*
 * Copyright (C) 2019 Tomas Arturo Herrera Castro <taherrera@uc.cl>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 * 
 * Written as part of my master's thesis at PUC Chile,
 * to run the BeagleBone as an OpenThread Border Router w/o an NCP.
 *
 * http://www.sltech.cl
 *
 * Compiled using: make ./src/arm/BB-SPI0-AT86RF233-00A0.dtbo
 *
 * Tested on BeagleBone Black Rev. C + REB233-XPRO. Linux beaglebone 4.14.71-ti-r80.
 *
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>

/ {
	compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";

	/* identification */
	part-number = "BB-QCA7000";
	version = "00A0";

	/* state the resources this cape uses */
	exclusive-use =
		/* the pin header uses */
		"P9.15",	/* P9_15 (U18) INT */
		"P9.17",	/* P9_17 (A16) spi0_cs0.spi0_cs0 */
		"P9.18",	/* P9_18 (B16) spi0_d1.spi0_d1 */
		"P9.21",	/* P9_21 (B17) spi0_d0.spi0_d0 */
		"P9.22",	/* P9_22 (A17) spi0_sclk.spi0_sclk */
		/* the hardware ip uses */
		"spi0";

	/*
	 * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
	 */
	fragment@0 {
		target-path="/";
		__overlay__ {

			chosen {
				overlays {
					BB-SPI0-QCA7000-00A0 = __TIMESTAMP__;
				};
			};
		};
	};

	/*
	 * Free up the pins used by the cape from the pinmux helpers.
	 */
	fragment@1 {
		target = <&ocp>;
		__overlay__ {
			P9_17_pinmux { status = "disabled"; };	/* P9_17 (A16) spi0_cs0.spi0_cs0 */
			P9_18_pinmux { status = "disabled"; };	/* P9_18 (B16) spi0_d1.spi0_d1 */
			P9_21_pinmux { status = "disabled"; };	/* P9_21 (B17) spi0_d0.spi0_d0 */
			P9_22_pinmux { status = "disabled"; };	/* P9_22 (A17) spi0_sclk.spi0_sclk */

			P9_15_pinmux { status = "disabled"; };	/* irq P9_15 (R13) gpmc_a0.gpio1[16] */
		};
	};

	fragment@2 {
		target = <&am33xx_pinmux>;
		__overlay__ {
			bb_qca_pins: bb_qca_pins {
				pinctrl-single,pins = <
					AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_INPUT_PULLDOWN, MUX_MODE7)
				>;
			};
			spi0_qca_s0: spi0_qca_s0 {
				pinctrl-single,pins = <
					AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE0) /* P9_22 (A17) spi0_sclk.spi0_sclk */
					AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT, MUX_MODE0)   /* P9_21 (B17) spi0_d0.spi0_d0 */
					AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT, MUX_MODE0)   /* P9_18 (B16) spi0_d1.spi0_d1 */
					AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT, MUX_MODE0)  /* P9_17 (A16) spi0_cs0.spi0_cs0 */
				>;
			};
		};
	};

	fragment@3 {
		target = <&spi0>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;

			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <&spi0_qca_s0>;

			qca7000: ethernet@0 {
				compatible = "qca,qca7000";
				reg = <0x0>;
				interrupt-parent = <&gpio1>;      /* GPIO Bank 1 */
				interrupts = <16 0x1>;            /* Index: 16, rising edge */
				spi-cpha;                         /* SPI mode: CPHA=1 */
				spi-cpol;                         /* SPI mode: CPOL=1 */
				spi-max-frequency = <8000000>;    /* freq: 8 MHz */
				local-mac-address = [ A0 B0 C0 D0 E0 A1 ];
			};
		};
	};
};
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

I am now collecting hardware to ponder on
a) A CCS connector for 90€ from AliExpress
b) A hybrid inverter (GoodWe ET 5 kW)
The CCS controller I've already got in forms of a BeagleBone and a modded dlink modem.

I'll wire up the CCS connector with 5x2.5mm² cable. I'll run like 15A max so that is perfectly sufficient and easy to handle.

Today I added an MQTT backend to pyPLC to be more flexible with the inputs and outputs
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Bigpie
Posts: 1719
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 377 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by Bigpie »

Does it make sense to write a CCS module for dalas battery emulator? There's already Chademo
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

I'm not sure. Usually the platform that handles CCS has enough horse power to handle the inverter communication alongside. E.g. the BeagleBone has also 2 CAN interfaces and 4 UARTs.

So in this very case I will go steal Dalas code for inverter bms communication and rewrite it in python.

Should a Foccci be used later on it can be configured as a CHAdeMO bridge and battery emulator can be used as is
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
jrbe
Posts: 483
Joined: Mon Jul 03, 2023 3:17 pm
Location: CT, central shoreline, USA
Has thanked: 149 times
Been thanked: 139 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by jrbe »

I have a bunch of bidirectional DC-DC White papers / design references I have been collecting that I could share. It's there anywhere on this site I could add them?
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by uhi22 »

Is it possible to add documents into wiki pages? If yes, I would propose to create a wiki page for this topic.
jrbe
Posts: 483
Joined: Mon Jul 03, 2023 3:17 pm
Location: CT, central shoreline, USA
Has thanked: 149 times
Been thanked: 139 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by jrbe »

I believe so.

Would it make sense to make a references section? A dev. Section? Trying to eliminate clutter for finished items but give a place to share useful info / resources.
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by uhi22 »

Created a page in the wiki https://openinverter.org/wiki/Bidirectional_Charging as a starting point.
jrbe
Posts: 483
Joined: Mon Jul 03, 2023 3:17 pm
Location: CT, central shoreline, USA
Has thanked: 149 times
Been thanked: 139 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by jrbe »

I just looked, I have about 30 DC-DC and related items I've found online. This link is open for whoever wants them, https://drive.google.com/drive/folders/ ... sp=sharing

Edit, sorry for the extra steps. I didn't want to dump all of this there, I'm not sure if any are of interest.
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

Picked up a 5 kW hybrid PV inverter today (SunGrow SH5.0). Now all the building blocks are complete and I "just" need to combine them.

Now keep in mind this project isn't about power electronics at all. All power is handled by a commercial PV inverter. It's just the control logic that is being brewed here.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

Every legit prototype starts out on wood :)

Dual fuse for the battery connection. pyPLC works as expected on the BeagleBone that already runs my ESS. The little dog will be very busy.

Still figuring out the details of the SunGrow inverter. It looks much like its input doesn't need precharging, there is just 0.5 uF and no visible power electronics. So I think there is an internal relay.

Also trying to figure out whether I actually need to emulate a BMS or if I can just set the inverter to lead acid mode.
UPDATE: no, lead acid mode is not available on this model

I have found libraries and documents here: https://github.com/bohdan-s
Attachments
1730987853582.jpg
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

Almost made it! But just as the inverter wanted to start charging the GFCI tripped :(

Modified SunGather (https://github.com/bohdan-s/SunGather) to write to various modbus registers. It is important to know that the register number from the manual must be subtracted by one to hit the correct one. So if the manual says 13050 we pass 13049 to the write function. Weird.

Initial setup (is stored internally and only needs to be done once):

Code: Select all

inverter.client.write_register(13083, 7) #Set Start Charging Power to 70 W, the lowest possible
inverter.client.write_register(13084, 7) #Set Start Discharging Power to 70 W, the lowest possible
inverter.client.write_register(13049, 2) #Set battery control mode to manual
Now whenever we receive a power setpoint we do

Code: Select all

direction = 0xCC;
    
if power > 0:
    direction = 0xAA
elif power < 0:
    direction = 0xBB

inverter.client.write_register(13050, direction)
inverter.client.write_register(13051, abs(power))
Attachments
bydcan.py.txt
(3.8 KiB) Downloaded 73 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

We have liftoff!

Connected PE to N so no capacitive coupling to PE and no GFCI trip.

Charged and discharged the car with 1 kW and it worked a treat!

Thanks Dala for his BatteryEmulator, Uhi for pyPLC and bohdan-s for SunGather :)

Video coming

Now comes the integration and usability plus a little voltage source for precharging OEM cars.
Attachments
1731174058907.jpg
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

Early forum release

Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

More experiments today. I did not manage to tell the inverter to precharge its output. It's ok for Touran as it doesn't care but I want it to work with OEM cars, too.
The voltage that is reported as bus_voltage is measured behind the internal boost converter and pretty much fixed at 600V. When feeding voltage into one of the PV inputs though this can also be seen on bus_voltage.
So far the voltage isn't really needed, again because Touran doesn't care. But I think OEM cars will hickup when CCS reported voltage does not match actual battery voltage.
I think a non-isolated differential voltage sensor with some mega-ohm resistors will do the trick. The LV side is earth referenced anyway.
Could then just hook up a little boost converter IC to a 1:20 transformer and connect it's feedback pin to the voltage sensor.

I set the output power to 5 kW. That consumed 4969 W from the grid and 4750 W came out the DC side - 95.5% efficient and thus better than the Mitsu charger. Also since the load is distributed between the 3 phases (7.6A each) the voltage drop between the meter and the inverter is much lower compared to charging 14.5A single phase. So an additional efficiency gain there.

Finally tidied stuff up and hooked up the switch to the existing DIN rail supply in place of its lossy 50 Hz transformer
1731365622197.jpg
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1316 times
Contact:

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by johu »

Currently running some experiments about a voltage source. Must say I'm not too fond of home-brew transformer solutions, they seem to require a lot of tuning and seem hard to come by off-the-shelve.

So now I'm thinking of using the standard gate drive circuit
grafik.png
grafik.png (8.86 KiB) Viewed 3290 times
with a HV FET or small IGBT and like 100uH inductor. Instead of the DC/DC converter I'd just use a 24V DIN rail supply to supply gate drive power and actual HV power.
And this driver is cheaper: https://jlcpcb.com/partdetail/TexasInst ... R/C2864438

Did some tests with 50 kHz and 10k || 0.5 uF and 20V input voltage. It basically does what you'd expect. Reached 150V@50% duty cycle and had a smoking 10k resistor :)

For voltage sensing I'd recycle this one:
grafik.png
grafik.png (8.71 KiB) Viewed 3290 times
Maybe some optional host micro? ESP module or something. Doesn't need to do much, closed loop voltage control and comms of some kind
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: Bidirectional charger with PV Hybrid inverter and pyPLC

Post by uhi22 »

Puuh, non-isolated high voltage sensing sounds quite ugly. Could interfere if the inverter would do isolation monitoring. I think I have seen somewhere simple and cheap isolated solutions, consisting of opamp and optocouplers, and a small DC/DC.

Edit: Found something here: https://www.mikrocontroller.net/attachm ... tV1zu1.png and here: https://www.mikrocontroller.net/topic/431858 and here: https://www.electroschematics.com/linea ... -isolator/
Post Reply