nordeep/esphome_fan_controller

Schema and PINs Question

Closed this issue · 10 comments

Hi, cool project :-)

Bought the IRF520. Now I am after the 4-channel Logic Level Converter - Bi-Directional but I am having trouble to find what it is and does. I can't find a model on amazon.de, can you help me out from there? Following the diagram I have a hard time to find a "replacement" board and match the pins on that. Also the wemos misses pin numbers, is that the default?

Should this be the one?
https://www.amazon.de/dp/B07N7FFY2Q/ref=cm_sw_em_r_mt_dp_BVKQFN77XEW7CYB004R4?_encoding=UTF8&psc=1

How would the pins match your schema?

Thanks in advance!

Bi-Directional 5V to 3.3V Logic Level Converter - https://www.amazon.com/Bi-Directional-Converter-Arduino-Envistia-Mall/dp/B07QTKZSBT
Yes, Wemos has default PINs. Unfortunately export from Fritzing app cut it off. Will try to fix.

UPDATE: Upload PNG schema. PIN names is in its place.

Hi, thanks. I am now trying... but no success yet. BTW I use an esp32, but it is not even powering up. why is both the 3.3v and the 5v connected to the esp?

When I put 12V on the IRF520 I only get 1.3V to go to the esp on VCC and GND?

You need to provide low and high voltage for Bi-Directional convertor by connect 3.3v and 5v to converter.
An IRF520 has a threshold voltage in the range of 2 to 4 volts, so ESP32 has 3.3v which enough to turn on.

PS : there is no power supply of ESP8266 on the diagram, but its presence is implied.

PS : there is no power supply of ESP8266 on the diagram, but its presence is implied.

Sorry, do you mean the "12V" part is not the supply for the esp and thus that needs to be powered separately? And if so, do you mean that if I connect 5V to the ESP it will output 3.3 and them both will power the bi-directional converter... etc.? Please help out :-)

Edit:
I have supplied usb power... but since I use an esp32 I changed

I have a very slow spinning fan on boot and can control via homeassitsant... but I cannot get it to spin hard... tried also:
output:

  • platform: gpio
    pin: GPIO18
    id: fan_supply
  • platform: ledc
    pin: GPIO23
    frequency: 10000 Hz (also tried with 250000 Hz)
    id: pwmfan

Here I play with home assistant slider:
[D][main:262]: Power of Fan turned OFF�
[D][speed.fan:035]: Setting speed: 0.00�
[D][main:255]: Power of Fan turned ON�
[D][speed.fan:035]: Setting speed: 0.27�
[D][main:268]: Write 100% to output pwmfan�
[D][pulse_counter:159]: 'esp32-05 Fan Speed': Retrieved counter: 0.00 pulses/min�
[D][sensor:131]: 'esp32-05 Fan Speed': Sending state 0.00000 RPM with 2 decimals of accuracy�
[D][speed.fan:035]: Setting speed: 0.66�
[D][speed.fan:035]: Setting speed: 0.07�

But no hard spinning...

Any tips?

Yes - ESP needs to be powered separately.
Seems your Bi-Directional convertor is not working correctly. You should check the voltage on Bi-Directional convertor on 3.3v and 5v. Both voltages must be present on the convertor. Not all types of ESP boards provide 5v voltage output on PIN.

Ok, some more info. I have 12.14 v in. 3.3v on the 3v pin. 4.65v on the 5v pin.

Upon start of the set I get a rating fan but no logging.

[D][speed.fan:035]: Setting speed: 0.00�
[D][pulse_counter:159]: 'esp32-05 Fan Speed': Retrieved counter: 0.00 pulses/min�
[D][sensor:131]: 'esp32-05 Fan Speed': Sending state 0.00000 RPM with 2 decimals of accuracy�
[D][speed.fan:035]: Setting speed: 0.00�
[D][speed.fan:035]: Setting speed: 0.23�
[D][speed.fan:035]: Setting speed: 0.81�
[D][pulse_counter:159]: 'esp32-05 Fan Speed': Retrieved counter: 0.00 pulses/min�
[D][sensor:131]: 'esp32-05 Fan Speed': Sending state 0.00000 RPM with 2 decimals of accuracy�
[D][speed.fan:035]: Setting speed: 0.44�
[D][speed.fan:035]: Setting speed: 0.00�
[D][speed.fan:035]: Setting speed: 0.10�
[D][speed.fan:035]: Setting speed: 0.00�
[D][speed.fan:035]: Setting speed: 0.10�
[D][speed.fan:035]: Setting speed: 0.02�
[D][pulse_counter:159]: 'esp32-05 Fan Speed': Retrieved counter: 0.00 pulses/min�
[D][sensor:131]: 'esp32-05 Fan Speed': Sending state 0.00000 RPM with 2 decimals of accuracy�
[D][pulse_counter:159]: 'esp32-05 Fan Speed': Retrieved counter: 0.00 pulses/min�
[D][sensor:131]: 'esp32-05 Fan Speed': Sending state 0.00000 RPM with 2 decimals of accuracy�
[D][pulse_counter:159]: 'esp32-05 Fan Speed': Retrieved counter: 0.00 pulses/min�
[D][sensor:131]: 'esp32-05 Fan Speed': Sending state 0.00000 RPM with 2 decimals of accuracy�
[D][pulse_counter:159]: 'esp32-05 Fan Speed': Retrieved counter: 0.00 pulses/min�
[D][sensor:131]: 'esp32-05 Fan Speed': Sending state 0.00000 RPM with 2 decimals of accuracy�

Setting the speed above .25 stops the fan...

my config:

# https://github.com/nordeep/esphome_fan_controller

substitutions:
  esp_name: esp32-05
  ssid: IOTDOM
  password: !secret IOTDOM_wifi_key

esphome:
  name: $esp_name
  platform: ESP32
  board: wemos_d1_mini32
#  on_boot:
#    - priority: 200.0
#      then:
#        - output.set_level:
#            id: pwmfan
#            level: 100%

wifi:
  ssid: $ssid
  password: $password
  use_address: 192.168.6.67
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${esp_name} FBHS"
    password: !secret Fallback_Hotspot

captive_portal:

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:

ota:

output:
  - platform: gpio
    pin: GPIO18
    id: fan_supply
  - platform: ledc
    pin: GPIO23
    frequency: 10000 Hz
    id: pwmfan

fan:
  - platform: speed
    output: pwmfan
    name: ${esp_name} Fan
#    on_turn_on:
#      - output.turn_on: fan_supply
#      - logger.log: "Power of Fan turned ON"
#    on_turn_off:
#      - output.turn_off: fan_supply
#      - logger.log: "Power of Fan turned OFF"
#      - delay: 1s
#      - logger.log: "Write 100%% to output pwmfan"
#      - output.set_level:
#          id: pwmfan
#          level: 100%

sensor:
# Reports RPM by pulse_counter
  - platform: pulse_counter
    pin: GPIO19
    name: ${esp_name} Fan Speed
    unit_of_measurement: 'RPM'
#    filters:
#      - multiply: 0.5
#      - lambda: |-
#          if (x <= 1500) return x;
#          else return {};
#    count_mode:
#      rising_edge: INCREMENT
#      falling_edge: DISABLE
    update_interval: 30s

time:
  - platform: homeassistant
    id: homeassistant_time
    
web_server:
  port: 80

esp32_touch:
  setup_mode: False


text_sensor:
  - platform: wifi_info
    ip_address:
      name: "${esp_name} IP Address"
    ssid:
      name: "${esp_name} Connected SSID"
    bssid:
      name: "${esp_name} Connected BSSID"
    mac_address:
      name: "${esp_name} Mac Wifi Address"
      
switch:
  - platform: restart
    name: ${esp_name} Restart

the fan in homeassitant:
image

The set:

image

I would really appreciate and need some help here :-)

I would really appreciate and need some help here :-)

how did you get that slider for speedcontrol

Quick question to the Author - in your diagram it was very clear, however, there is one thing that i found out of place:

The way that the standard 4 wire PINout (Pins 4,3,2,1) is (SpeedCommand, Feedback, 12v, Ground), however,

In your diagram, your Green Wire (which is clearly your pulse counter), is mech'd to PIN4 of the 4 wire fan. (and your yellow wire, which is the Command line to D7) is Mech'd to PIN3.

Everything in your description is so purposefully aligned with the standard, I'm curious why you flipped the wires? Or is there some nuance I'm missing?

Thanks a bunch -- I am also seeing some low speed fan behavior using a D1 mini - similar to observations described by the other commenter above, but I thought I'd make sure I get all the base assumptions aligned first.

Thank you!

Quick question to the Author - in your diagram it was very clear, however, there is one thing that i found out of place:

The way that the standard 4 wire PINout (Pins 4,3,2,1) is (SpeedCommand, Feedback, 12v, Ground), however,

In your diagram, your Green Wire (which is clearly your pulse counter), is mech'd to PIN4 of the 4 wire fan. (and your yellow wire, which is the Command line to D7) is Mech'd to PIN3.

Everything in your description is so purposefully aligned with the standard, I'm curious why you flipped the wires? Or is there some nuance I'm missing?

Thanks a bunch -- I am also seeing some low speed fan behavior using a D1 mini - similar to observations described by the other commenter above, but I thought I'd make sure I get all the base assumptions aligned first.

Thank you!

My mistake - mismatch pins with diagram. Fixed in code. Thank you!