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. Development
  3. Dimmer sensor

Dimmer sensor

Scheduled Pinned Locked Moved Development
24 Posts 9 Posters 16.7k Views 3 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.
  • B blacey

    Checkout http://forum.micasaverde.com/index.php/topic,23342.0.html for a thread on a PWM dimmer for LED strips including the initial sketch.

    Here is the next gen mysensors.org board that I am working on and will support up to 4 channels and power sensing - http://forum.micasaverde.com/index.php/topic,23342.msg176334.html#msg176334

    Cheers,
    Bruce

    C Offline
    C Offline
    C4Vette
    wrote on last edited by
    #6

    @blacey
    You're sketch looks really nice and I would like to use it but I started already with the 1.4 libraries. Any chance you will rewrite it for 1.4? I've had a look at it but it's to complicated for me to understand.

    H 1 Reply Last reply
    0
    • C C4Vette

      @blacey
      You're sketch looks really nice and I would like to use it but I started already with the 1.4 libraries. Any chance you will rewrite it for 1.4? I've had a look at it but it's to complicated for me to understand.

      H Offline
      H Offline
      hek
      Admin
      wrote on last edited by hek
      #7

      @C4Vette

      I did a quick 1.4 conversion just now.
      Note that I haven't verified it with any real hardware or anything.
      I will include it in the examples folder for 1.4 when someone has verified it.

      https://codebender.cc/example/MySensor/DimmableLEDActuator

      C boblasureB 2 Replies Last reply
      0
      • H hek

        @C4Vette

        I did a quick 1.4 conversion just now.
        Note that I haven't verified it with any real hardware or anything.
        I will include it in the examples folder for 1.4 when someone has verified it.

        https://codebender.cc/example/MySensor/DimmableLEDActuator

        C Offline
        C Offline
        C4Vette
        wrote on last edited by C4Vette
        #8

        @hek
        That is great! Thank you very much, it worked first time. I have a LED-strip with a 50N06 FET connected to 12v and a 10K pull-down on the gate. Flawless!
        Well, maybe one tiny little thing: when the dimmer is at 100% and I press the minus it always goes to 80% instead of 90%.
        But this is not something in the sketch but in the library.

        About the part:
        // hek comment: Is this really nessesary?
        gw.send( dimmerMsg.set(currentLevel) );

        I left that out and there is no difference at all

        Edit: I tried about every markdown possibility there is to create a code-block but it doesn't work. Sorry.

        1 Reply Last reply
        0
        • H hek

          @C4Vette

          I did a quick 1.4 conversion just now.
          Note that I haven't verified it with any real hardware or anything.
          I will include it in the examples folder for 1.4 when someone has verified it.

          https://codebender.cc/example/MySensor/DimmableLEDActuator

          boblasureB Offline
          boblasureB Offline
          boblasure
          wrote on last edited by boblasure
          #9

          @hek * This sketch is extensible to support more than one MOSFET/PWM dimmer per circuit.
          How do you add more outputs to this? I would like to add PWM 5 and 6 to this. I am using the EasyIot controller. @blacey

          B 1 Reply Last reply
          0
          • H Offline
            H Offline
            hek
            Admin
            wrote on last edited by
            #10

            That was actually a @blacey comment.

            1 Reply Last reply
            0
            • boblasureB boblasure

              @hek * This sketch is extensible to support more than one MOSFET/PWM dimmer per circuit.
              How do you add more outputs to this? I would like to add PWM 5 and 6 to this. I am using the EasyIot controller. @blacey

              B Offline
              B Offline
              blacey
              Admin
              wrote on last edited by
              #11

              @boblasure So you effectively want 3 children, one for each PWM? You will need to extend the sketch to handle two additional pins/children. @korttoma has already done the work...

              Here is his sketch that handles four channels.

              https://codebender.cc/sketch:44740

              boblasureB 1 Reply Last reply
              1
              • B blacey

                @boblasure So you effectively want 3 children, one for each PWM? You will need to extend the sketch to handle two additional pins/children. @korttoma has already done the work...

                Here is his sketch that handles four channels.

                https://codebender.cc/sketch:44740

                boblasureB Offline
                boblasureB Offline
                boblasure
                wrote on last edited by boblasure
                #12

                @blacey Awesome, thanks for that! And thanks to @korttoma

                1 Reply Last reply
                0
                • jeylitesJ Offline
                  jeylitesJ Offline
                  jeylites
                  wrote on last edited by
                  #13
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mainali
                    wrote on last edited by
                    #14

                    Can this dimmer sketch be used to control the speed of a fan ? If yes then what are the changes I need to do to this sketch. As part of a project I am working on, I intend to control a AC 230V fan using arduino. I was planning to create a sketch which explicitly controls a AC FAN.
                    By doing this am I reinventing the wheel or someone has done this already which I can use.

                    jeylitesJ 1 Reply Last reply
                    0
                    • M mainali

                      Can this dimmer sketch be used to control the speed of a fan ? If yes then what are the changes I need to do to this sketch. As part of a project I am working on, I intend to control a AC 230V fan using arduino. I was planning to create a sketch which explicitly controls a AC FAN.
                      By doing this am I reinventing the wheel or someone has done this already which I can use.

                      jeylitesJ Offline
                      jeylitesJ Offline
                      jeylites
                      wrote on last edited by
                      #15

                      @mainali http://forum.mysensors.org/topic/647/mysensored-230v-motion-sensor-with-light-level/6

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mainali
                        wrote on last edited by
                        #16

                        I have the dimmer circuit with me already. I am looking for the sketch to integrate this with the sensor and send message to the gateway using MQTT for controlling the speed of the fan.

                        Note: I am using a custom controller build using Ruby on Rails(WIP). and ruby-mqtt to send message to the MQTT gateway which is running mysensor code.

                        jeylitesJ 1 Reply Last reply
                        0
                        • M mainali

                          I have the dimmer circuit with me already. I am looking for the sketch to integrate this with the sensor and send message to the gateway using MQTT for controlling the speed of the fan.

                          Note: I am using a custom controller build using Ruby on Rails(WIP). and ruby-mqtt to send message to the MQTT gateway which is running mysensor code.

                          jeylitesJ Offline
                          jeylitesJ Offline
                          jeylites
                          wrote on last edited by
                          #17

                          @mainali I don't think I have what you're looking for :( ...

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            korttoma
                            Hero Member
                            wrote on last edited by
                            #18

                            Would this be of any help? ->

                            https://codebender.cc/sketch:44734

                            1 Reply Last reply
                            1
                            • M Offline
                              M Offline
                              mainali
                              wrote on last edited by
                              #19

                              I have kind of implemented the fan control with a new message type V_FAN, but anyways I will check this out and revert after testing

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mainali
                                wrote on last edited by
                                #20

                                Can the dimmer led actuator example be used to dim a AC 60w incandescent bulb connected 220v connection. If yes what are the modification needed.

                                when it comes to controlling the speed of a FAN or dimming a normal tungsten filament bulb. I have found so many answers but not a single one which explains all.

                                ferpandoF 1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  korttoma
                                  Hero Member
                                  wrote on last edited by
                                  #21

                                  All the dimmer examples does is to change the level on an PWM output according to a 0-100% dimmer slider in the controller. What you connect to the PWM output is up to you. In the example sensor device I posted I have connected a transistor that controls the speed of a 12VDC fan.

                                  I have also maid another sensor that shows as a dimmer in the controller but in the arduino it controls 3 relays instead ( there are not so many rules you have to follow here you can create what you need, that's the beauty of MySensors ).

                                  1 Reply Last reply
                                  0
                                  • M mainali

                                    Can the dimmer led actuator example be used to dim a AC 60w incandescent bulb connected 220v connection. If yes what are the modification needed.

                                    when it comes to controlling the speed of a FAN or dimming a normal tungsten filament bulb. I have found so many answers but not a single one which explains all.

                                    ferpandoF Offline
                                    ferpandoF Offline
                                    ferpando
                                    Hero Member
                                    wrote on last edited by
                                    #22

                                    @mainali
                                    Dimming AC current is far more complex than dimming DC from the hardware perpective.
                                    Do a search on the internet about it and come back with a solution that fits your needs.

                                    1 Reply Last reply
                                    0
                                    • K Offline
                                      K Offline
                                      korttoma
                                      Hero Member
                                      wrote on last edited by korttoma
                                      #23
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • jeylitesJ Offline
                                        jeylitesJ Offline
                                        jeylites
                                        wrote on last edited by jeylites
                                        #24

                                        @mainali

                                        This circuit might help with what you are doing. See attached. Try building this circuit and connect "signal & ground" to dimmer LED actuator PWM. Again I can't stress enough be careful with AC power!!!

                                        AC-board-schematic.jpg

                                        1 Reply Last reply
                                        0

                                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                        With your input, this post could be even better 💗

                                        Register Login
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        20

                                        Online

                                        12.0k

                                        Users

                                        11.2k

                                        Topics

                                        113.4k

                                        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