nliaudat / esp32_8ch_motor_shield

An ESP32 based 8 channels motor controller (to replace Homematic IP Floor Heating Actuator)
Other
86 stars 17 forks source link

[FEATURE REQUEST] add temp. sensor for VL and RL per channel for doing thermal balancing? #4

Closed linuxdep closed 5 months ago

linuxdep commented 2 years ago

Describe the problem you have/What new integration you would like

For thermal balancing i think it was nice to measure VL and RL and calculate thermal balancing automatically. What do you think is this possible? That would be the killer application, install underfloor heating, control it, thermal balancing is done automatically. Suspension of control for the valves marked as closed.

Please describe your use case for this integration and alternatives you've tried:

Additional context

nliaudat commented 2 years ago

Please give a definition of your mean of VL and RL (German abbreviation ?) At best a calculation formula.

Actually, the target position of valve is calculated with a simplification of arduino map function :

arduino map function :  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 
with parameters : in_min=-1;in_max=1;out_min=0;out_max=1
=>  f(x) = (x+1)/2
diff_temp = (target_temp_high + target_temp_low)/2 - current_temp
=> round(((diff_temp+1)/2)/0.1)*0.1;

I use that formula for 2 years and it works great, is easy to understand and fast to compute.

For temperature fine tuning, I've tested PID climate controller, but my low temperature floor heating has too much inertia to find good values for ki, kp ,kd

The next step I'll go is to fine tune the target valve values with hassio automations. It would be most easy cause hassio retains historical values and can have more sensors, like external temperature, etc.

You can get temperature from external sensors like Xiaomi BLE or via hassio and then compute a template sensor

Karl-opec commented 2 years ago

Hello, great project,

VL means supply flow, RL means return flow.

I have on my actual Floor Heating system (standard wax based Actuators to control flow) on top of the PWM a PID controller running. Its PID_PFactor is 0.95, PID_IFactor is 0,59, PID_DFactor =0.5, The D-Value is based on a gradient t(n) to t(n-7) with recalc time of the PID controller of every 60 sec. It works good. My experience is that the PID controller is needed to keep the Temperature close to the desired Temp.

nliaudat commented 2 years ago

They are 7 free pin available to add custom sensors

Capture

Look at https Capture2

Look at schematics.pdf for details.

You can use NTC sensors or values from hassio.

Code need to be rewritten a bit (THx_check), but it's simple task

nliaudat commented 2 years ago

The new firmware version lets you change the valve position formula (at line 53). You can adapt it to get what you want. Regards (https://github.com/nliaudat/esp32_8ch_motor_shield/blob/main/firmware/esphome_firmware_sample.yaml)

nstadigs commented 2 years ago

Maybe you already know, but apparently esphome has a PID Climate component with support for autotuning.

nliaudat commented 2 years ago

Yes, you can replace thermostat component with PID Climate, I works the same and a sample code is provided in the yaml file (commented out)

nliaudat commented 2 years ago

Sorry, the code was not fully included :

climate:
  - platform: pid
    id: office_pid_thermostat
    name: "Office PID climate"
    sensor: Office_temperature
    default_target_temperature: 21°C
    heat_output: output_office_cover
    control_parameters:
      kp: 18
      ki: 2300
      kd: 0.5

output:
  - platform: template
    id: output_office_cover
    type: float
    write_action:
      - cover.control:
            id: CH6_cover
            position: !lambda return state;
      - logger.log:
            format: "CH6 moved to position %.1f"
            args: [ 'state' ] 

I have tested the climate component, but the update frequency is to hight for valve good life

heinemannj commented 10 months ago

Is it also possible to use 12 x 1-wire temperature sensors (DS18B20) connected to your board?

I've already implemented via espHome with Smart Thermostat with auto Heat/Cool mode, PID control and PWM (Home Assistant component) and this is working fine with my actual ON/OFF Actuators.

But I want to change to Homematic valve actuators [HmIP-VDMOT] for some reasons ;-)

nliaudat commented 10 months ago

Yes, you only need a VCC, GND, IO. All is available in https://github.com/nliaudat/esp32_8ch_motor_shield/blob/main/extension.md

heinemannj commented 10 months ago

Coming back to the origional topic: thermal balancing

In Germany, a hydraulic balancing must be carried out after installation or changes to a heating system.

However, if the heating circuit conditions like line cross-sections and line lengths of the individual heating circuits are not known, an exact calculation of the required flow rate is not possible.

For that reason, only a thermal calibration/balancing can be carried out.

By measuring the supply flow temperature and the return flow temperature in each individual heating circuit, you can calculate the spread per heating circuit.

Recommendation for heating pomp system temperature of the heating at full load (in my case the house has an demand of ~40 W/m2):

Supply flow temperature: 32 °C Return flow temperature: 27 °C Standard outside temperature von: -12°C Room temperature: 20 °C

=> System temperature: 32/27/20 => Spread: 5 °C => Required flow rate per circuit to be calculated based on room heating load

Ideally the spread in each heating circuit within one thermal zone (e.g. room) should be equal.

For the thermal calibration/balancing you have three possibilities:

  1. Adjust the flow/spread via your flow meters of the heating circuit distributor
  2. Adjust the flow/spread via proportional valve actuators
  3. Adjust initially via flow meters and then daily on demand based on room and outside temperature conditions and on top finetuning based on corresponding heating circuit spread via proportional valve actuators

The third option is obviously the best method because then you have setup a real dynamic hydraulic balancing.

As mentioned by Karl-opec an external HA PID controller can manage this (please see above).

It is also mentioned in floor-heating-controller wiki that you can use Hassio custom climate components.

Can you please provide some example code for the usage/integration of Hassio components to control the valve percentage of the actuators.

nliaudat commented 10 months ago

There is 2 ways to go to do external PID control :

The simplest is to adjust the target temperature (like in https://github.com/KartoffelToby/better_thermostat) The second is to control valves motors and then use the "motor firmware", but I have no experiences in that way.

nliaudat commented 10 months ago

https://github.com/vindaalex/multizone-thermostat can control proportionnal valves

heinemannj commented 10 months ago

I've setup an very early alpha version of a documentation / project paper to describe the goals and the physics behind:

https://github.com/heinemannj/Hydraulic-Balancing/edit/main/README.md