Resol DeltaSol C solar heating water tank in Domoticz

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.

Moderator: leecollings

Post Reply
actyln
Posts: 5
Joined: Saturday 31 October 2020 12:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Resol DeltaSol C solar heating water tank in Domoticz

Post by actyln »

Hello,

I'm sharing here my setup to read a Resol DeltaSol C solar heating water tank.

The concept is the following:
SolarTank.png
SolarTank.png (9.33 KiB) Viewed 649 times
There is a solar panel on the roof of my house, connected to a water tank through a pump.
The pipes are filled with glycol and the pump runs roughly when the panels are hotter than the tank.
The system is equipped with 2 temperature sensors, at the panels and the tank.

The controller supports the VBUS protocol and pushes its internal variables to this bus:
regulateur-de-temperature-differentiel-deltasol-cs-plus-avec-4-sondes-nouveau.jpg
regulateur-de-temperature-differentiel-deltasol-cs-plus-avec-4-sondes-nouveau.jpg (19.13 KiB) Viewed 649 times

Based on the rich content found on a few websites, I've decided to connect this controller to Domoticz:
Protocol specification
Deltasol C packets
VBUS protocol parser
Inspiration for the hardware

The main issue was the distance between the water tank on which is attached the controller, and my RPi running Domoticz.
I could not put any wired link between them. Here comes the ESP8266 and EspEasy !

I modified the original schematic to include our favorite WiFi chip:
schematic.PNG
schematic.PNG (37.17 KiB) Viewed 649 times
actyln
Posts: 5
Joined: Saturday 31 October 2020 12:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Resol DeltaSol C solar heating water tank in Domoticz

Post by actyln »

I limited the PCB size to 5cm x 5cm top save on the price on iTeadStudio:
PCB.PNG
PCB.PNG (86.37 KiB) Viewed 647 times
The installation is fairly simple: just connect the system in parallel to the controller mains and connect the 2 VBUS wires with a twisted pair.

Then you need to flash the ESP8266 with the ESPEasy firmware and declare a "Serial Server" in the device list:
esp.png
esp.png (10.78 KiB) Viewed 647 times
This way, the ESP is acting as a Serial to TCP/IP bridge. Everything it receives on its RXD pin will be forwarded on the configured TCP socket.
Same in the opposite way, except that I never used the TX part (R11, IC2B, R10, T1, R16). I left these parts unmounted.

The remaining is at software level on the Raspberry Pi !

You can try checking for received bytes:

Code: Select all

sudo apt-get install socat
socat pty,link=/dev/ttyVBUS,raw tcp:192.168.0.103:23&
Now you have a /dev/ttyVBUS virtual tty device on which you should be able to receive the bytes from the VBUS controller:

Code: Select all

sudo cat /dev/ttyVBUS |hexdump

0000000 00aa 1200 2042 0500 0000 0000 0000 0600
0000010 10aa 1200 1042 0100 0307 0025 0126 3201
0000020 2238 2238 4605 0000 0200 7d00 036f 0000
0000030 0d00 0000 0000 7f00 0000 0000 7f00 0003
0000040 0000 7c00 00aa 1200 2042 0500 0000 0000
0000050 0000 0600 10aa 1200 1042 0100 0307 0025
0000060 0126 3201 2238 2238 4605 0000 0200 7d00
0000070 036f 0000 0d00 0000 0000 7f00 0000 0000
0000080 00aa 1200 2042 0500 0000 0000 0000 0600
0000090 10aa 1200 1042 0100 0307 0025 0126 3201
00000a0 2238 2238 4605 0000 0200 7d00 036f 0000
00000b0 0d00 0000 0000 7f00 0000 0000 7f00 0003
00000c0 0000 7c00 00aa 1200 2042 0500 0000 0000
00000d0 0000 0600 10aa 1200 1042 0100 0307 0025
00000e0 0126 3201 2238 2238 4605 0000 0200 7d00
00000f0 036f 0000 0d00 0000 0000 7f00 0000 0000

Now you need to compile and use the parser listed in the previous post:

Code: Select all

mkdir VBUS

cd VBUS

wget https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/vbusdecode/source-archive.zip

unzip source-archive.zip

cd vbusdecode/trunk

g++ vbusdecode.cpp -o vbusdecode

~/VBUS/vbusdecode/trunk $ ll
total 36
-rw-r--r-- 1 eric eric   340 Feb 13  2016 raw.log
-rwxr-xr-x 1 eric eric 18980 Oct 25 14:29 vbusdecode
-rw-r--r-- 1 eric eric  9301 Feb 13  2016 vbusdecode.cpp
Example of parser usage:

Code: Select all

sudo cat raw.log | ./vbusdecode -c 1 0,15,0.1 2,15,0.1 4,15,0.1 6,15,0.1 8,7,1 9,7,1 10,7,11 11,7,1 12,16,1 14,16,1 16,16,1 18,18,1000 20,16,1000000 22,16,1,t
or

Code: Select all

sudo cat /dev/ttyVBUS | ./vbusdecode -c 1 0,15,0.1 2,15,0.1 4,15,0.1 6,15,0.1 8,7,1 9,7,1 10,7,11 11,7,1 12,16,1 14,16,1 16,16,1 18,18,1000 20,16,1000000 22,16,1,t
Depending on the options passed, you should get an output like this one:

Code: Select all

13.4 39.7 888.8 888.8 0 0 0 2 906 0 0 0 0 00:00
More information and all command line options can be found in the header of vbusdecode.cpp.

Now, let's make this automatic and connected to Domoticz !

First, I created a bash script to manage the socat automatically:

Code: Select all

eric@rpi1:~/VBUS/vbusdecode/trunk $ nano vbus.sh
#!/bin/bash

# Create socat redirection
(socat pty,link=/dev/ttyVBUS,raw,ignoreeof tcp:192.168.0.103:23,keepalive,ignoreeof) &

# Read from the SolarTank and return the decode frame
sudo cat /dev/ttyVBUS | ./vbusdecode -c 1 0,15,0.1 2,15,0.1 4,15,0.1 6,15,0.1 8,7,1 9,7,1 10,7,11 11,7,1 12,16,1 14,16,1 16,16,1 18,18,1000 20,16,1000000 22,16,1,t

# Kill remaining socat process
sudo pkill -f "ttyVBUS"
This script is then called by another Python script:

Code: Select all

eric@rpi1:~/VBUS/vbusdecode/trunk $ nano vbus.py
#! /usr/bin/env python

import os
import subprocess

# Domoticz description
domoticz_ip = '192.168.0.2'
domoticz_port = '81'

# Devices description
idx_panels = 204
idx_tank = 205
idx_pump = 206

# Output description
index_panelsTemp = 0
index_tankTemp = 1
index_pumpSpeed = 4

# Retrieve data
proc = subprocess.Popen(["./vbus.sh"], stdout=subprocess.PIPE)
(out, err) = proc.communicate()

# Display output
print 'Program output:', out
out = out.split()

# Display useful data
print 'Panels temperature: ', out[index_panelsTemp]
print 'Tank temperature: ', out[index_tankTemp]
print 'Pump speed: ', out[index_pumpSpeed]

# Push data to domoticz
os.system('curl \"http://' + domoticz_ip + ':' + domoticz_port + '/json.htm?type=command&param=udevice&idx=' + str(idx_panels) + '&nvalue=0&svalue=' + str(out[index_panelsTemp]) + '\"')
os.system('curl \"http://' + domoticz_ip + ':' + domoticz_port + '/json.htm?type=command&param=udevice&idx=' + str(idx_tank) + '&nvalue=0&svalue=' + str(out[index_tankTemp]) + '\"')
delta = float(out[index_panelsTemp]) - float(out[index_tankTemp])
os.system('curl \"http://' + domoticz_ip + ':' + domoticz_port + '/json.htm?type=command&param=udevice&idx=' + str(idx_pump) + '&nvalue=0&svalue=' + str(delta) + ';' + str(out[index_pumpSpeed]) + ';0' + '\"')
Then you need to create the devices in Domoticz:
domo.PNG
domo.PNG (19.61 KiB) Viewed 647 times
The Python script will push the Tank temperature into the "Tank" widget and the Panels temperature in the "Panels" widget.
The Temp-Humidity device "Pump" is used to display "Panels-Tank" delta temperature and the Pump duty-cyle as the humidity.

And the last thing to do is to add an entry in the root crontab to call the script periodically:

Code: Select all

eric@rpi1:~/VBUS/vbusdecode/trunk $ sudo crontab -e

* * * * * cd /home/eric/VBUS/vbusdecode/trunk/ && (./vbus.py > /tmp/log 2>&1)
In case of any issue you can find the output of the last call into /tmp/log.
actyln
Posts: 5
Joined: Saturday 31 October 2020 12:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Resol DeltaSol C solar heating water tank in Domoticz

Post by actyln »

Then you can also create a fake "Plan" in Domoticz to represent the system:
plan.PNG
plan.PNG (146.75 KiB) Viewed 647 times
Example of a typical sunny day:
pump.PNG
pump.PNG (100.86 KiB) Viewed 647 times
tank.PNG
tank.PNG (93.48 KiB) Viewed 647 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest