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. Wall mounted 'mood light' v2

Wall mounted 'mood light' v2

Scheduled Pinned Locked Moved My Project
29 Posts 12 Posters 13.2k Views 15 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.
  • AWIA AWI

    @Reza a first observation...there is an invalid character in both json commands (%7 and %13) change this to %20. So change:
    http://192.168.0.111:8080/json.htm?type=command&param=switchlight&idx=18&switchcmd=Set%13Level&level=1
    to
    http://192.168.0.111:8080/json.htm?type=command&param=switchlight&idx=18&switchcmd=Set%20Level&level=1

    The %20 is the ASCII code for a space.

    R Offline
    R Offline
    Reza
    wrote on last edited by Reza
    #4

    @AWI
    i change this but dont work
    0_1476207888152_12.jpg

    0_1476207873923_123.jpg

    0_1476208421403_1234.jpg

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Reza
      wrote on last edited by
      #5

      also i change this lines in sketch :

        present(CHILD_1, S_DIMMER);
      

      and

      case CHILD_1:
      

      i dont know where is problem

      AWIA 1 Reply Last reply
      0
      • R Reza

        also i change this lines in sketch :

          present(CHILD_1, S_DIMMER);
        

        and

        case CHILD_1:
        

        i dont know where is problem

        AWIA Offline
        AWIA Offline
        AWI
        Hero Member
        wrote on last edited by AWI
        #6

        @Reza What does not work? I can read from (last few lines of) the serial output that you are receiving messages. Put a few Serial.prints() in the case statement below to show if you the structure is working.

         switch (mySwitch) {
                  case 0:
                    {
                       Serial.println("Entered case 0") ;
                        irsend.send(NEC, 0x200848b7, 32);  // whatever on switch action 0
                    }
                    break ;
                  case 1:
                    {
                       Serial.println("Entered case 1") ;
                      irsend.send(NEC, 0x2008c837, 32);  // whatever on switch action 1
                    }
                    break ;
                  case 2:
                    {
                       Serial.println("Entered case 2") ;
                      irsend.send(NEC, 0x2008c837, 32);  // whatever on switch action 2
                    }
                    break ;
        
                }
        
        R 1 Reply Last reply
        0
        • AWIA AWI

          @Reza What does not work? I can read from (last few lines of) the serial output that you are receiving messages. Put a few Serial.prints() in the case statement below to show if you the structure is working.

           switch (mySwitch) {
                    case 0:
                      {
                         Serial.println("Entered case 0") ;
                          irsend.send(NEC, 0x200848b7, 32);  // whatever on switch action 0
                      }
                      break ;
                    case 1:
                      {
                         Serial.println("Entered case 1") ;
                        irsend.send(NEC, 0x2008c837, 32);  // whatever on switch action 1
                      }
                      break ;
                    case 2:
                      {
                         Serial.println("Entered case 2") ;
                        irsend.send(NEC, 0x2008c837, 32);  // whatever on switch action 2
                      }
                      break ;
          
                  }
          
          R Offline
          R Offline
          Reza
          wrote on last edited by Reza
          #7

          @AWI

          code is working well. in web dimmer (irrrrr) in pic is working, 6% is send code VOL+ and 13% is send code VOL -
          but in selector virtual device(ir sensoooooooooooooooooooor, this is not work .when i push VOL + (in selector) dont send code and dont work. also VOL -

          1 Reply Last reply
          0
          • 1kohm1 Offline
            1kohm1 Offline
            1kohm
            wrote on last edited by
            #8

            Hello AWI,

            great stuff!, you inspired my by posting this article to build similiar mood light.
            for LED I've used ring 16 x LED ws2812b 5V neopixel.
            Wiring:
            "stripPin = 5" is connected to pin 4 on LED, which is "DIN - Control data signal input"

            Sketch used from this post. While compiling, I got following warnings, but think that that they should't cause a problem:

            In file included from C:\Users\Jon\Documents\Arduino\libraries\FastLED/platforms/avr/fastled_avr.h:4:0,
                             from C:\Users\Jon\Documents\Arduino\libraries\FastLED/platforms.h:27,
                             from C:\Users\Jon\Documents\Arduino\libraries\FastLED/FastLED.h:52,
                             from C:\Users\Jon\Documents\Arduino\MySensors-Mood_light_v2.ino\MySensors-Mood_light_v2.ino.ino:55:
            C:\Users\Jon\Documents\Arduino\libraries\FastLED/fastled_delay.h:37:0: warning: "NOP" redefined
            
             #  define NOP __asm__ __volatile__ ("cp r0,r0\n");
            
             ^
            
            In file included from C:\Users\Jon\Documents\Arduino\libraries\MySensors/drivers/RF24/RF24.cpp:23:0,
                             from C:\Users\Jon\Documents\Arduino\libraries\MySensors/MySensors.h:242,
                             from C:\Users\Jon\Documents\Arduino\MySensors-Mood_light_v2.ino\MySensors-Mood_light_v2.ino.ino:53:
            C:\Users\Jon\Documents\Arduino\libraries\MySensors/drivers/RF24/RF24.h:144:0: note: this is the location of the previous definition
            
             #define NOP             0xFF
            
             ^
            In file included from C:\Users\Jon\Documents\Arduino\MySensors-Mood_light_v2.ino\MySensors-Mood_light_v2.ino.ino:55:0:
            
            C:\Users\Jon\Documents\Arduino\libraries\FastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.003
            
             #    pragma message "FastLED version 3.001.003"
            
                                 ^
            

            Here's my node output from serial monitor:

            Starting sensor (RNNNA-, 2.0.0)
            TSM:INIT
            TSM:RADIO:OK
            TSP:ASSIGNID:OK (ID=62)
            TSM:FPAR
            TSP:MSG:SEND 62-62-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
            TSP:MSG:READ 0-0-62 s=255,c=3,t=8,pt=1,l=1,sg=0:0
            TSP:MSG:FPAR RES (ID=0, dist=0)
            TSP:MSG:PAR OK (ID=0, dist=1)
            TSM:FPAR:OK
            TSM:ID
            TSM:CHKID:OK (ID=62)
            TSM:UPL
            TSP:PING:SEND (dest=0)
            TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
            TSP:MSG:READ 0-0-62 s=255,c=3,t=25,pt=1,l=1,sg=0:1
            TSP:MSG:PONG RECV (hops=1)
            TSP:CHKUPL:OK
            TSM:UPL:OK
            TSM:READY
            TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
            TSP:MSG:SEND 62-62-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0
            TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
            TSP:MSG:READ 0-0-62 s=255,c=3,t=6,pt=0,l=1,sg=0:M
            TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=11,pt=0,l=17,sg=0,ft=0,st=ok:AWI RGB Wall W 62
            TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:2.0
            TSP:MSG:SEND 62-62-0-0 s=1,c=0,t=26,pt=0,l=17,sg=0,ft=0,st=ok:RGB Wall RGB W 62
            TSP:MSG:SEND 62-62-0-0 s=0,c=0,t=3,pt=0,l=19,sg=0,ft=0,st=ok:RGB Wall Light W 62
            TSP:MSG:SEND 62-62-0-0 s=2,c=0,t=3,pt=0,l=25,sg=0,ft=0,st=ok:RGB Set Solid color (text
            TSP:MSG:SEND 62-62-0-0 s=3,c=0,t=36,pt=0,l=23,sg=0,ft=0,st=ok:RGB Wall textcolor W 62
            TSP:MSG:SEND 62-62-0-0 s=4,c=0,t=3,pt=0,l=19,sg=0,ft=0,st=ok:RGB Wall Alarm W 62
            TSP:MSG:SEND 62-62-0-0 s=5,c=0,t=4,pt=0,l=21,sg=0,ft=0,st=ok:RGB Wall Pattern W 62
            No registration required
            Init complete, id=62, parent=0, distance=1, registration=1
            

            Everything seems to be ok. For controller I use Domoticz, devices where discovered and added to controller .

            Later on, on serial monitor I got:

            TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:57916
            TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:117917
            .....
            

            When I press the button I got:

            TSP:MSG:SEND 62-62-0-0 s=0,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:1
            

            When pressed once more I got:

            TSP:MSG:SEND 62-62-0-0 s=0,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:0
            

            Problem is, that later nothing happens (after shortly pressing the button - pin 4)

            Only, when I press in Domoticz the leds starts to blink white/red in pulse mode (so wiring is ok?)

            0_1476553854351_upload-090e3039-9b7b-41e9-9b51-43cbe02002cf

            on serial monitor I got: ("st=fail:1"It's displayed 10 times)

            TSP:MSG:READ 0-0-62 s=4,c=1,t=2,pt=0,l=1,sg=0:1
            TSP:MSG:ACK msg
            TSP:MSG:SEND 62-62-0-0 s=4,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=ok:1
            Sensor: 4
             Color: - Brightness: 127
            TSP:MSG:READ 0-0-62 s=4,c=1,t=2,pt=0,l=1,sg=0:1
            TSP:MSG:ACK msg
            !TSP:MSG:SEND 62-62-0-0 s=4,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=fail:1
            Sensor: 4
            

            Later i got a looot of times:

            !TSM:UPL FAIL, SNP
            TSM:FPAR
            TSP:MSG:SEND 62-62-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
            TSP:MSG:READ 0-0-62 s=4,c=1,t=2,pt=0,l=1,sg=0:1
            TSP:MSG:ACK msg
            !TSP:SEND:TNR
            Sensor: 4
             Color: - Brightness: 127
            TSP:MSG:READ 0-0-62 s=4,c=1,t=2,pt=0,l=1,sg=0:1
            TSP:MSG:ACK msg
            !TSP:SEND:TNR
            Sensor: 4
            

            and @the end it seems that node stop responding:

            !TSM:FPAR:FAIL
            !TSM:FAILURE
            TSM:PDT
            TSM:INIT
            

            When I press the button (pin 4) few times, long/short, then I got some random patterns, but node seems to be crashed and canno't be controlled from Domoticz.

            I apriciate any kind of your supprot in my case.

            Best

            AWIA 1 Reply Last reply
            0
            • 1kohm1 1kohm

              Hello AWI,

              great stuff!, you inspired my by posting this article to build similiar mood light.
              for LED I've used ring 16 x LED ws2812b 5V neopixel.
              Wiring:
              "stripPin = 5" is connected to pin 4 on LED, which is "DIN - Control data signal input"

              Sketch used from this post. While compiling, I got following warnings, but think that that they should't cause a problem:

              In file included from C:\Users\Jon\Documents\Arduino\libraries\FastLED/platforms/avr/fastled_avr.h:4:0,
                               from C:\Users\Jon\Documents\Arduino\libraries\FastLED/platforms.h:27,
                               from C:\Users\Jon\Documents\Arduino\libraries\FastLED/FastLED.h:52,
                               from C:\Users\Jon\Documents\Arduino\MySensors-Mood_light_v2.ino\MySensors-Mood_light_v2.ino.ino:55:
              C:\Users\Jon\Documents\Arduino\libraries\FastLED/fastled_delay.h:37:0: warning: "NOP" redefined
              
               #  define NOP __asm__ __volatile__ ("cp r0,r0\n");
              
               ^
              
              In file included from C:\Users\Jon\Documents\Arduino\libraries\MySensors/drivers/RF24/RF24.cpp:23:0,
                               from C:\Users\Jon\Documents\Arduino\libraries\MySensors/MySensors.h:242,
                               from C:\Users\Jon\Documents\Arduino\MySensors-Mood_light_v2.ino\MySensors-Mood_light_v2.ino.ino:53:
              C:\Users\Jon\Documents\Arduino\libraries\MySensors/drivers/RF24/RF24.h:144:0: note: this is the location of the previous definition
              
               #define NOP             0xFF
              
               ^
              In file included from C:\Users\Jon\Documents\Arduino\MySensors-Mood_light_v2.ino\MySensors-Mood_light_v2.ino.ino:55:0:
              
              C:\Users\Jon\Documents\Arduino\libraries\FastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.003
              
               #    pragma message "FastLED version 3.001.003"
              
                                   ^
              

              Here's my node output from serial monitor:

              Starting sensor (RNNNA-, 2.0.0)
              TSM:INIT
              TSM:RADIO:OK
              TSP:ASSIGNID:OK (ID=62)
              TSM:FPAR
              TSP:MSG:SEND 62-62-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
              TSP:MSG:READ 0-0-62 s=255,c=3,t=8,pt=1,l=1,sg=0:0
              TSP:MSG:FPAR RES (ID=0, dist=0)
              TSP:MSG:PAR OK (ID=0, dist=1)
              TSM:FPAR:OK
              TSM:ID
              TSM:CHKID:OK (ID=62)
              TSM:UPL
              TSP:PING:SEND (dest=0)
              TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
              TSP:MSG:READ 0-0-62 s=255,c=3,t=25,pt=1,l=1,sg=0:1
              TSP:MSG:PONG RECV (hops=1)
              TSP:CHKUPL:OK
              TSM:UPL:OK
              TSM:READY
              TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
              TSP:MSG:SEND 62-62-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0
              TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
              TSP:MSG:READ 0-0-62 s=255,c=3,t=6,pt=0,l=1,sg=0:M
              TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=11,pt=0,l=17,sg=0,ft=0,st=ok:AWI RGB Wall W 62
              TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:2.0
              TSP:MSG:SEND 62-62-0-0 s=1,c=0,t=26,pt=0,l=17,sg=0,ft=0,st=ok:RGB Wall RGB W 62
              TSP:MSG:SEND 62-62-0-0 s=0,c=0,t=3,pt=0,l=19,sg=0,ft=0,st=ok:RGB Wall Light W 62
              TSP:MSG:SEND 62-62-0-0 s=2,c=0,t=3,pt=0,l=25,sg=0,ft=0,st=ok:RGB Set Solid color (text
              TSP:MSG:SEND 62-62-0-0 s=3,c=0,t=36,pt=0,l=23,sg=0,ft=0,st=ok:RGB Wall textcolor W 62
              TSP:MSG:SEND 62-62-0-0 s=4,c=0,t=3,pt=0,l=19,sg=0,ft=0,st=ok:RGB Wall Alarm W 62
              TSP:MSG:SEND 62-62-0-0 s=5,c=0,t=4,pt=0,l=21,sg=0,ft=0,st=ok:RGB Wall Pattern W 62
              No registration required
              Init complete, id=62, parent=0, distance=1, registration=1
              

              Everything seems to be ok. For controller I use Domoticz, devices where discovered and added to controller .

              Later on, on serial monitor I got:

              TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:57916
              TSP:MSG:SEND 62-62-0-0 s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=ok:117917
              .....
              

              When I press the button I got:

              TSP:MSG:SEND 62-62-0-0 s=0,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:1
              

              When pressed once more I got:

              TSP:MSG:SEND 62-62-0-0 s=0,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:0
              

              Problem is, that later nothing happens (after shortly pressing the button - pin 4)

              Only, when I press in Domoticz the leds starts to blink white/red in pulse mode (so wiring is ok?)

              0_1476553854351_upload-090e3039-9b7b-41e9-9b51-43cbe02002cf

              on serial monitor I got: ("st=fail:1"It's displayed 10 times)

              TSP:MSG:READ 0-0-62 s=4,c=1,t=2,pt=0,l=1,sg=0:1
              TSP:MSG:ACK msg
              TSP:MSG:SEND 62-62-0-0 s=4,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=ok:1
              Sensor: 4
               Color: - Brightness: 127
              TSP:MSG:READ 0-0-62 s=4,c=1,t=2,pt=0,l=1,sg=0:1
              TSP:MSG:ACK msg
              !TSP:MSG:SEND 62-62-0-0 s=4,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=fail:1
              Sensor: 4
              

              Later i got a looot of times:

              !TSM:UPL FAIL, SNP
              TSM:FPAR
              TSP:MSG:SEND 62-62-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
              TSP:MSG:READ 0-0-62 s=4,c=1,t=2,pt=0,l=1,sg=0:1
              TSP:MSG:ACK msg
              !TSP:SEND:TNR
              Sensor: 4
               Color: - Brightness: 127
              TSP:MSG:READ 0-0-62 s=4,c=1,t=2,pt=0,l=1,sg=0:1
              TSP:MSG:ACK msg
              !TSP:SEND:TNR
              Sensor: 4
              

              and @the end it seems that node stop responding:

              !TSM:FPAR:FAIL
              !TSM:FAILURE
              TSM:PDT
              TSM:INIT
              

              When I press the button (pin 4) few times, long/short, then I got some random patterns, but node seems to be crashed and canno't be controlled from Domoticz.

              I apriciate any kind of your supprot in my case.

              Best

              AWIA Offline
              AWIA Offline
              AWI
              Hero Member
              wrote on last edited by
              #9

              @1kohm A lot of questions in ine post ;-)

              Your node seems to be working, at least for a part. The red/white when you press the button is what should happen. The 'fail' messages indicate a transmission problem. Did you take the nescessary measures for the radio (i.e. capacitor)?
              The warnings for fastled in the compiler can be ingnored.

              1 Reply Last reply
              0
              • 1kohm1 Offline
                1kohm1 Offline
                1kohm
                wrote on last edited by
                #10

                @AWI
                I've tried to be detailed :)
                Ok, here's how my radio and connections looks like:
                Power suplly (5V, 3A) goes to RPi3 --> USB --> Arduino Uno gateway with radio (NRFL01+PA+LNA with 4,7uF 16V capacitor. Radio powered from 3,3V arduino pin). I've also tried with non amplified radio - the same result:(
                3 devices (incl. gateway) connected via USB to RPi3. I've boosted current on RPi3 USB ports to 1,2A, by adding line:

                max_usb_curent=1
                

                to /boot/config.txt, but that didn't change anything.

                Node is pro mini 5V, Radio NRFL01 has 4,7uF capacitor and 3,3 power supply goes from step-down regulator.

                My other nodes (1 wire temp, lux metter, relay, DHT sensor) are working when connected without disturb.

                For examlpe when I set:

                0_1476613765179_upload-60a437e3-4950-499f-b448-3b86e52f1131

                Then RGB color is send to node, but after a while I canno't do anything more (communication crashes) and I got a lot of:

                !TSP:MSG:PVER mismatch
                TSP:MSG:READ 0-0-28 s=1,c=1,t=3,pt=0,l=0,sg=0:
                

                Any advice will be apriciate

                AWIA 1 Reply Last reply
                0
                • 1kohm1 1kohm

                  @AWI
                  I've tried to be detailed :)
                  Ok, here's how my radio and connections looks like:
                  Power suplly (5V, 3A) goes to RPi3 --> USB --> Arduino Uno gateway with radio (NRFL01+PA+LNA with 4,7uF 16V capacitor. Radio powered from 3,3V arduino pin). I've also tried with non amplified radio - the same result:(
                  3 devices (incl. gateway) connected via USB to RPi3. I've boosted current on RPi3 USB ports to 1,2A, by adding line:

                  max_usb_curent=1
                  

                  to /boot/config.txt, but that didn't change anything.

                  Node is pro mini 5V, Radio NRFL01 has 4,7uF capacitor and 3,3 power supply goes from step-down regulator.

                  My other nodes (1 wire temp, lux metter, relay, DHT sensor) are working when connected without disturb.

                  For examlpe when I set:

                  0_1476613765179_upload-60a437e3-4950-499f-b448-3b86e52f1131

                  Then RGB color is send to node, but after a while I canno't do anything more (communication crashes) and I got a lot of:

                  !TSP:MSG:PVER mismatch
                  TSP:MSG:READ 0-0-28 s=1,c=1,t=3,pt=0,l=0,sg=0:
                  

                  Any advice will be apriciate

                  AWIA Offline
                  AWIA Offline
                  AWI
                  Hero Member
                  wrote on last edited by
                  #11

                  @1kohm said:

                  MSG:PVER mismatch

                  My best advice is to look at @hek 's advice in this thread.

                  1 Reply Last reply
                  0
                  • 1kohm1 Offline
                    1kohm1 Offline
                    1kohm
                    wrote on last edited by
                    #12

                    FIXED!
                    Happy :)

                    Issue was so obvious...
                    I was supplying Neopixel LED's with 5V trought Arduino pro mini... so when node was starting everything was ok till sending light pattern to node. When data was send, LED's took to much Watts, and radio was crashing...
                    So now I just powered LED's with 5V parerall to the node ( LED's are supplied before node).

                    Now, I need to understand your code, how "buttonPin" is working and how to set patterns. It seems that the code is acting wired sometimes, but I think that's due to my less knowledge about it now.

                    Thanks for guidlines!

                    AWIA 1 Reply Last reply
                    2
                    • 1kohm1 1kohm

                      FIXED!
                      Happy :)

                      Issue was so obvious...
                      I was supplying Neopixel LED's with 5V trought Arduino pro mini... so when node was starting everything was ok till sending light pattern to node. When data was send, LED's took to much Watts, and radio was crashing...
                      So now I just powered LED's with 5V parerall to the node ( LED's are supplied before node).

                      Now, I need to understand your code, how "buttonPin" is working and how to set patterns. It seems that the code is acting wired sometimes, but I think that's due to my less knowledge about it now.

                      Thanks for guidlines!

                      AWIA Offline
                      AWIA Offline
                      AWI
                      Hero Member
                      wrote on last edited by
                      #13

                      @1kohm good to hear. The button is a basic method of manual operation. Not very user friendly. In the latest sketch you can use a dimmer to select the patterns

                      Have fun

                      1 Reply Last reply
                      0
                      • Tore André RosanderT Offline
                        Tore André RosanderT Offline
                        Tore André Rosander
                        wrote on last edited by
                        #14

                        @AWI
                        Amasing! I have been using your v1 sketch on 5 different nodes.
                        I was just about to make another one when i saw that you had released another version.

                        I have made a similar hack to your v1 with a dimmer/selector switch in domoticz as pattern selector. But your code looks way better :)

                        1 Reply Last reply
                        1
                        • Cliff KarlssonC Offline
                          Cliff KarlssonC Offline
                          Cliff Karlsson
                          wrote on last edited by Cliff Karlsson
                          #15

                          If I wanted to add a effect like:

                          #include "FastLED.h"
                          #define NUM_LEDS 60 
                          CRGB leds[NUM_LEDS];
                          #define PIN 6 
                          
                          void setup()
                          {
                            FastLED.addLeds<WS2811, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
                          }
                          
                          // *** REPLACE FROM HERE ***
                          void loop() { 
                            // ---> here we call the effect function <---
                          }
                          
                          // ---> here we define the effect function <---
                          // *** REPLACE TO HERE ***
                          
                          void showStrip() {
                           #ifdef ADAFRUIT_NEOPIXEL_H 
                             // NeoPixel
                             strip.show();
                           #endif
                           #ifndef ADAFRUIT_NEOPIXEL_H
                             // FastLED
                             FastLED.show();
                           #endif
                          }
                          
                          void setPixel(int Pixel, byte red, byte green, byte blue) {
                           #ifdef ADAFRUIT_NEOPIXEL_H 
                             // NeoPixel
                             strip.setPixelColor(Pixel, strip.Color(red, green, blue));
                           #endif
                           #ifndef ADAFRUIT_NEOPIXEL_H 
                             // FastLED
                             leds[Pixel].r = red;
                             leds[Pixel].g = green;
                             leds[Pixel].b = blue;
                           #endif
                          }
                          
                          void setAll(byte red, byte green, byte blue) {
                            for(int i = 0; i < NUM_LEDS; i++ ) {
                              setPixel(i, red, green, blue); 
                            }
                            showStrip();
                          }
                          
                          
                          void loop() {
                           SnowSparkle(0x10, 0x10, 0x10, 20, random(100,1000));
                          }
                          
                          void SnowSparkle(byte red, byte green, byte blue, int SparkleDelay, int SpeedDelay) {
                           setAll(red,green,blue);
                           
                           int Pixel = random(NUM_LEDS);
                           setPixel(Pixel,0xff,0xff,0xff);
                           showStrip();
                           delay(SparkleDelay);
                           setPixel(Pixel,red,green,blue);
                           showStrip();
                           delay(SpeedDelay);
                          }
                          

                          What would I need to change/add in the code?

                          1 Reply Last reply
                          0
                          • JurikJ Offline
                            JurikJ Offline
                            Jurik
                            wrote on last edited by
                            #16

                            Hi there, I am very happy with this project. Somehow with the transition to the current stable library (2.0) the lights won't turn off completely. I can't figure out what is wrong. Anyone has some suggestions?

                            AWIA 1 Reply Last reply
                            0
                            • JurikJ Jurik

                              Hi there, I am very happy with this project. Somehow with the transition to the current stable library (2.0) the lights won't turn off completely. I can't figure out what is wrong. Anyone has some suggestions?

                              AWIA Offline
                              AWIA Offline
                              AWI
                              Hero Member
                              wrote on last edited by
                              #17

                              @Jurik Happened to me too... change the auto increments in the updateLightBrightness() routine to ++actualBrightness and --actualBrightness.

                              See below

                              // Update the light brightness if time
                              void updateLightBrightness(){
                                  // global: curBrightness, actualBrightness, updateBrightnessDelay, lastBrightnessUpdate ;
                                  static byte actualBrightness ;                          // store real brightness state for slow dim
                                  unsigned long now = millis() ;
                                  if (now > lastBrightnessUpdate + updateBrightnessDelay){// check if time for update
                                      if ( actualBrightness > curBrightness) {
                                          FastLED.setBrightness( --actualBrightness);
                                          FastLED.show();
                                      } else if ( actualBrightness < curBrightness){
                                          FastLED.setBrightness( ++actualBrightness );
                                          FastLED.show();
                                          }
                                      lastBrightnessUpdate = now ;
                                      }
                                  }
                              
                              1 Reply Last reply
                              2
                              • Cliff KarlssonC Offline
                                Cliff KarlssonC Offline
                                Cliff Karlsson
                                wrote on last edited by Cliff Karlsson
                                #18

                                @AWI what does this mean: "const int numPixel = 16 ; // set to number of pixels (x top / y bottom)" ?
                                If I have a strip with 72 leds that are in a row up/down, should I just enter 72?

                                I also can't figure out how to control the leds from domoticz. I have copied your sketch and I see the device in domoticz under nrf-radio-gateway (with 7 childs)

                                I have tried to create a dummy selector and have tried to add this:
                                http://192.168.0.175:8080/json.htm?type=command&param=switchlight&idx=1094&switchcmd=Set Level&level=pFire
                                http://192.168.0.175:8080/json.htm?type=command&param=switchlight&idx=1094&switchcmd=Set Level&level=0
                                http://192.168.0.175:8080/json.htm?type=command&param=switchlight&idx=1094&switchcmd=Set Level&level=1
                                http://192.168.0.175:8080/json.htm?type=command&param=switchlight&idx=1094&switchcmd=Set Level&level=2
                                http://192.168.0.175:8080/json.htm?type=command&param=switchlight&idx=1094&switchcmd=Set Level&level=pOn

                                But nothing seams to work, I have also tried the commands directly in the chrome url bar with no effect. What am I missing?

                                1 Reply Last reply
                                0
                                • Cliff KarlssonC Offline
                                  Cliff KarlssonC Offline
                                  Cliff Karlsson
                                  wrote on last edited by
                                  #19

                                  Ahhh, the effects start at 4 ? when trying numbers 4-10 I get effects for most numbers but a few like 8-9 is blank and 0-2 turns strip off. When fiddeling about, I managed to get the alarm at number 4 to speed up somehow. I tried to read the sketch but cant quite understand.

                                  1 Reply Last reply
                                  0
                                  • JurikJ Offline
                                    JurikJ Offline
                                    Jurik
                                    wrote on last edited by Jurik
                                    #20

                                    @AWI Thanx for the advice! i will try it as soon as i get the chance. Great work!! thanx.

                                    @Cliff-Karlsson Afaik, the numPixels correspond to the total number of leds combined with up/down or left/right. So 16 will make it an 8x8 wall light and 2 would make it a 1 by 1, 72 would make it 36x36. As far as the triggers in Domoticz, i am also new at this. I did manage to get the alarm running and the patterns through the dimmer function, but am unable to set up the patterns on a switch. Domoticz won't let me somehow. Will try to give this more prio.

                                    Keep trying! and posting please

                                    1 Reply Last reply
                                    0
                                    • JurikJ Offline
                                      JurikJ Offline
                                      Jurik
                                      wrote on last edited by
                                      #21

                                      @AWI the preincrement trick worked! thanx!

                                      1 Reply Last reply
                                      0
                                      • N Offline
                                        N Offline
                                        Nicklas Starkel
                                        wrote on last edited by
                                        #22

                                        Hey @AWI

                                        I have some trouble using this with MqTT messages.
                                        I can get alarm to go off by sending a payload of '1' to 'InMQTT/62/4/1/0/2' and subsequently turn it off with any other value.

                                        But I can't get the rest of your functions to work!
                                        If I read your code correct, to set a solid color I would have to send several MqTT messages to the children?
                                        Ex, I would have to send 'InMQTT/62/1/1/0/40' and payload ex 'Candle' first.
                                        Then 'InMQTT/62/1/1/0/2' with payload of '1' to turn it on?
                                        I was looking at the serial protocol and do not find what V_Dimmer is for type. (https://www.mysensors.org/download/serial_api_20#variable-types)

                                        Anyways, i cant get it to work properly, maybe you could shed some light (pun not intended :+1: ) )?

                                        1 Reply Last reply
                                        0
                                        • D Offline
                                          D Offline
                                          dakipro
                                          wrote on last edited by
                                          #23

                                          If someone still needs it, I managed to control it via mqtt (node-red). I am about to integrate it into the openhab, it might be easier to start that but I wanted to have good control over it (and understand mqtt a bit better).
                                          In sketch I had to change

                                          } else if (message.type == V_DIMMER) { // if DIMMER type, adjust brightness
                                          

                                          to V_PERCENTAGE for latest api/mqtt

                                          and I am still struggling a bit to turn all LEDs off completely. Only way I could achieve this was to set color to black (000000). code as it is always leaves my LEDs to 1% or something. But that might be due to node-red implementation, as I do not have response from node-red on "questions" from the node (at some point in code node will ask controller about some values (color if I remember correctly), but I just send the color and brightness manually via injectors). I guess this can be fixed on the controller side, and most likely works with openhab implementation.

                                          Here are the triggers in node-red

                                          0_1511731871029_Screenshot 2017-11-26 22.30.28.png

                                          Here is the node-red code

                                          [{"id":"8f6785a0.874838","type":"debug","z":"8cfe95c3.331248","name":"","active":true,"console":"false","complete":"false","x":1210,"y":180,"wires":[]},{"id":"a300f395.f6e59","type":"mqtt out","z":"8cfe95c3.331248","name":"","topic":"mygateway1-in/50/5/0/0/3","qos":"","retain":"","broker":"9daccc99.b6c71","x":490,"y":680,"wires":[]},{"id":"45adf375.e59b6c","type":"inject","z":"8cfe95c3.331248","name":"9 - pOff","topic":"","payload":"9","payloadType":"str","repeat":"","crontab":"","once":false,"x":170,"y":640,"wires":[["a300f395.f6e59"]]},{"id":"859588e.a1bec78","type":"mqtt out","z":"8cfe95c3.331248","name":"","topic":"mygateway1-in/50/1/0/0/40","qos":"","retain":"","broker":"9daccc99.b6c71","x":560,"y":180,"wires":[]},{"id":"39b0ef0e.94ef","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"22FF22","payloadType":"str","repeat":"","crontab":"","once":false,"x":210,"y":160,"wires":[["859588e.a1bec78"]]},{"id":"9dabd8f3.6033b8","type":"inject","z":"8cfe95c3.331248","name":"Alarm pattern","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"x":250,"y":40,"wires":[["3a117d06.451d12"]]},{"id":"3a117d06.451d12","type":"mqtt out","z":"8cfe95c3.331248","name":"","topic":"mygateway1-in/50/4/1/0/2","qos":"","retain":"","broker":"9daccc99.b6c71","x":560,"y":40,"wires":[]},{"id":"e3c2d218.e92dc","type":"mqtt out","z":"8cfe95c3.331248","name":"","topic":"mygateway1-in/50/4/1/0/2","qos":"","retain":"","broker":"9daccc99.b6c71","x":550,"y":80,"wires":[]},{"id":"5325f52d.2549fc","type":"inject","z":"8cfe95c3.331248","name":"Alarm OFF","topic":"","payload":"0","payloadType":"str","repeat":"","crontab":"","once":false,"x":230,"y":80,"wires":[["e3c2d218.e92dc"]]},{"id":"f9bc44c0.c1f2d8","type":"mqtt in","z":"8cfe95c3.331248","name":"Magic Ball #50","topic":"mygateway1-out/50/#","qos":"2","broker":"9daccc99.b6c71","x":920,"y":180,"wires":[["8f6785a0.874838"]]},{"id":"6a07f043.d5e8a","type":"comment","z":"8cfe95c3.331248","name":"node-id / child-sensor-id / command / ack / type / payload","info":"","x":1030,"y":60,"wires":[]},{"id":"f71ad6cd.2044a8","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"2222EE","payloadType":"str","repeat":"","crontab":"","once":false,"x":210,"y":200,"wires":[["859588e.a1bec78"]]},{"id":"44e58ecb.748fb","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"991122","payloadType":"str","repeat":"","crontab":"","once":false,"x":210,"y":240,"wires":[["859588e.a1bec78"]]},{"id":"a91be428.b74eb8","type":"comment","z":"8cfe95c3.331248","name":"Set color manually","info":"","x":170,"y":120,"wires":[]},{"id":"90b541d2.c2abf","type":"mqtt out","z":"8cfe95c3.331248","name":"","topic":"mygateway1-in/50/1/0/0/3","qos":"","retain":"","broker":"9daccc99.b6c71","x":550,"y":340,"wires":[]},{"id":"91fe4122.027e3","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"80","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":320,"wires":[["90b541d2.c2abf"]]},{"id":"47bc1da0.380374","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"20","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":360,"wires":[["90b541d2.c2abf"]]},{"id":"baa820db.90109","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"2","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":400,"wires":[["90b541d2.c2abf"]]},{"id":"709b3196.8abe","type":"comment","z":"8cfe95c3.331248","name":"Set brightnes manually","info":"","x":180,"y":280,"wires":[]},{"id":"1cf7aba7.c34224","type":"mqtt out","z":"8cfe95c3.331248","name":"","topic":"mygateway1-in/50/1/0/0/2","qos":"","retain":"","broker":"9daccc99.b6c71","x":550,"y":480,"wires":[]},{"id":"4263529d.67e44c","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":480,"wires":[["1cf7aba7.c34224"]]},{"id":"2528b5c4.d1bc6a","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"0","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":520,"wires":[["1cf7aba7.c34224"]]},{"id":"e2707070.7e9dc","type":"comment","z":"8cfe95c3.331248","name":"Toggle last brightnes (not needed?)","info":"","x":200,"y":440,"wires":[]},{"id":"3b8f804c.e92f7","type":"inject","z":"8cfe95c3.331248","name":"18 - pOn","topic":"","payload":"18","payloadType":"str","repeat":"","crontab":"","once":false,"x":180,"y":680,"wires":[["a300f395.f6e59"]]},{"id":"d9d700e9.90d03","type":"inject","z":"8cfe95c3.331248","name":"27 - pFire","topic":"","payload":"27","payloadType":"str","repeat":"","crontab":"","once":false,"x":180,"y":760,"wires":[["a300f395.f6e59"]]},{"id":"b2cd2709.3706e8","type":"inject","z":"8cfe95c3.331248","name":"0 - pSolid","topic":"","payload":"0","payloadType":"str","repeat":"","crontab":"","once":false,"x":180,"y":600,"wires":[["a300f395.f6e59"]]},{"id":"a3c976d.8dbe488","type":"comment","z":"8cfe95c3.331248","name":"Patterns: pSolid, pOff, pOn, pAlarm, pFire, pFire2, pCandle, pCircle, pSinelon, pRainbow","info":"","x":660,"y":640,"wires":[]},{"id":"667c092c.9b9298","type":"inject","z":"8cfe95c3.331248","name":"36 - pFire2","topic":"","payload":"36","payloadType":"str","repeat":"","crontab":"","once":false,"x":180,"y":800,"wires":[["a300f395.f6e59"]]},{"id":"ca6823c6.a674","type":"inject","z":"8cfe95c3.331248","name":"25 - pAlarm","topic":"","payload":"25","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":720,"wires":[["a300f395.f6e59"]]},{"id":"75c152f3.3c287c","type":"inject","z":"8cfe95c3.331248","name":"45 - pCandle","topic":"","payload":"45","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":840,"wires":[["a300f395.f6e59"]]},{"id":"6da316d0.eebd68","type":"inject","z":"8cfe95c3.331248","name":"53 - pCircle","topic":"","payload":"53","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":880,"wires":[["a300f395.f6e59"]]},{"id":"2c15c208.c1db0e","type":"inject","z":"8cfe95c3.331248","name":"62 - pSinelon (blocks all!)","topic":"","payload":"62","payloadType":"str","repeat":"","crontab":"","once":false,"x":230,"y":920,"wires":[["a300f395.f6e59"]]},{"id":"431aad05.60f7e4","type":"inject","z":"8cfe95c3.331248","name":"","topic":"","payload":"66 - rainbow","payloadType":"str","repeat":"","crontab":"","once":false,"x":190,"y":960,"wires":[["a300f395.f6e59"]]},{"id":"b1b44b6e.1492a8","type":"comment","z":"8cfe95c3.331248","name":"Set pattern","info":"","x":100,"y":560,"wires":[]},{"id":"70d088e7.889c98","type":"inject","z":"8cfe95c3.331248","name":"0 - doesn't work, use color black","topic":"","payload":"0","payloadType":"str","repeat":"","crontab":"","once":false,"x":390,"y":400,"wires":[["90b541d2.c2abf"]]},{"id":"d5d24b03.2a6288","type":"inject","z":"8cfe95c3.331248","name":"000000 - black turns led off","topic":"","payload":"000000","payloadType":"str","repeat":"","crontab":"","once":false,"x":430,"y":240,"wires":[["859588e.a1bec78"]]},{"id":"9daccc99.b6c71","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]
                                          

                                          C: OpenHAB2 with node-red on linux laptop
                                          GW: Arduino Nano - W5100 Ethernet, Nrf24l01+ 2,4Ghz mqtt
                                          GW: Arduino Mega, RFLink 433Mhz

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


                                          25

                                          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