Announcement

Collapse
No announcement yet.

NodeMCU connected Neopixel strips

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    NodeMCU connected Neopixel strips

    Just thought I'd share some work I put in this weekend to control Neopixel RGBW LED strips via the Arduino plug-in.

    First some background:
    A few months back, I installed around 10 meters of addressable Neopixel strips - SK6812s specifically - above and below my kitchen cabinets, wired to a NodeMCU for control. I started out using ESPEasy firmware to control it by http commands. That worked well enough, and I planned to create some virtual devices and events to control them with Homeseer. Unfortunately, during testing I found the firmware was not reliable enough for everyday use. I'm still not sure what was causing it, but after a variable amount of time, the NodeMCU would become unreachable and require a press of the reset button. So I gave up on ESPEasy.

    I looked at a few other firmwares, and was considering moving to RPI for control when I remembered I had purchased a license for the Arduino plug-in but hadn't made use of it yet. Sadly, since most users probably don't bother with addressable LEDs for cabinet lighting, I didn't find any other posts about having done what I needed. So I played around for a bit with the NodeMCU API and I now have a working sketch that let's me control my pixels directly from Homeseer. As of now I have Brightness, R, G, B, and W devices with sliders to adjust individual color values and another device with preset color values. It works great, and I've yet to have any connectivity issues. I also love that OTA updating is built into the API sketch, as I haven't needed to plug and unplug the NodeMCU dozens of times as I did with some other solutions I toyed with.

    Here's a screenshot of the controls:

    Click image for larger version

Name:	CabinetLEDControls.PNG
Views:	1
Size:	45.5 KB
ID:	1212270

    And one of the Plug-in config page:

    Click image for larger version

Name:	PluginConfig.PNG
Views:	1
Size:	63.1 KB
ID:	1212271

    Here are the edits I made to the API sketch:

    NeopixelSketchEdits.txt


    When I have the time, I plan to add some inputs to control the cabinet tops and bottoms independently so I can, for example, set top and bottom brightness to different levels or turn off the bottoms and dim the tops at night. Once that's done, I want to look at creating patterns without the delay() function, and possibly set up buttons in Homeseer to make holiday light themes simple.

    Overall I'm very pleased with how easily I was able to get something up and running with this plugin, and I hope someone else finds this post useful.

    WeaslyD

    #2
    I have neopixels in my queue of hardware and things to do with the intention of doing a fake tv implementation based upon the work previously done by Adafruit. I think I am going with the Sonoff ESP8266 as my host, but have not got that far yet.

    I have gone the Tasmota route rather than ESPeasy by the luck of the draw so I do have some learning investment with that firmware. Actually using Atom/Platform IO for my development rather than Arduino IDE. I also tried Visual Code but could not get past first base.

    I assume you have no idea of what was failing with ESPEasy?

    Comment


      #3
      Ive been wanting to get into Addressable Leds, but It seems complicated. I need a 24" strip to do a slow chase. I read a post on a forum somewhere else where someone built a program to prototype the lighting sequence on the PC. Is there a program that does that? If I could build a sequence, and have HS trigger the different routines would be what I need. So you were able to have HS send commands to the LED Controller to trigger certain color commands. Would it be the same deal with triggering a chase sequence?

      Comment


        #4
        WeaslyD just got on the list of very cool people! thanks for sharing! I've been wanting to get the neopixel strips into HS but I am too much a noob to the api process that it is above my ability (just yet)

        Thanks weaslyD

        Comment


          #5
          Originally posted by Michael McSharry View Post
          I assume you have no idea of what was failing with ESPEasy?
          That's right, no idea. I tried different versions of the ESPEasy firmware, excluded unnecessary components from the firmware build, changed power supplies for the NodeMCU, tried Nodes bought from different suppliers, swapped in a different Wi-Fi AP to rule out weird wi-fi issues, etc, before I gave up. It would run fine for days at times, then become unresponsive. I should mention, I have one Node running ESPEasy behind our bedroom TV acting as an IR controller to power on/off and change the volume by Google Home -> HomeSeer -> NodeMCU HTTP command. It has performed flawlessly for nearly a year. All I can figure is there was something in the LED code that caused the ESP8266 to crash.

          Comment


            #6
            Originally posted by tome10 View Post
            So you were able to have HS send commands to the LED Controller to trigger certain color commands. Would it be the same deal with triggering a chase sequence?
            Generally, yes. In my case I wanted HomeSeer's values for the individual LED colors to be accurate even when I used a preset, so I trigger HS events when on of my preset buttons is pressed and HS sets the individual RGBW values. Here's an example event:

            Click image for larger version

Name:	EventCapture.PNG
Views:	1
Size:	35.0 KB
ID:	1196279

            My original plan was to monitor my Cabinet Preset Arduino API Output - in my case array element FromHS[5] - for changes and deal with presets in my Arduino code rather than in HomeSeer. So I set up Value/Status pairs for each preset button like this:

            Click image for larger version

Name:	ValueStatus.PNG
Views:	1
Size:	40.9 KB
ID:	1196278

            I would then have added "if (FromHS[5] == 0) {presetWhite()}", "if (FromHS[5] == 1) {presetRed()}", etc, in the Arduino API sketch to handle each of the presets.

            You could do this but set the statuses to "Chase", "Fade", etc, to control patterns. Then in your code, when the value for "Chase" is detected, run the neopixel chase function. Be aware though, that you have to find examples to create your chase pattern without using the delay() function, because that will interrupt execution of the Arduino plug-in code. Unfortunately, all patterns I know of use delays by default.

            Hope my response is clear, and that it helps!

            Comment


              #7
              Originally posted by wadesready View Post
              WeaslyD just got on the list of very cool people! thanks for sharing! I've been wanting to get the neopixel strips into HS but I am too much a noob to the api process that it is above my ability (just yet)

              Thanks weaslyD

              Thanks for the compliment! I spent hours "doing it wrong" when I first looked at the the sketches created by the plugin. Turns out all the work I was doing was already included in the latest beta release. Once I got up to date, it was great to combine the flexibility of the super affordable NodeMCU boards with the power of homeseer. My next project will likely be some soil moisture monitors so I can add my wife's favorite houseplants to Homeseer.

              If I can help you work through anything, just say the word!

              Comment


                #8
                Tip for moisture sensors. Don't use the type that has metallic contact with soil. Very short lifetimes. Use capacitive or volumetric ones.

                Comment


                  #9

                  Comment


                    #10
                    If you are handy then the Sonoff basic units ($5) can be modified with a single cut and a single wire solder to convert it from a WiFi mains relay to a dry-contact (low voltage) relay. You will also upload HS-friendly firmware. The Section describing the Garage Door controller in http://mcsSprinklers.com/mcsMQTT.pdf provides all the details.

                    What is nice about these Sonoff units is that they come with a case and power supply. Most other ultra low cost microcontrollers come with just a naked development board.

                    Comment


                      #11
                      If you are handy then the Sonoff basic units ($5) can be modified with a single cut and a single wire solder to convert it from a WiFi mains relay to a dry-contact (low voltage) relay. You will also upload HS-friendly firmware. The Section describing the Garage Door controller in http://mcsSprinklers.com/mcsMQTT.pdf provides all the details.

                      What is nice about these Sonoff units is that they come with a case and power supply. Most other ultra low cost microcontrollers come with just a naked development board.
                      I assume this was for me.
                      I'm off on terminology.. You're saying the snip removes the power from the relay, and it can act as an on/off switch for a separate/isolated device? This while communicating via WIFI to Homeseer?
                      If that's correct;
                      What voltage does the Sonoff operate at? (I did a search, and I think 110). I need the Sonoff or other device to operate on 3v battery pack, and basically do the light sleep thing for a couple of months between battery replacement.
                      Trying to keep wires off the dining rm table.

                      Comment


                        #12
                        The Sonoff is basically an ESP8266 with a power supply and relay. The ESP8266 is a 3.3V device so it controls the relay at this level. The relay contacts are rated at 10 Amps so can handle most anything you have.

                        In the attached I circled in red the modification that is needed to convert the unit from a 120/220V relay to a dry contact/low voltage relay. It is a hacksaw cut through the board and a short solder bridge next to where the cut was made.

                        The firmware that comes with the Sonoff will respond to Alexa via cloud, but installing different firmware opens up other options such as HTTP or MQTT interaction via HS. Never looked into controlling it via cloud with HS as that was not an option I wanted.

                        If you want to run off of battery then Sonoff is likely not your best choice. The ESP8266 and especially the ESP32 have deep sleep modes geared for battery operation. This requires more low level programming of the microcontroller to take advantage of these.
                        Attached Files

                        Comment


                          #13
                          Originally posted by weaslyd View Post
                          Just thought I'd share some work I put in this weekend to control Neopixel RGBW LED strips via the Arduino plug-in.

                          First some background:
                          A few months back, I installed around 10 meters of addressable Neopixel strips - SK6812s specifically - above and below my kitchen cabinets, wired to a NodeMCU for control. I started out using ESPEasy firmware to control it by http commands. That worked well enough, and I planned to create some virtual devices and events to control them with Homeseer. Unfortunately, during testing I found the firmware was not reliable enough for everyday use. I'm still not sure what was causing it, but after a variable amount of time, the NodeMCU would become unreachable and require a press of the reset button. So I gave up on ESPEasy.

                          I looked at a few other firmwares, and was considering moving to RPI for control when I remembered I had purchased a license for the Arduino plug-in but hadn't made use of it yet. Sadly, since most users probably don't bother with addressable LEDs for cabinet lighting, I didn't find any other posts about having done what I needed. So I played around for a bit with the NodeMCU API and I now have a working sketch that let's me control my pixels directly from Homeseer. As of now I have Brightness, R, G, B, and W devices with sliders to adjust individual color values and another device with preset color values. It works great, and I've yet to have any connectivity issues. I also love that OTA updating is built into the API sketch, as I haven't needed to plug and unplug the NodeMCU dozens of times as I did with some other solutions I toyed with.

                          Here's a screenshot of the controls:

                          [ATTACH]68041[/ATTACH]

                          And one of the Plug-in config page:

                          [ATTACH]68042[/ATTACH]

                          Here are the edits I made to the API sketch:

                          [ATTACH]68043[/ATTACH]


                          When I have the time, I plan to add some inputs to control the cabinet tops and bottoms independently so I can, for example, set top and bottom brightness to different levels or turn off the bottoms and dim the tops at night. Once that's done, I want to look at creating patterns without the delay() function, and possibly set up buttons in Homeseer to make holiday light themes simple.

                          Overall I'm very pleased with how easily I was able to get something up and running with this plugin, and I hope someone else finds this post useful.

                          WeaslyD
                          I got this up and working....first time I ever messed with addressable leds....but now I am not too sure what to do with them. hahaha let me explain... I ended up with 4 sets of 12 leds of each color in a 50 bulb string, that switch from bulb set to bulb set when I change the value of one of the switches in homeseer. maybe this is the way they are suppose to work? I have been trying to figure out a way to arrange the leds in a pattern that will make sense but I am at a loss, so I came to the place where I know someone has an answer for me???? anybody have experience and ideas?

                          this is the string I used.. https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1
                          Last edited by wadesready; August 3, 2018, 04:00 PM.

                          Comment


                            #14
                            Can someone point me to a good writeup on how to initial programming of an ESP32?

                            Comment


                              #15
                              I do not have a good reference, but I recognize we are on the uphill slope vs. 8286 which is on the downhill side. In the Spring I took my Tasmota build and ported it to ESP32 on which LoRa chip was interfaced. Got to the point where I could receive or send, but not both. I suspect it was cpu utilization and my next step was to get the second processor on the ESP32 operational. Summer came so this has taken a back seat. When I resume I will need to relearn what I had done.

                              I use PlatformIO, but don’t have a good feel of how it works. Much time on Google to take even the smallest steps. C is also difficult for me so need to clone code snippets which makes progress very slow.

                              Comment

                              Working...
                              X