13rac1 / ESP8266-Remote-Fan-Relay

Convert a manual four-way switched fan to remote WiFi control using a four channel relay and a ESP8266 microcontroller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESP8266 Remote Fan Relay

Convert a manual four-way switched fan to remote WiFi control using a four channel relay.

Parts

Directions

  1. Setup PlatformIO
  2. Copy the src/credentials.h.example file to src/credentials.h.
  3. Add the WiFi SSID and password to src/credentials.h.
  4. Test the network connection and confirm the web form appears on port 80.
  5. Now "just" assemble the hardware and install fit in your fan. YMMV depending on device. In this case, the fan has been wired so the manual control works as a failsafe when the power relay is unpowered. See example wiring below.
  6. Done? Now control your fan with:

Android HTTP Request Shortcuts Example

Create in-app shortcuts GET requests to the following URLS:

  • http://device-ip-address/?speed=off
  • http://device-ip-address/?speed=low
  • http://device-ip-address/?speed=medium
  • http://device-ip-address/?speed=high

Enables creation of a Homescreen folder of fan control shortcuts:

Android Fan Control via HTTP Request Shortcuts screenshot

Note: Linux, Windows, MacOS, and iOS can use Zeroconf/Bonjour/mDNS .local domains, only Android cannot 🙄

Wiring

Before

Fan Wiring Before

MermaidJS Source
graph TB
    subgraph 120V[120 Volt AC]
        +120[+120VAC]
        -120[-120VAC]
    end

    subgraph S[4 Way Switch]
        S-IN[IN]
        S-OUT1[OUT 1]
        S-OUT2[OUT 2]
        S-OUT3[OUT 3]
    end

    subgraph M[3 Speed Fan Motor]
        M-GND[GND]
        M-LOW[Low]
        M-MED[Medium]
        M-HIGH[High]
    end

    -120-->M-GND
    +120-->S-IN
    S-OUT1-->M-HIGH
    S-OUT2-->M-MED
    S-OUT3-->M-LOW

After

Fan Wiring After

MermaidJS Source
graph TB
    subgraph 120V[120 Volt AC]
        +120[+120VAC]
        -120[-120VAC]
    end

    subgraph S[4 Way Switch]
        S-IN[IN]
        S-OUT1[OUT 1]
        S-OUT2[OUT 2]
        S-OUT3[OUT 3]
    end

    subgraph M[3 Speed Fan Motor]
        M-GND[GND]
        M-LOW[Low]
        M-MED[Medium]
        M-HIGH[High]
    end

    subgraph T[5V DC Transformer]
        T+120[+AC]
        T-120[-AC]
        T+5[+DC]
        T-5[-DC]
    end

    subgraph ESP[ESP8266]
        VIN
        GND
        subgraph D[Digital Out]
            D1
            D5
            D6
            D7
        end
    end

    subgraph R[4 channel 5V relay]
        DC+
        DC-
        subgraph R1[Relay 1]
            IN1[In]
            NO1[Normally Open]
            COM1[Common]
            NC1[Normally Closed]
        end
        subgraph R2[Relay 2]
            IN2[In]
            NO2[Normally Open]
            COM2[Common]
            NC2[Normally Closed]
        end
        subgraph R3[Relay 3]
            IN3[In]
            NO3[Normally Open]
            COM3[Common]
            NC3[Normally Closed]
        end
        subgraph R4[Relay 4]
            IN4[In]
            NO4[Normally Open]
            COM4[Common]
            NC4[Normally Closed]
        end
    end
    
    %% Original Wiring
    -120-->M-GND
    S-OUT1-->M-HIGH
    S-OUT2-->M-MED
    S-OUT3-->M-LOW

    +120-->T+120
    -120-->T-120
    +120-->COM1
  
    T+5-->VIN
    T-5-->GND
    T+5-->DC+
    T-5-->DC-

    D5-->IN1
    D6-->IN2
    D7-->IN3
    D1-->IN4

    %% Stock switch powered when relay is unpowered
    NC1-->S-IN
    %% Relays 2,3,4 powered by relay 1
    NO1-->COM2
    NO1-->COM3
    NO1-->COM4

    NO2-->S-OUT3
    NO3-->S-OUT2
    NO4-->S-OUT1

Background

I have a HEPA filter in an out-of-the-way, but awkward to access location. Problem, solved.

License

MIT

About

Convert a manual four-way switched fan to remote WiFi control using a four channel relay and a ESP8266 microcontroller


Languages

Language:C 58.9%Language:C++ 41.1%