Open MattWestb opened 1 year ago
I think the fan speed is set using PWM. The fan has a 4-pin connector, and one of those pins is unconnected to the built-in MCU.
It's very likely this unconnected 4th pin is a tach signal similar to other 4-pin DC fans so you could connect that pin to the ESP and count the pulses. If you want to do this I suggest a ESP32 since it has hardware pulse counter.
I didn't look into this 4th pin since reading the pulse width of the LED was easy and works well.
Hi @MattWestb @jonathonlui the fan speed sensor based on the LED is very unreliable for me when it comes to OFF (0). Most of the time, it stays in 3. If I restart the board (I added a platform: restart
button) it reads properly again (0 if it's off). 🤔
Example: 319 while in speed 3, button press (purifier is OFF), still reads 319 so detects it as 3.
Did you ever try the 4th pin to ESP mentioned above? I just did. Cable inserted (not even soldered) into the PWM Pin connector (2nd from the top) to the ESP32 and set up the Pulse Counter Sensor. It works great!
The speeds go as following:
0 -> 0.00 pulses/minute 1 --> ~7470 pulses/minute 2 --> ~11910 pulses/minute 3 --> ~ 15500 pulses/minute
pulse_counter replacing pulse_width:
- platform: pulse_counter
pin: 21
name: "Fan Speed PWM"
update_interval: 0.5s
accuracy_decimals: 0
unit_of_measurement: ''
icon: mdi:speedometer
id: pwm
filters:
- lambda: !lambda |- # this section could be better or different...
int poff = 0;
int y = int(x);
if (y < 100) {
return 0;
} else if (y <7700) {
return 1;
} else if (y <12100) {
return 2;
} else if (y < 17000) {
return 3;
} else {
return 0;
}
This will also help me in making it work like a fan, as being discussed in https://github.com/jonathonlui/esphome-ikea-uppatvind/issues/6
End result (with other improvements like FAN, Power Off button, Restart)
15500 / 60 = 258 Hz so sounds very realistic.
I think its possible using the same searing as we have using for Förnuftig (but was not cutting the 24V then was off) the can implanting more speeds if like and other functions in the ESP board.
Great work done !!
15500 / 60 = 258 Hz so sounds very realistic.
I think its possible using the same searing as we have using for Förnuftig (but was not cutting the 24V then was off) the can implanting more speeds if like and other functions in the ESP board.
I'm waiting for another board to do the Förnuftig - which seems more complicated than the Uppatvind 😨
Regarding controlling the Uppatvind speed via PWM... I have no idea where to start and how that would work with the original board. I'm not changing the board with a custom one either.
Hi @MattWestb @jonathonlui the fan speed sensor based on the LED is very unreliable for me when it comes to OFF (0). Most of the time, it stays in 3. If I restart the board (I added a
platform: restart
button) it reads properly again (0 if it's off). 🤔Example: 319 while in speed 3, button press (purifier is OFF), still reads 319 so detects it as 3.
Did you ever try the 4th pin to ESP mentioned above? I just did. Cable inserted (not even soldered) into the PWM Pin connector (2nd from the top) to the ESP32 and set up the Pulse Counter Sensor. It works great!
The speeds go as following:
0 -> 0.00 pulses/minute 1 --> ~7470 pulses/minute 2 --> ~11910 pulses/minute 3 --> ~ 15500 pulses/minute
pulse_counter replacing pulse_width:
- platform: pulse_counter pin: 21 name: "Fan Speed PWM" update_interval: 0.5s accuracy_decimals: 0 unit_of_measurement: '' icon: mdi:speedometer id: pwm filters: - lambda: !lambda |- # this section could be better or different... int poff = 0; int y = int(x); if (y < 100) { return 0; } else if (y <7700) { return 1; } else if (y <12100) { return 2; } else if (y < 17000) { return 3; } else { return 0; }
This will also help me in making it work like a fan, as being discussed in #6
End result (with other improvements like FAN, Power Off button, Restart)
This is an excellent solution. Works flawless on my 4 Uppåtvind in the summerhouse. And you can easily switch between modes in Home Assistant by something like this:
This is an excellent solution. Works flawless on my 4 Uppåtvind in the summerhouse. And you can easily switch between modes in Home Assistant by something like this:
- repeat: while:
- condition: template value_template: "{{ states('sensor.airpur1_fan_speed_pwm')|int != 3 }}" sequence:
- service: button.press target: entity_id: button.airpur1_upp_tvind_button data: {}
- delay: "00:00:02"
@Dokport you can convert the device to a FAN and embed that logic onto ESPHome, so that you don't need scripts or anything in HA, and control the purifier like a fan
You have the information in the last part of the post you quoted:
End result (with other improvements like FAN
This is an excellent solution. Works flawless on my 4 Uppåtvind in the summerhouse. And you can easily switch between modes in Home Assistant by something like this:
repeat: while:
- condition: template value_template: "{{ states('sensor.airpur1_fan_speed_pwm')|int != 3 }}" sequence:
- service: button.press target: entity_id: button.airpur1_upp_tvind_button data: {}
- delay: "00:00:02"
@Dokport you can convert the device to a FAN and embed that logic onto ESPHome, so that you don't need scripts or anything in HA, and control the purifier like a fan
You have the information in the last part of the post you quoted:
End result (with other improvements like FAN
I tried to replicate the the measuring of the PWM Pin, but unfortunately the blower stopps working as soon as i connect the Pin to one of my Wemos D1 Pins. Despite the Wemos D1 receiving the correct PWM values, is this a common issue with this setup?
I dont know if the fan is working the same was as Förnuftig that use frequency changing and feed back for controlling the fan speed. Is the Uppatvid doing the same or is it using Puls Wide Modulation (PMW) ? If its using frequency ESPHome can measuring the feed back from the fan and getting the real speed of it. That shall also being possible with PWM and i think its one better way then reading the LED. Only need one or 2 resistors for getting 24V down to around 3.3V for working OK with the ESP but it can also being that the feed back is not 24 V but 5V so being easier handling for the ESP.
PS: Custom board with Förnufting have not implanting power of off the fan that IKEA have on there PCB. Then IKEA is putting the fan off they is also taking the 24V away for the fan connection with one transistor so the fan is not having 24V then its not running and i think that is good for the fan not having constant power then not running. And looking on this PCB i think Q2 is doing the same but as long using the original PCB is shall being no problems then IKEA MCU is doing all right :-))
I thinking doing the same hardware as i was making with Vindrikting and using one buck converter and one ESP-01S but need looking little more if its one good road to going.
Great work done !!