Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Ceiling fan/light node

Ceiling fan/light node

Scheduled Pinned Locked Moved My Project
12 Posts 6 Posters 3.3k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • dbemowskD Offline
    dbemowskD Offline
    dbemowsk
    wrote on last edited by dbemowsk
    #1

    Background
    Some time back I had posted a project that I was interested in pursuing. On my old X10 equipment that I ran years back, I had used some dimmer modules to control lights and ceiling fans in my house. One part that I liked about the modules was for the lights, it had a soft start in which the light would ramp up to brightness when turned on, and fade to black when turned off. I also had speed control of my ceiling fans with these modules. The only problem was that I had to use 2 modules for each light and fan combo and fit them into the fan shroud.

    The Idea
    I am working on designing some modules for controlling my light fan combos in a similar manner. Right now I am controlling them with Sonoff modules controlled by my Vera controller. I would like to try some node to node communication with these to possibly have them work if my controller is down. The WAF goes down heavily when the controller has issues which has happened on occasion.

    The Circuit
    I would like to include the pro mini and all electronics in the final design. I am also thinking of including both nRF24L01 as well as an option for RFM69 for others that may be interested in this. As a start, here is my proposed schematic for the dimmer control portion of the modules. I have included snubbers on both triac opto circuits, but on whichever one would be used for the light dimming, the snubber could potentially be omitted. I am looking for input on whether people think this design will work.
    0_1525134006346_9e897ada-0980-4e0a-9806-fbbe10208d98-image.png

    I have already made a proto board with the zero crossing detector and tested it with this code which successfully blinks the LED on my UNO when power is plugged in. This tells me too that the zero crossing ISR is working as it should which is a start to the code that will run this.

    const uint8_t ledPin = 13;                          // Digital output pin that has the on board LED
    const uint8_t zeroPin = 2;                          // Digital input pin to which the zero crossing detector is connected
    
    uint8_t zeroCounter = 0;
    bool zeroState = 0;
    bool ledState = LOW;
    
    void setup() {
      Serial.begin(9600);
      pinMode( ledPin , OUTPUT );                       // Enable output driver for LED pin
      attachInterrupt(0, zero_crosss_int, RISING);      // Choose the zero cross interrupt and attach it to the ISR
    }
    
    void loop() {
      
    }
    
    void zero_crosss_int()  // function to be fired at the zero crossing to dim the light
    {
      zeroState != zeroState; 
      zeroCounter++;
        
      if ( zeroCounter == 60 ) {                        // Every 60 zero crossings change the LED state
        ledState = (ledState == LOW) ? HIGH : LOW;
        digitalWrite( ledPin , ledState );
        zeroCounter = 0;
      }
    }
    

    I welcome any input on the design or code as I work through this, so feel free to chime in any time.

    Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
    Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

    YveauxY 1 Reply Last reply
    2
    • dbemowskD dbemowsk

      Background
      Some time back I had posted a project that I was interested in pursuing. On my old X10 equipment that I ran years back, I had used some dimmer modules to control lights and ceiling fans in my house. One part that I liked about the modules was for the lights, it had a soft start in which the light would ramp up to brightness when turned on, and fade to black when turned off. I also had speed control of my ceiling fans with these modules. The only problem was that I had to use 2 modules for each light and fan combo and fit them into the fan shroud.

      The Idea
      I am working on designing some modules for controlling my light fan combos in a similar manner. Right now I am controlling them with Sonoff modules controlled by my Vera controller. I would like to try some node to node communication with these to possibly have them work if my controller is down. The WAF goes down heavily when the controller has issues which has happened on occasion.

      The Circuit
      I would like to include the pro mini and all electronics in the final design. I am also thinking of including both nRF24L01 as well as an option for RFM69 for others that may be interested in this. As a start, here is my proposed schematic for the dimmer control portion of the modules. I have included snubbers on both triac opto circuits, but on whichever one would be used for the light dimming, the snubber could potentially be omitted. I am looking for input on whether people think this design will work.
      0_1525134006346_9e897ada-0980-4e0a-9806-fbbe10208d98-image.png

      I have already made a proto board with the zero crossing detector and tested it with this code which successfully blinks the LED on my UNO when power is plugged in. This tells me too that the zero crossing ISR is working as it should which is a start to the code that will run this.

      const uint8_t ledPin = 13;                          // Digital output pin that has the on board LED
      const uint8_t zeroPin = 2;                          // Digital input pin to which the zero crossing detector is connected
      
      uint8_t zeroCounter = 0;
      bool zeroState = 0;
      bool ledState = LOW;
      
      void setup() {
        Serial.begin(9600);
        pinMode( ledPin , OUTPUT );                       // Enable output driver for LED pin
        attachInterrupt(0, zero_crosss_int, RISING);      // Choose the zero cross interrupt and attach it to the ISR
      }
      
      void loop() {
        
      }
      
      void zero_crosss_int()  // function to be fired at the zero crossing to dim the light
      {
        zeroState != zeroState; 
        zeroCounter++;
          
        if ( zeroCounter == 60 ) {                        // Every 60 zero crossings change the LED state
          ledState = (ledState == LOW) ? HIGH : LOW;
          digitalWrite( ledPin , ledState );
          zeroCounter = 0;
        }
      }
      

      I welcome any input on the design or code as I work through this, so feel free to chime in any time.

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #2

      @dbemowsk said in Reviving an old project:

      I had to use 2 modules for each light and fan combo

      Why?

      http://yveaux.blogspot.nl

      dbemowskD 1 Reply Last reply
      0
      • YveauxY Yveaux

        @dbemowsk said in Reviving an old project:

        I had to use 2 modules for each light and fan combo

        Why?

        dbemowskD Offline
        dbemowskD Offline
        dbemowsk
        wrote on last edited by
        #3

        @yveaux One for the fan and one for the light. They didn't make a single X10 module that did both as one unit.

        Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
        Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

        YveauxY 1 Reply Last reply
        0
        • dbemowskD dbemowsk

          @yveaux One for the fan and one for the light. They didn't make a single X10 module that did both as one unit.

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by
          #4

          @dbemowsk ah, ok. Now I get it :-)

          http://yveaux.blogspot.nl

          dbemowskD 1 Reply Last reply
          0
          • YveauxY Yveaux

            @dbemowsk ah, ok. Now I get it :-)

            dbemowskD Offline
            dbemowskD Offline
            dbemowsk
            wrote on last edited by
            #5

            @yveaux That's why I'm trying to design a module that handles both as one unit.

            Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
            Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

            1 Reply Last reply
            0
            • nagelcN Offline
              nagelcN Offline
              nagelc
              wrote on last edited by
              #6

              I've been thinking about trying to make a dimmer using this chip:

              https://www.digikey.com/product-detail/en/on-semiconductor/FL5160MX/FL5160MXTR-ND/6126507

              It does the heavy lifting on the zero cross logic and claims to be good with LED bulbs. It's meant to be very easy to make a potentiometer controlled dimmer, but if you can provide a variable voltage signal, you can control it from a microcontroller.

              I have been meaning to get one and experiment with it, but I've been more focused on learning how to use NRF5 modules at the moment.

              dbemowskD 1 Reply Last reply
              0
              • nagelcN nagelc

                I've been thinking about trying to make a dimmer using this chip:

                https://www.digikey.com/product-detail/en/on-semiconductor/FL5160MX/FL5160MXTR-ND/6126507

                It does the heavy lifting on the zero cross logic and claims to be good with LED bulbs. It's meant to be very easy to make a potentiometer controlled dimmer, but if you can provide a variable voltage signal, you can control it from a microcontroller.

                I have been meaning to get one and experiment with it, but I've been more focused on learning how to use NRF5 modules at the moment.

                dbemowskD Offline
                dbemowskD Offline
                dbemowsk
                wrote on last edited by
                #7

                @nagelc Thanks, I'll look into this more.

                Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                1 Reply Last reply
                0
                • tbowmoT Offline
                  tbowmoT Offline
                  tbowmo
                  Admin
                  wrote on last edited by
                  #8

                  @nagelc

                  Had a quick look at the datasheet for that IC.. It requires either a variable resistor, or a 0-10V input, to control the thing.

                  With some RC filtering you could make an analog voltage from the PWM, but that is only 0-3.3V, or 0-5V, depending on supply voltages for the MCU, then you need to boost that up to the 0-10V..

                  1 Reply Last reply
                  0
                  • tbowmoT Offline
                    tbowmoT Offline
                    tbowmo
                    Admin
                    wrote on last edited by
                    #9

                    @dbemowsk

                    found some interesting reading about leading / trailing edge dimming: http://www.ledjournal.com/main/blogs/leading-edge-vs-trailing-edge-dimmers/

                    1 Reply Last reply
                    0
                    • rvendrameR Offline
                      rvendrameR Offline
                      rvendrame
                      Hero Member
                      wrote on last edited by
                      #10

                      According to this, avoid trailing edge dimmers to control inductive loads (fan motor in this case).

                      Home Assistant / Vera Plus UI7
                      ESP8266 GW + mySensors 2.3.2
                      Alexa / Google Home

                      1 Reply Last reply
                      0
                      • dbemowskD Offline
                        dbemowskD Offline
                        dbemowsk
                        wrote on last edited by
                        #11

                        For now I am okay with leading edge triac based dimmers as all I am running are incandescent bulbs right now anyway, so I am going to stick with the triac based dimmers for now. Even in the future I may at least stick with the triac based dimmer with the snubbers for the fan control as that is an inductive load. If I could find some dimmable LED bulbs that use the LM3450 based driver made by national semiconductor or the TPS92210 from Texas Instruments, it looks like that type should work with triac based dimmers. This can be found referenced in this article from Digikey.

                        Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                        Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                        DrJeffD 1 Reply Last reply
                        0
                        • dbemowskD dbemowsk

                          For now I am okay with leading edge triac based dimmers as all I am running are incandescent bulbs right now anyway, so I am going to stick with the triac based dimmers for now. Even in the future I may at least stick with the triac based dimmer with the snubbers for the fan control as that is an inductive load. If I could find some dimmable LED bulbs that use the LM3450 based driver made by national semiconductor or the TPS92210 from Texas Instruments, it looks like that type should work with triac based dimmers. This can be found referenced in this article from Digikey.

                          DrJeffD Offline
                          DrJeffD Offline
                          DrJeff
                          wrote on last edited by
                          #12

                          @dbemowsk Any progress I want to do this as well?

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          23

                          Online

                          11.7k

                          Users

                          11.2k

                          Topics

                          113.1k

                          Posts


                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • MySensors
                          • OpenHardware.io
                          • Categories
                          • Recent
                          • Tags
                          • Popular