Fan control 0-10V

Thanks Cuball! That helps. I can’t see your sketch. Could you upload?
One other question: how did you determine the 2000 Hz value (related to your PWM or trail-and-error )?

Dear @cuball

Even though the topic is quiet for a while, I hope I can get in contact with you and ask your kind help in a very similar project I’m trying to achieve. Please bear in mind, that I have very limited coding knowledge, but with some research and tons of help from the community I achieved a lot - at least compared to what I dared to dream of :slight_smile: I connected my SolarEdge solar inverter via modbus to read realtime data of solar production, I connected my smart energy meter via wemos D1 mini to read energy production and consumption, I connected my totally dumb Daikin heatpump with an ESP to read all heating/cooling related information, and I connected my paradox alarm system via lan to read infrared motions sensors to use them as action triggers and to control my alarm system. Besides that I installed many Shelly devices to control window shutters and lights. So I consider my house semi-dumb now, and I’m loving it. Now I want to take one step further, and connect my Wolf CWL-400 Excellent air ventilation system via its 0-10V control option, to achieve the following:

  • it dries the air in the house very much especially in the winter, so I’d like to control air flow based on presence detection (how many person is in the house at a given moment, and add 30 cubic meters airflow per person, and set a lower constant air flow during night)
  • in the winter some neighbours use very shitting fire material, creating very bad smoke around the house which is then spread around in the house evenly within minutes. I’d like to prevent that with an air quality filter just before the air intake, and to shut down ventilation instantly if the air quality is insufficient outside.

I see that you created a device which would be perfect for my use case, and I would really love to do the very same, but I need some help on the programming side. I have ESPhome, and have successfully altered ESP firmwares and updated them OTA, I know how to solder and put the device together, know how to edit yaml, and stuff, so I’m aware with the very basics, you don’t need to worry about that, but I would need some knowledge on how to build a proper firmware to control 0-10V output. And also a little help with the automation part: based on certain existing sensor values how can I instruct the ESP to set the voltage output to a certain level.

Do you think you can help me on this part a little bit, and can I take advantage of your accumulated experience?

Would be much much appreciated.

Perhaps some explanation: the device here PWM to Voltage Converter Module 0% 100% to 0 10V for PLC MCU Digital to Analog Signal PWM Adjustabl Converter Power Module|Integrated Circuits| - AliExpress has a PWM input, and a 0-10v output.

So the esp can produce pwm ESP8266 Software PWM Output — ESPHome or ESP32 LEDC Output — ESPHome using the code in Fan control 0-10V - #20 by cuball

1 Like

thanks a lot for the prompt reply @nickrout

sorry, very beginner, noob questions coming :slight_smile:

so basically, first I assemble the right device (ESP and I2C components), then I try to make a proper yaml config in ESPHome, based on instructsions like these:

I was kinda hoping to have access to a preassembled whole config to begin with, and make any necessary changes, if there’s any… Is anyone willing to share me his/her working config to play with?

Hi, still looking for this? I’ve implemented this last week, with the same fan as you have.

Hi Xirixiz,
Thanks for responding! I managed to get a ESP32/PWM up and running on the Zehnder fan. However as a consequence of this ESP32/PWM connection, I had to remove the existing moisture sensor that was connected on the Zehnder PWM terminal strip. And more of an issue, this new ESP32/PWM in Home Assistant (working well) and my standard Zehnder remote control did not work well together. So I abandoned this ESP32/PWM and made a nRF905/ESP32 device (https://github.com/eelcohn/nRF905-API). This works well now for me AND I still have the original Zehnder with moisture sensor plus standard remote control. So basically now I have 2 remote control devices (one standard and one via Home Assistant) and a fully original Zehnder fan.
Guido

Ah cool, for me the nRF soltution was too buggy (crashed all the time), and therefor I switched to this ESP/PWM solution instead bundled with some sensors. Anyway, nice we both have this in place :smiley:

… or did eelcohn update the code recently maybe? I’ve shut it down around half a year ago as he didn’t repond on issues.

Thanks for sharing your experiences! Actually I experienced same instabilities and almost daily rebooting the ESP/nRF was needed. As I experienced poor wifi signal strength I started using a 2m USB cable for powering the EPS/nRF (moving way from back of room with fan and central heating system). Then re-pairing a couple of times seemed to have solved it for me (i.e. redoing the configuration)

I made this approx. spring 2021 and I don’t think I have updated the ESP32/nRF ever since (whereas for all my ESPHome devices on ESP32 boards I do as new versions are issued). Maybe a bit of luck here… In case of instabilities getting back, I also think I will move to the more stable ESP32/PWM then combining with Bluetooth moisture sensor (already present in bathroom) and an additional bluetooth (Xiaomi?) button (for those in the house that like to push physical buttons).

Hi! Why do I only get a on/off button with htis??
image

From what?

Hi Guys,

Just jumping in on this thread with a question regarding the PWM to Voltage Module.

@cuball @nickrout @Hellis81 You guys would seem to have a reasonable knowledge of this module.

This module has an output of 0-10v and I believe that this is kind of regulated to the maximum output of 10 volts by the 12v input voltage regulator.

I need a 0-15v output for controlling my SystemAir Priosil 200EC. If I swap-out the onboard 12v regulator for a 15v regulator (L7815CD2T-TR), will I get the 0-15v o/p I require (obviously with having an i/p around this voltage), and will the rest of the circuitry be fine with this?

I’d be grateful for your input.

Dizz.

Hello @all. I know that the topic is old but what are You thinking about using the dimmer led controller with esp? > These are used by me for led strips with success.

https://www.amazon.com/gp/product/B07J5B3R5L/

From technical information Magic home:
Input Voltage: DC 5-28 volt so they can be easily powered from main board.

And bellow I added my original controller.

PS
I have already created a PWM-Wemos-Stepdown board. But now I see the problem with the output. My measurements show an output of 0-5.5 volts and nothing more. Does anyone have this problem?

output:
  - platform: esp8266_pwm
    pin: D5
    frequency: 2000 Hz
    id: ventilatie_output

Thanks in advance
Konrad

Hi,
could U share ESPhome code for 3 speeds and timers?

1 Like

Newbie here, I hope I am not missing any critical details
I got a wesp32 board that has POE in order to have a solid connection and power.
I got a PWM that works with 3.3v for PWM https://www.amazon.com/gp/product/B079B5MRQC/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1

I have not been able to get the any kind of power output reading from the PWM voltage out.

Any help is appreciated.

Below is the code I am using.

output:
  - platform: ledc
    pin: GPIO33
    frequency: 3000Hz
    id: wesp32_fancontrol

fan:
  - platform: speed
    output: wesp32_fancontrol
    name: "Boathouse Fans 0-10 esp"

sorry for late reply. here is my ESPHome code. Recent experience is that this system is unstable and need frequent reconfigured. Anyhow here is my code (i did not put in configuration.yaml but in a separate yaml file:

# taken from : Github Gist - Golles
# https://gist.github.com/golles/ae32d9a7c14b63d9d68f6ff9a6fd4d6a
# password host and status-url are in secrets.yaml 

fan:
  - platform: template
    fans:
      mechanische_ventilatie:
        friendly_name: Mechanische ventilatie
        value_template: >
          {{ states('sensor.mechanische_ventilatie_status') }}
        availability_template: >
          {{ states('sensor.mechanische_ventilatie_status') }}
        percentage_template: >
          {{ state_attr('sensor.mechanische_ventilatie_status', 'percentage') }}
        preset_mode_template: >
          {{ state_attr('sensor.mechanische_ventilatie_status', 'speed') }}
        turn_on:
          service: script.ventilation_turn_on_off_dummy
        turn_off:
          service: script.ventilation_turn_on_off_dummy
        set_percentage:
          service: script.ventilation_set_voltage
          data:
            voltage: '{{ percentage / 10 }}'
        set_preset_mode:
          service: script.ventilation_set_preset_mode
          data:
            preset_mode: '{{ preset_mode }}'
        preset_modes:
          - low
          - medium
          - high
          - max

sensor:
  - platform: rest
    name: Mechanische ventilatie status
    resource: !secret nrf905_status_url
    username: !secret nrf905_username
    password: !secret nrf905_password
    value_template: >
      {% if value_json['result'] == 'ok' %} 
        on 
      {% else %} 
        off 
      {% endif %}
    # json_attributes_path: $.devices.C0 # This will be different for each fan.
    json_attributes_path: "$.devices.*" # from the text in https://gist.github.com/golles/ae32d9a7c14b63d9d68f6ff9a6fd4d6a
    json_attributes:
      - voltage
      - percentage
      - speed
      - timer

script:
  ventilation_turn_on_off_dummy:
    mode: single
    sequence:
      - delay: 1
  ventilation_set_preset_mode:
    mode: single
    fields:
      host:
        description: Hostname or ip
      preset_mode:
        description: Set the fan preset mode (low/medium/high/max)
    sequence:
      - service: rest_command.ventilation_preset_mode
        data:
          host: !secret nrf905_host
          preset_mode: '{{ preset_mode }}'
      - delay: 1
      - service: homeassistant.update_entity
        data:
          entity_id: sensor.mechanische_ventilatie_status
  ventilation_set_speed_timer:
    mode: single
    fields:
      host:
        description: Hostname or ip
      speed:
        description: Set the fan speed (low/medium/high/max)
      timer:
        description: Set the fan timer (number of minutes)
    sequence:
      - service: rest_command.ventilation_set_speed_timer
        data:
          host: !secret nrf905_host
          speed: '{{ speed }}'
          timer: '{{ timer }}'
      - delay: 1
      - service: homeassistant.update_entity
        data:
          entity_id: sensor.mechanische_ventilatie_status
  ventilation_set_voltage:
    mode: single
    fields:
      host:
        description: Hostname or ip
      voltage:
        description: Set the fan voltage, between 0.0 and 10.0
    sequence:
      - service: rest_command.ventilation_set_voltage
        data:
          host: !secret nrf905_host
          voltage: '{{ voltage }}'
      - delay: 1
      - service: homeassistant.update_entity
        data:
          entity_id: sensor.mechanische_ventilatie_status
          
rest_command:
  ventilation_preset_mode:
    url: http://{{ host }}/api/v2/fan/setspeed.json?speed={{ preset_mode }}
    username: !secret nrf905_username
    password: !secret nrf905_password
  ventilation_set_speed_timer:
    url: http://{{ host }}/api/v2/fan/setspeed.json?speed={{ speed }}&timer={{ timer }}
    username: !secret nrf905_username
    password: !secret nrf905_password
  ventilation_set_voltage:
    url: http://{{ host }}/api/v2/fan/setvoltage.json?voltage={{ voltage }}
    username: !secret nrf905_username
    password: !secret nrf905_password

And here is the entities card for the dashboard:

type: entities
title: Ventilatie
entities:
  - type: custom:paper-buttons-row
    position: left
    base_config:
      style:
        button:
          margin-left: 1px
          margin-right: 1px
    buttons:
      - name: Ventilator's Stand
        icon: mdi:fan
      - entity: sensor.mechanische_ventilatie_status
        name: false
        icon: mdi:fan-speed-1
        style:
          button:
            color: >-
              {% if is_state_attr('sensor.mechanische_ventilatie_status',
              'speed', 'low') %}
                amber
              {% else%}
                steelblue
              {% endif %}
        tap_action:
          action: call-service
          service: script.ventilation_set_preset_mode
          service_data:
            preset_mode: low
      - entity: sensor.mechanische_ventilatie_status
        name: false
        icon: mdi:fan-speed-2
        style:
          button:
            color: >-
              {% if is_state_attr('sensor.mechanische_ventilatie_status',
              'speed', 'medium') %}
                amber
              {% else%}
                steelblue
              {% endif %}
        tap_action:
          action: call-service
          service: script.ventilation_set_preset_mode
          service_data:
            preset_mode: medium
      - entity: sensor.mechanische_ventilatie_status
        name: false
        icon: mdi:fan-speed-3
        style:
          button:
            color: >-
              {% if is_state_attr('sensor.mechanische_ventilatie_status',
              'speed', 'high') %}
                amber
              {% else%}
                steelblue
              {% endif %}
        tap_action:
          action: call-service
          service: script.ventilation_set_preset_mode
          service_data:
            preset_mode: high
  - type: custom:paper-buttons-row
    buttons:
      - name: Timer Stand Hoog
        icon: mdi:fan
      - entity: sensor.mechanische_ventilatie_status
        name: false
        icon: mdi:clock-time-two-outline
        style:
          button:
            color: >-
              {% if is_state_attr('sensor.mechanische_ventilatie_status',
              'timer', true) %}
                amber
              {% else%}
                steelblue
              {% endif %}
        tap_action:
          action: call-service
          service: script.ventilation_set_speed_timer
          service_data:
            speed: high
            timer: 10
      - entity: sensor.mechanische_ventilatie_status
        name: false
        icon: mdi:clock-time-six-outline
        style:
          button:
            color: >-
              {% if is_state_attr('sensor.mechanische_ventilatie_status',
              'timer', true) %}
                amber
              {% else%}
                steelblue
              {% endif %}
        tap_action:
          action: call-service
          service: script.ventilation_set_speed_timer
          service_data:
            speed: high
            timer: 30
      - entity: sensor.mechanische_ventilatie_status
        name: false
        icon: mdi:clock-time-twelve-outline
        style:
          button:
            color: >-
              {% if is_state_attr('sensor.mechanische_ventilatie_status',
              'timer', true) %}
                amber
              {% else%}
                steelblue
              {% endif %}
        tap_action:
          action: call-service
          service: script.ventilation_set_speed_timer
          service_data:
            speed: high
            timer: 60
state_color: true
2 Likes

Hi @ guidok
I have a Zehnder (E400) that has the Analogue 0-10v like yours.
I want to integrate this to home assistant.
I have already a qingping air monitor lite for CO2 reading and it is very good.
I have ordered this 0-10v dimmer hoping it will work: https://www.aliexpress.com/item/1005003619684238.html?spm=a2g0o.order_list.order_list_main.10.547b18021SQAA
The issue is that I am not sure how to connect if the unit needs 12v - 0-10v - ground. Can I just skip the 12v pin?
I don’t understand if DC like battery voltage will work to command the speed or should it be PWM type 0-10v signal? Can you please give some advices?

Hi chaps,

Much better option for you is the 2 Channel I2C 0-10v Analog DAC by DFROBOT!

The PWM to 0-10v modules like mentioned above are not great really as they need external 24v input as 12v will not give full 0-10v range plus I found they wandered over time. I tried two the modules, one slightly more expensive than the other but they were both not great.

BUT! The amazing ESPHome devs @jesserockz and another chap (cannot find him to tag at the moment) integrated a cheap ($9.99) DFROBOT 2 channel i2c 0-10v DAC which goes out a fantastic 0-10v linear output:

GitHub PR https://github.com/esphome/esphome/pull/4495

DFROBOT product: https://www.dfrobot.com/product-2613.html

2 Likes

For me is not clear if PWM equals analogue. I was expecting Analogue to be like linear voltage like from a battery. Therefor the 0-10v will be like a battery able to deliver a minimum 10V and a potentiometer to change the output voltage.
For PWM I am expecting pulse like sin wave from outlet with the exception that the wave is only positive and not positive then negative then back positive.
Trying to learn towards what I need.

@guidok , can you give, please, full details of what pieces of hardware you have used?
Also, your Zehnder unit have a 12v-10v-GND plug? Have you used the 12v pin or just used the 10v and GND connected to the modules you built?

@hulubei I have not modified anything in the Zehnder, but used this source to have a wireless connection in parallel to the Zehnder remote control device:

The hardware I have taken from:

It is not working for me anymore, and I have abondonded the use of the nRF905 device and have gone back to using my Zehnder remote control device (so I’m no longer having my fan in Home Assistant unfortunately).