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. Controllers
  3. Homeseer
  4. RGBW Example

RGBW Example

Scheduled Pinned Locked Moved Homeseer
14 Posts 6 Posters 9.8k 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.
  • L Offline
    L Offline
    LastSamurai
    Hardware Contributor
    wrote on last edited by
    #1

    Hi,

    I have read in the last patchnotes that rgb(w) leds are now officially supported. How do I use this type of sensor (or actor?!)? Are there any examples or texts about this?
    Thanks for the help!

    1 Reply Last reply
    1
    • G Offline
      G Offline
      Gefkuz
      wrote on last edited by
      #2

      Hi,
      +1
      Especially because numbers of PWM outputs on arduino is limited with NRF24 connections.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        LastSamurai
        Hardware Contributor
        wrote on last edited by
        #3

        The "hardware" part isn't really a problem for me (once I am done with my current project I might write a tutorial for that). Also @Gefkuz: you can use software pwm in most cases if you don't have enough PWM pins. In this case only 3 are left, so I guess you would need one more on the arduino pro mini.

        My problem is more on the software/protocol side. What kind of messages do I need to send, so that mySensors (and domoticz ;) ) does understand my message. Does it work like the dimmer example, only with 3/4 dimmers?

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #4

          Not sure Homeseer-plugin supports the new RGB(W) device types introduced in 1.5. If so the dimmer values is sent to the node using a ASCII hex value FF0000 (== red).

          Here is an sketch which presents 3-dimmer devices for the controller and handles the incoming messages from controller.
          https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/examples/RGB-3D/RGB-3D.ino

          1 Reply Last reply
          0
          • L Offline
            L Offline
            LastSamurai
            Hardware Contributor
            wrote on last edited by
            #5

            Thanks for that example. Looks like domoticz also supports it. I will have to try that soon.

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vil1driver
              wrote on last edited by vil1driver
              #6

              I hope you will like it, dimoticz not fully support S_RGB_LIGHT yet but this sketch use three dimmers and one on/off for start/stop rgb color cycle. Work just perfect. :-) thanks hek to share it.

              1 Reply Last reply
              0
              • L Offline
                L Offline
                LastSamurai
                Hardware Contributor
                wrote on last edited by
                #7

                Which sketch do you mean? The one hek posted? The one in the post you linked is only displaying the values it gets...

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  vil1driver
                  wrote on last edited by vil1driver
                  #8

                  I was mean mine :D RGB-3D.ino.

                  howto, sry for french thread but screenshots are useful..

                  you can try gizmocuz test sketch like I done, but as you can read (link posted) it's not usable yet

                  ps: why posting in homeseer controler section, if you use domoticz ?

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    LastSamurai
                    Hardware Contributor
                    wrote on last edited by
                    #9

                    Guess I will have to see how good my french still is^^

                    Good question actually... I don't know why this is in the homeseer section. I defenitly intended it to bin the the domoticz section. Could someone move this?

                    Anyways, I got it to work with domoticz only partially. It shows up as an RGBW switch but you can only select RGB colors (where do you get the white part from?) and it seems like only on and off commands reach the sensor. No new color values.
                    I will keep trying though.

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      LastSamurai
                      Hardware Contributor
                      wrote on last edited by LastSamurai
                      #10

                      V_RGBW seems to be working. I will post my code once one more problem is solved:
                      I do get a new hex string from the server on the arduino side... how do I break that up into 4x 0..255 values to control the pwm pins? I found some hints to use bit shifting, but I am unsure how to use that. Any ideas?

                      Example:

                      void incomingMessage(const MyMessage &message) {
                      
                      // h = hex value
                      // message = e.g. (h) #112233AB
                      redval = ?; // h11 => 17
                      greenval = ?; // h22 => 34
                      blueval = ?; // h33 = 51
                      whiteval = ?; //AB = 171
                      
                      analogWrite(RED_PIN, redval);     
                      analogWrite(GREEN_PIN, greenval);
                      analogWrite(BLUE_PIN, blueval);
                      analogWrite(WHITE_PIN, whiteval);
                      
                      }
                      
                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kaziya
                        wrote on last edited by
                        #11

                        i just built an rgb led light last weekend, so i would like to see get the code working as rgb vs 3 dimmers.

                        i did a quick google i found this http://stackoverflow.com/questions/23576827/arduino-convert-a-sting-hex-ffffff-into-3-int which seems to be what your looking for with 3 values, i havent had a chance to test it or expand it to 4 values.

                        @LastSamurai anychance you would be willing to share what you have so far?

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          LastSamurai
                          Hardware Contributor
                          wrote on last edited by
                          #12

                          I surely would, but I sadly haven't had the time to do more testing. Perhaps this weekend. I posted my own question on stackoverflow and it seems like I have found a solution (although not tested by me yet).
                          Domoticz with V_RGBW worked though when I first tried it. With that part of the code you should be able to get it up and running.

                          fetsF 1 Reply Last reply
                          0
                          • L LastSamurai

                            I surely would, but I sadly haven't had the time to do more testing. Perhaps this weekend. I posted my own question on stackoverflow and it seems like I have found a solution (although not tested by me yet).
                            Domoticz with V_RGBW worked though when I first tried it. With that part of the code you should be able to get it up and running.

                            fetsF Offline
                            fetsF Offline
                            fets
                            wrote on last edited by
                            #13

                            To convert a hex string to elementary colors, you have to do, something like that :

                            1- convert your string to unsigned 32 bit integer

                               unsigned long value = strtol( hexstring, NULL, 16);
                            

                            2- assuming your integer is coded : 0xrrggbbww

                               uint8_t redval = (value >> 24) & 0xFF ;
                               uint8_t greenval = (value >> 16) & 0xFF ;
                               uint8_t blueval = (value >> 8) & 0xFF ;
                               uint8_t whiteval = value & 0xFF ;
                            
                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              LastSamurai
                              Hardware Contributor
                              wrote on last edited by
                              #14

                              Thanks for the help. I got it to work. I posted a link to the code over here.

                              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