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. AC diming

AC diming

Scheduled Pinned Locked Moved My Project
16 Posts 6 Posters 7.2k Views 4 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.
  • rvendrameR rvendrame

    @thomasdc , as simple as

     // Channel Number
      int i = message.sensor;
    
    T Offline
    T Offline
    thomasdc
    wrote on last edited by thomasdc
    #7

    @rvendrame said:

    @thomasdc , as simple as

     // Channel Number
      int i = message.sensor;
    

    Thank you very much for the reply!
    can you expain it a litle more?

    so i have 4 dimmers:

    MyMessage dimmer1Msg(AC_pin1, V_DIMMER);
    MyMessage light1Msg(AC_pin1, V_LIGHT);
    MyMessage dimmer2Msg(AC_pin2, V_DIMMER);
    MyMessage light2Msg(AC_pin2, V_LIGHT);
    MyMessage dimmer3Msg(AC_pin2, V_DIMMER);
    MyMessage light3Msg(AC_pin3, V_LIGHT);
    MyMessage dimmer4Msg(AC_pin4, V_DIMMER);
    MyMessage light4Msg(AC_pin4, V_LIGHT);
    

    how do i get the vallue for each dimmer?
    so how do i get an 'int i' for channel one, an 'int j' for channel two, and so on ?
    where do i put the code? is it just behind the:

    void incomingMessage(const MyMessage &message) {
      if (message.type == V_LIGHT || message.type == V_DIMMER) {
    

    ? do i have to change something in the 'void incomming message' (see above)

    big thanks!

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

      My RGBW sketch is basically 4 dimmers also, take a look in this thread:

      http://forum.mysensors.org/topic/1939/scripting-scenes-for-rgb-strip-best-way-to-control-mysensors-rgbw-node-from-vera/6

      • Tomas
      T 1 Reply Last reply
      0
      • korttomaK korttoma

        My RGBW sketch is basically 4 dimmers also, take a look in this thread:

        http://forum.mysensors.org/topic/1939/scripting-scenes-for-rgb-strip-best-way-to-control-mysensors-rgbw-node-from-vera/6

        T Offline
        T Offline
        thomasdc
        wrote on last edited by
        #9

        @korttoma said:

        My RGBW sketch is basically 4 dimmers also, take a look in this thread:

        http://forum.mysensors.org/topic/1939/scripting-scenes-for-rgb-strip-best-way-to-control-mysensors-rgbw-node-from-vera/6

        thanks for the reply!

        I dont really get your code... you receive a byte from the controller? / you use a 'mode' to set your dimmers? my dimmers are 4 induvidual dimmers and dont have to work together ..

        1 Reply Last reply
        0
        • C Offline
          C Offline
          csa02221862
          wrote on last edited by
          #10

          Another way to go is to use something like this and just convert everything to 12/24v dc. You can upgrade your lighting as you go and much easier and safer than AC dimming. If coarse there is still the ceiling fan to deal with. I will probably do that with an IR blaster.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            csa02221862
            wrote on last edited by
            #11

            Forgot the link.....

            http://www.12vmonster.com/products/ac-dc-12-volt-to-24-volt-12w-60x-5050-cluster-led-light-bulb-e26-e27-screw-fitting-lamp?variant=379155053

            1 Reply Last reply
            0
            • T Offline
              T Offline
              thomasdc
              wrote on last edited by
              #12

              but anyway how to get the different dimmer value's from the controller stays the same ;) and i am still troubling on that :s

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

                Just ignor the mode related code, you probably dont need that. I allso have 4 individual dimmers they just happen to be connected to a RGBW Led strip. Same same but different.

                • Tomas
                1 Reply Last reply
                0
                • korttomaK Offline
                  korttomaK Offline
                  korttoma
                  Hero Member
                  wrote on last edited by
                  #14

                  Simplified the sketch code a bit. Here is an example how you can control 4 individual dimmers:

                  // Example sketch showing how to control RGBW LED Strip.
                  
                  //IMPORTANTE NOTE!!! one of the "radio" pins has been moved from pin 9 to pin 4 because the White is connected to pin 9 because only 3,5,6 and 9 are PWM outputs!!!!
                  
                  // This code should generate 4 Dimmer devices in Vera so you can control the RED, GREEN, BLUE and WHITE individualy
                  
                  #define SN "RGBW"
                  #define SV "1.2"
                  
                  #include <MySensor.h>
                  #include <SPI.h>
                  
                  
                  #define NODE_ID AUTO
                  
                  #define RED       3 // pin for red LED
                  #define GREEN     5 // pin for green 
                  #define BLUE      6 // pin for blue
                  #define WHITE     9 // pin for white 
                  
                  #define RF24_CE_PIN		4	//<-- NOTE!!! (4,10) and NOT (9,10)
                  #define RF24_CS_PIN		10
                  #define RF24_PA_LEVEL	RF24_PA_MAX
                  
                  MyTransportNRF24 transport(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL);
                  
                  MySensor gw(transport);
                  
                  void setup()
                  {
                  	
                  	gw.begin(setDimmerStatus, NODE_ID);
                  	
                  	// Send the Sketch Version Information to the Gateway
                  	gw.sendSketchInfo(SN, SV);
                  	// Register all sensors to gw (they will be created as child devices)
                  	gw.present(RED, S_DIMMER);
                  	gw.present(GREEN, S_DIMMER);
                  	gw.present(BLUE, S_DIMMER);
                  	gw.present(WHITE, S_DIMMER);
                  
                  
                  	pinMode(RED, OUTPUT);
                  	pinMode(GREEN, OUTPUT);
                  	pinMode(BLUE, OUTPUT);
                  	pinMode(WHITE, OUTPUT);
                  	
                  	
                  
                  	//Get values from RAM and write to outputs
                  	analogWrite(RED, 255 * gw.loadState(RED) / 100);
                  	analogWrite(GREEN, 255 * gw.loadState(GREEN) / 100);
                  	analogWrite(BLUE, 255 * gw.loadState(BLUE) / 100);
                  	analogWrite(WHITE, 255 * gw.loadState(WHITE) / 100);
                  
                  }
                  
                  void loop()
                  {
                  	gw.process();
                  	
                  	
                  }
                  
                  void setDimmerStatus(const MyMessage &message)
                  {
                  		
                  	if (message.type == V_DIMMER)
                  	{
                  		uint8_t incomingDimmerStatus = message.getByte();
                  
                  		analogWrite(message.sensor, 255 * incomingDimmerStatus / 100);
                  		gw.saveState(message.sensor, message.getByte()); //Save value to RAM
                  
                  	}
                  		
                  }```
                  • Tomas
                  1 Reply Last reply
                  0
                  • FotoFieberF Offline
                    FotoFieberF Offline
                    FotoFieber
                    Hardware Contributor
                    wrote on last edited by
                    #15

                    Today I played with my AC dimmer
                    http://forum.mysensors.org/topic/1316/ac-dimmer-with-openhab/3

                    It is very similar to the one reference above (but maybe a little bit cheaper :) ).

                    Good news: it is working fine with normal light bulbs and halogen tubes.

                    Bad news: it doesn't work with the high voltage LED tubes I testetd.

                    Has anybody a recommendation for a dimmable LED tube (E27/E17 230 V) working with the setup from this thread?

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

                      @FotoFieber , I use some 230V dimmable leds that I bought from IKEA in Germany about 1 year ago and and they work good. Some are Philips and some are IKEA-branded.
                      Most important is the 'dimmable' word on them. Most of current led drivers are not designed for AC dimming, as this increase the unit costs (usually the driver is more expensive than the leds itself)...

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

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


                      10

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.0k

                      Posts


                      Copyright 2019 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