You can dremel/sand about half a mill off each bottom side of the Isosceles Trapezium and it may fit as the case is wider at the bottom than the top looking from the short end:
[05:56:18][C][i2c.arduino:039]: SDA Pin: GPIO14
[05:56:18][C][i2c.arduino:040]: SCL Pin: GPIO16
[05:56:18][C][i2c.arduino:041]: Frequency: 50000 Hz
[05:56:18][C][i2c.arduino:044]: Recovery: bus successfully recovered
[05:56:18][I][i2c.arduino:054]: Results from i2c bus scan:
[05:56:18][I][i2c.arduino:060]: Found i2c device at address 0x20
[05:56:18][C][pcf8574:021]: PCF8574:
[05:56:18][C][pcf8574:022]: Address: 0x20
[05:56:18][C][pcf8574:023]: Is PCF8575: YES
[05:56:18][C][switch.gpio:050]: GPIO Switch 'PCF8574 Pin #1'
[05:56:18][C][switch.gpio:051]: Pin: 1 via PCF8574
[05:56:18][C][switch.gpio:073]: Restore Mode: Restore (Defaults to OFF)
[05:56:18][C][switch.gpio:050]: GPIO Switch 'PCF8574 Pin #2'
[05:56:18][C][switch.gpio:051]: Pin: 2 via PCF8574
[05:56:18][C][switch.gpio:073]: Restore Mode: Restore (Defaults to OFF)
[05:56:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Input_0'
[05:56:18][C][gpio.binary_sensor:016]: Pin: 0 via PCF8574
[05:56:26][D][binary_sensor:036]: 'Input_0': Sending state ON
[05:56:27][D][binary_sensor:036]: 'Input_0': Sending state OFF
Two methods of operation thanks to Kraxman
YAML
binary_sensor:
# Physical button on the iFan04-L for testing not related to the PCF8575.
- platform: gpio
id: button_light
pin: GPIO0
on_press:
then:
- light.toggle: fan_light
# PCF8575 enabled basic light switch.
- platform: gpio
name: "Input_0"
pin:
pcf8574: pcf8574_hub
number: 0
mode: INPUT
inverted: true
# Method 1: If the light is on turn it off, if the light is off turn it on, if another source changes the light
# and the physical is in opposite state ignore and leave the current state.
on_press:
then:
- light.turn_on: fan_light
on_release:
then:
- light.turn_off: fan_light
# Method 2: 3-Way Light Switch Emulation.
#on_press:
# then:
# - light.toggle: fan_light
#on_release:
# then:
# - light.toggle: fan_light
# Method 2.1: Same as 2 just a different process.
# on_state:
# then:
# - light.toggle: fan_light
Hi All looks like some great work has gone on in here since I first had a go at this
Time for a new fan for me so time to add another Sonoff - I’ve got a Hunter fan that came with the usual RF remote add on kit that you see in the US but inside the wiring loom of the fan I found there was 1 additional capacitor & i’m wondering if I can remove it and then just use the 3 found inside the ifan for speed control.
I have seen inisde the older pullcord types that have 2 or 3 but this new fan has no cords for lights or fan speed just the reverse switch and 1 cap is using the RF remote for all controls.
I should be ok to just cut it out and join the wiring ?
All the fans I have been in have a capacitor in them like that. Usually you add the sonoff controller in addition to what is there. What I would do is find where the controller is in that fan and remove it and connect the Sonoff to the same wires where it was. As they usually all operate on the same principle wires Motor/Light/Neutral.
NonaSuomy - I used your experience and finally got mine working! So thank you, and the other contributors, for all of your work! Has anyone considered or tried getting Alexa/Google Home integration to control the speed of the fan(s)? Currently with Alexa turning on the fan works but only on the maximum speed. It would be great to be able to say Low/Med/High. Clearly it’s already coded based on the lovelace card Low/Med/High buttons, how do you translate that to a voice command. This is all new to me and I’m not quite sure how to work on it and/or where to start. Is it in the YAML or part of the github code?
Received my iFan04 tonight. No matter what I’ve tried, I cannot get it to flash any code whatsoever.
Double-checked pin header soldering
Used meter continuity to verify pins are soldered correctly.
Swapped RX and TX multiple times.
Held the button down briefly and for the entire duration of attempts.
Provided 3.3VDC to the board
Anyone have any documented, reliable suggestions for flashing this board?
It helps when you power the board with 110VAC.
Also helps when you depress the button while applying the power.
It finally flashed.
Thanks for the work here.
I’ve installed cpyarger’s version on my iFan04-H.
My fan is quite specific as it is an air extractor for my basement.
I have an issue as the switch works perfectly for maximum speed 3, but it didn’t work for speed 1 and 2.
I’ve modified the ifan.cpp file with the mixed relays
With this, the situation seems better on speed 2, but it’s not enough to maintain a normal speed, it’s very very slow, almost stopped, and the fan motor is doing a big electric noise and it will destroyed the electric motor long term.
Sorry not sure if these are meant for all fan use or just large ceiling fans with capacitors in them. Did the device have a speed control before? Some motors state that they should not be used with dimmers etc as they will burnout the coils so be cautious if you care. You could try to turn on all 3 relays and see if that does anything different.
I’ve tried to integrate the iFan04 at level 10, and also directly from a 220V source.
I’ve tried to change the mixed relays strategy but as soon as I activate relay3 in a speed level (the only one working to get a moving speed), this level is going almost max speed. Relay1+2 mode alone is not enough.
The 3 levels proposed by the iFan04 are probably not adapted to the 600W of my fan.
Do you know what is the power of your standard ceiling fan?
I realize that my 10-positions rotative button is wired for each step.
I should probably use a Shelly2PM (or several) as a switch on the positions I’m interested in to pilot.
It would have been easier.
I’m also thinking about changing the capacitors on the iFan04 (2,5µF and 3µF) by bigger ones : 10µF is the biggest I’ve found. It seems some people who had high speed issues solved the problem by changing to smaller ones. In my case, I need more speed.
What do you think ?
Can someone post (or at least post a link to) the latest and greatest known working code for just the iFan04-L that allows the buzzer to be disabled and has the proper speed ranges, please?
It would be nice to have a post of the definitive code for just the basic fan module and remote itself in one place.
And last (I think…) is the 3.3vdc power from an FTDI232 adapter enough to power the chip for flashing or do we need mains power and then use no 3.3vdc from the flashing adapter?
there seems to be a lot of branches to this thread and some (possibly?) unanswered questions about what works and what doesn’t.
Does anyone know what the differences are between the iFan03 and the iFan04 besides the different capacitors that prevents us from just using that code?
All your questions are answered in the thread above in chronological order. The newest stuff would be in that order.
Some fans act differently than others so it’s kinda subjective to what fan you have to how you have to trigger the relays but if it currently is too slow on MED etc then use the code below.
I have one fan that goes insanely fast if I enable the two MED/HIGH relays so test away and see what happens with yours.
If this happens and you need to customize the relays just fork my code base on github then modify the relay then in the yaml code change the github from mine to yours.
Only TTL USB Adapters with LDO regulators on the board.
If the remote doesn’t work right away and you never programmed the RF remote for the controller you will require an AC connection.
I have read this thread multiple times, there is none of this, it works. The only unanswered things are edge case stuff.
Not mentioned in any place in the thread but the RF remote sometimes doesn’t register it’s being pressed which you then have to press the button multiple times to wake it up. That is why I added the I2C I/O expander. I can just use the old light switch on the wall plugged into the I/O expander. The 120V direct to the controller with no light switch between to always keep the controller online to accept input. (Make sure your switch is separated from the power lines and doesn’t have 120V going through it)
There’s no difference besides the change of capacitor sizes to be more compatible with North America fans ie why the iFan04-L/H model exists. The circuit board was laid out differently to have more reliability but essentially it is identical in components. The only way this code wouldn’t work on the iFan03 is if they use different data pins on the ESP8266. If that is so then you would just have to modify those pins in the code to make it compatible and do the capacitor swap. You can compare the Pinout of the iFan03 here Sonoff iFan03 220V Light and Ceiling Fan Controller (IM190409021) Configuration for Tasmota with my post here which I confirmed with iTead the board manufacture Sonoff Ifan04 - ESPHome working code - #76 by NonaSuomy (Just checked both have the exact same pinout)
Note from the tasmota website about them:
The capacitors in the iFan03 do not set the speed of North America fans correctly. To correct the speeds for US ceiling fans, you need to remove the existing capacitors from the iFan03 and replace them with equivalently electrically rated 5uF (microfarad) capacitors. **Do NOT do this if you are not comfortable using a soldering iron as improperly performing this action could increase the risk of bodily injury or property damage.**