WS2812 single LED/Pixel Plugin

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

WS2812 single LED/Pixel Plugin

#1 Post by papperone » 15 Jun 2017, 12:55

Hi, I use a lot visual indicators in my projects/nodes and I've been using since a while WS2812 with ESP8266 for several reasons:
1) Comparing to RGB LED I need only one data pin instead of 3
2) If I need more than one visual indicator I can still manage many with one data pin
3) the brightness is easier to control without using PWM
4) I can create any color I want without keeping huge stock of different LEDs

Now I coudl theoretically use ESPEasy for most if not all my projects but I have found no way to use single WS2812 to turn it on (whatever color I want) or off.
I guess this will require a specific plugin which I don't think it's too complex to be written but I've no familiarity with plugin structure and I've foudn no docs nor "template" to try to do it on my own.

Is there any place I can place such request? Maybe someone can help me to understand how to write my own plugin?
I'm sure many of you can find it useful and specially with limited number of PIN I believe this is a great solution (in some modules i've 10 LEDs which turn on/off/different colors to show status of tasks/devices/etc and I manage all of them with just one data pin!)

G.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Re: WS2812 single LED/Pixel Plugin

#2 Post by AndrewJ » 15 Jun 2017, 17:39

Hello @papparone,
That sounds like a really useful device.
Well, one way you could go is to write your own plugin. I'm working on one at the moment, for a completely different sensor module. I agree that there is a shortage of guidance on this, but I'm making progress. Here's some information I've been using, hope it helps...
1. I found this link where someone had written their own plugin. It gives quite a lot of guidance. https://diyprojects.io/esp-easy-develop ... UFqgZDyuUm
2. The Wiki has some guidance: https://www.letscontrolit.com/wiki/inde ... figuration
3. The Plugin Playground: https://github.com/letscontrolit/ESPEas ... Playground - if you can find an existing plugin which is similar to what you want, it can give you a good start.
4. This forum, search for plugin.
5. If you have access to a "normal" Arduino sketch for the device in question, that can help with the plugin. I found that you can even add a piece of "normal" code at the end of the plugin as a subroutine ("method" I think is the technical term?) and call it from within the main plugin code.
6. My plugin (but I can't pretend it's guaranteed to be a good example, it's still work in progress!) is at https://github.com/letscontrolit/ESPEas ... Sensor.ino

I'd say, from my experience, give it a go. If you have questions, this forum is a good source of support. Good luck if you take the plunge!
Andrew

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#3 Post by papperone » 15 Jun 2017, 18:39

Thanks Andrew, indeed I'm already exploring and reading documents...
Actually it seems there are more than one plugin which is supposed to do what I just described but...
1) _P038_NeoPixel.ino --> part of the standard package but does not work (if you want to enable the PIN is not saved thus not working)
2) _P117_Neopixels --> no .ino extension and same number of Nextion plugin, I had a read at the code and I wonder if it was even tested (very messy with lots of obvious mistakes!!!)
3) _P122_NeoPixel.ino --> this seems at least written in a way which I can understand, will give it a try now to include and compile it myself and let's see if it fits my needs

Worst scenario will go the DIY way :D
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#4 Post by papperone » 15 Jun 2017, 23:31

Well I fixed the _P038 plugin and now it seems to work as originally designed! kudos to who wrote it, I simply fix it to make it work with ESPEasy 2.0.0.dev10.

below the full plugin as I've no idea on how to submit it to be included in the next build:

Code: Select all

//#######################################################################################################
//#################################### Plugin 038: NeoPixel Basic #######################################
//#######################################################################################################

// 15-June-2017: Fixed broken plugin; tested with several neopixels (single LED, 8 LED bars and 300 leds strips.

// List of commands:
// (1) NeoPixel,<led nr>,<red 0-255>,<green 0-255>,<blue 0-255>
// (2) NeoPixelAll,<red 0-255>,<green 0-255>,<blue 0-255>
// (3) NeoPixelLine,<start led nr>,<stop led nr>,<red 0-255>,<green 0-255>,<blue 0-255>

// Usage:
// (1): Set RGB Color to specified LED number (eg. NeoPixel,5,255,255,255)
// (2): Set all LED to specified color (eg. NeoPixelAll,255,255,255)
//		If you use 'NeoPixelAll' this will off all LED (like NeoPixelAll,0,0,0)
// (3): Set color LED between <start led nr> and <stop led nr> to specified color (eg. NeoPixelLine,1,6,255,255,255)

#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel *Plugin_038_pixels;

#define PLUGIN_038
#define PLUGIN_ID_038         38
#define PLUGIN_NAME_038       "NeoPixel - Basic"
#define PLUGIN_VALUENAME1_038 ""

int MaxPixels = 0;

boolean Plugin_038(byte function, struct EventStruct *event, String& string)
{
  boolean success = false;

  switch (function)
  {

    case PLUGIN_DEVICE_ADD:
      {
        Device[++deviceCount].Number = PLUGIN_ID_038;
        Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
        Device[deviceCount].VType = SENSOR_TYPE_SINGLE;
        Device[deviceCount].Ports = 0;
        Device[deviceCount].PullUpOption = false;
        Device[deviceCount].InverseLogicOption = false;
        Device[deviceCount].FormulaOption = false;
        Device[deviceCount].ValueCount = 0;
        Device[deviceCount].SendDataOption = true;
        Device[deviceCount].TimerOption = true;
        Device[deviceCount].TimerOptional = true;
        Device[deviceCount].GlobalSyncOption = true;
        break;
      }

    case PLUGIN_GET_DEVICENAME:
      {
        string = F(PLUGIN_NAME_038);
        break;
      }

    case PLUGIN_GET_DEVICEVALUENAMES:
      {
        strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_038));
        break;
      }

    case PLUGIN_WEBFORM_LOAD:
      {
      	addFormNumericBox(string, F("Led Count"), F("plugin_038_leds"), Settings.TaskDevicePluginConfig[event->TaskIndex][0],1,999);
      	success = true;
        break;
      }

    case PLUGIN_WEBFORM_SAVE:
      {
        Settings.TaskDevicePluginConfig[event->TaskIndex][0] = getFormItemInt(F("plugin_038_leds"));
        MaxPixels = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
        success = true;
        break;
      }

    case PLUGIN_INIT:
      {
        if (!Plugin_038_pixels)
        {
          Plugin_038_pixels = new Adafruit_NeoPixel(Settings.TaskDevicePluginConfig[event->TaskIndex][0], Settings.TaskDevicePin1[event->TaskIndex], NEO_GRB + NEO_KHZ800);
          Plugin_038_pixels->begin(); // This initializes the NeoPixel library.
        }
        MaxPixels = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
        success = true;
        break;
      }

    case PLUGIN_WRITE:
      {
        if (Plugin_038_pixels)
        {
          String tmpString  = string;
          int argIndex = tmpString.indexOf(',');
          if (argIndex)
            tmpString = tmpString.substring(0, argIndex);

          if (tmpString.equalsIgnoreCase(F("NeoPixel")))
          {
            char Line[80];
            char TmpStr1[80];
            TmpStr1[0] = 0;
            string.toCharArray(Line, 80);
            int Par4 = 0;
            if (GetArgv(Line, TmpStr1, 5)) Par4 = str2int(TmpStr1);
            Plugin_038_pixels->setPixelColor(event->Par1 - 1, Plugin_038_pixels->Color(event->Par2, event->Par3, Par4));
            Plugin_038_pixels->show(); // This sends the updated pixel color to the hardware.
            success = true;
          }
          
          if (tmpString.equalsIgnoreCase(F("NeoPixelAll")))
				  {
					  char Line[80];
					  char TmpStr1[80];
					  TmpStr1[0] = 0;
					  string.toCharArray(Line, 80);
					  for (int i = 0; i < MaxPixels; i++)
					  {
						  Plugin_038_pixels->setPixelColor(i, Plugin_038_pixels->Color(event->Par1, event->Par2, event->Par3));
					  }
					  Plugin_038_pixels->show();
					  success = true;  
          }
          
          if (tmpString.equalsIgnoreCase(F("NeoPixelLine")))
				  {
					  char Line[80];
					  char TmpStr1[80];
					  TmpStr1[0] = 0;
					  string.toCharArray(Line, 80);
  					int Par4 = 0;
	  				int Par5 = 0;
		  			if (GetArgv(Line, TmpStr1, 5)) Par4 = str2int(TmpStr1);
			  		if (GetArgv(Line, TmpStr1, 6)) Par5 = str2int(TmpStr1);
  					for (int i = event->Par1 - 1; i < event->Par2; i++)
	  				{
		  				Plugin_038_pixels->setPixelColor(i, Plugin_038_pixels->Color(event->Par3, Par4, Par5));
			  		}
				  	Plugin_038_pixels->show();
					  success = true;
          }
        }
        break;
      }

  }
  return success;
}
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#5 Post by papperone » 16 Jun 2017, 07:50

Submitted my first PullUp request! Hope I did not mess up anythign as I just installed and use GitHub (Yes I'm a coder/programmer "old-style", not anymore my job so I am outdated with modern tools :P)
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Re: WS2812 single LED/Pixel Plugin

#6 Post by AndrewJ » 16 Jun 2017, 09:04

Hey, fantastic!! :D
Andrew

Martinus

Re: WS2812 single LED/Pixel Plugin

#7 Post by Martinus » 17 Jun 2017, 11:14

papperone wrote: 15 Jun 2017, 23:31 Well I fixed the _P038 plugin and now it seems to work as originally designed! kudos to who wrote it, I simply fix it to make it work with ESPEasy 2.0.0.dev10.

below the full plugin as I've no idea on how to submit it to be included in the next build:

Code: Select all

//#######################################################################################################
//#################################### Plugin 038: NeoPixel Basic #######################################
//#######################################################################################################

// 15-June-2017: Fixed broken plugin; tested with several neopixels (single LED, 8 LED bars and 300 leds strips.

// List of commands:
// (1) NeoPixel,<led nr>,<red 0-255>,<green 0-255>,<blue 0-255>
// (2) NeoPixelAll,<red 0-255>,<green 0-255>,<blue 0-255>
// (3) NeoPixelLine,<start led nr>,<stop led nr>,<red 0-255>,<green 0-255>,<blue 0-255>

// Usage:
// (1): Set RGB Color to specified LED number (eg. NeoPixel,5,255,255,255)
// (2): Set all LED to specified color (eg. NeoPixelAll,255,255,255)
//		If you use 'NeoPixelAll' this will off all LED (like NeoPixelAll,0,0,0)
// (3): Set color LED between <start led nr> and <stop led nr> to specified color (eg. NeoPixelLine,1,6,255,255,255)

#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel *Plugin_038_pixels;

#define PLUGIN_038
#define PLUGIN_ID_038         38
#define PLUGIN_NAME_038       "NeoPixel - Basic"
#define PLUGIN_VALUENAME1_038 ""

int MaxPixels = 0;

boolean Plugin_038(byte function, struct EventStruct *event, String& string)
{
  boolean success = false;

  switch (function)
  {

    case PLUGIN_DEVICE_ADD:
      {
        Device[++deviceCount].Number = PLUGIN_ID_038;
        Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
        Device[deviceCount].VType = SENSOR_TYPE_SINGLE;
        Device[deviceCount].Ports = 0;
        Device[deviceCount].PullUpOption = false;
        Device[deviceCount].InverseLogicOption = false;
        Device[deviceCount].FormulaOption = false;
        Device[deviceCount].ValueCount = 0;
        Device[deviceCount].SendDataOption = true;
        Device[deviceCount].TimerOption = true;
        Device[deviceCount].TimerOptional = true;
        Device[deviceCount].GlobalSyncOption = true;
        break;
      }

    case PLUGIN_GET_DEVICENAME:
      {
        string = F(PLUGIN_NAME_038);
        break;
      }

    case PLUGIN_GET_DEVICEVALUENAMES:
      {
        strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_038));
        break;
      }

    case PLUGIN_WEBFORM_LOAD:
      {
      	addFormNumericBox(string, F("Led Count"), F("plugin_038_leds"), Settings.TaskDevicePluginConfig[event->TaskIndex][0],1,999);
      	success = true;
        break;
      }

    case PLUGIN_WEBFORM_SAVE:
      {
        Settings.TaskDevicePluginConfig[event->TaskIndex][0] = getFormItemInt(F("plugin_038_leds"));
        MaxPixels = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
        success = true;
        break;
      }

    case PLUGIN_INIT:
      {
        if (!Plugin_038_pixels)
        {
          Plugin_038_pixels = new Adafruit_NeoPixel(Settings.TaskDevicePluginConfig[event->TaskIndex][0], Settings.TaskDevicePin1[event->TaskIndex], NEO_GRB + NEO_KHZ800);
          Plugin_038_pixels->begin(); // This initializes the NeoPixel library.
        }
        MaxPixels = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
        success = true;
        break;
      }

    case PLUGIN_WRITE:
      {
        if (Plugin_038_pixels)
        {
          String tmpString  = string;
          int argIndex = tmpString.indexOf(',');
          if (argIndex)
            tmpString = tmpString.substring(0, argIndex);

          if (tmpString.equalsIgnoreCase(F("NeoPixel")))
          {
            char Line[80];
            char TmpStr1[80];
            TmpStr1[0] = 0;
            string.toCharArray(Line, 80);
            int Par4 = 0;
            if (GetArgv(Line, TmpStr1, 5)) Par4 = str2int(TmpStr1);
            Plugin_038_pixels->setPixelColor(event->Par1 - 1, Plugin_038_pixels->Color(event->Par2, event->Par3, Par4));
            Plugin_038_pixels->show(); // This sends the updated pixel color to the hardware.
            success = true;
          }
          
          if (tmpString.equalsIgnoreCase(F("NeoPixelAll")))
				  {
					  char Line[80];
					  char TmpStr1[80];
					  TmpStr1[0] = 0;
					  string.toCharArray(Line, 80);
					  for (int i = 0; i < MaxPixels; i++)
					  {
						  Plugin_038_pixels->setPixelColor(i, Plugin_038_pixels->Color(event->Par1, event->Par2, event->Par3));
					  }
					  Plugin_038_pixels->show();
					  success = true;  
          }
          
          if (tmpString.equalsIgnoreCase(F("NeoPixelLine")))
				  {
					  char Line[80];
					  char TmpStr1[80];
					  TmpStr1[0] = 0;
					  string.toCharArray(Line, 80);
  					int Par4 = 0;
	  				int Par5 = 0;
		  			if (GetArgv(Line, TmpStr1, 5)) Par4 = str2int(TmpStr1);
			  		if (GetArgv(Line, TmpStr1, 6)) Par5 = str2int(TmpStr1);
  					for (int i = event->Par1 - 1; i < event->Par2; i++)
	  				{
		  				Plugin_038_pixels->setPixelColor(i, Plugin_038_pixels->Color(event->Par3, Par4, Par5));
			  		}
				  	Plugin_038_pixels->show();
					  success = true;
          }
        }
        break;
      }

  }
  return success;
}
I think the plugin would only work OOTB if set to task nr 1. So there is a bug with the WRITE call that tries to read a task value and task values are not used in conjunction with the WRITE mechanism.
So thanks for discovering this flaw.

But i'm not sure if removing this line is correct:

Code: Select all

       Device[deviceCount].Custom = true;
It is a custom device and it should tell the framework not to show any irrelevant fields in the webgui...

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#8 Post by papperone » 17 Jun 2017, 18:51

hi Martinus, sorry about that, I'm very new to the ESPEasy architecture and in very early stage of learning; I was not aware of this flag and was not in the other plugin I've been analyzing for learning so I removed it.
Now I understood the meaning of it I'll put it back; as well i've seen other comments on my pull-up which I can't understand, maybe you can help me with:

Code: Select all

Running it like this will make the webgui handler show "send data" settings that are useless in this custom device. Your device settings should remain "custom" Please redo this pull request, only fixing the maxPixels issue:
..for (int i = 0; i < MaxPixels; i++)...
I used MaxPixels temporary variable as "Settings.TaskDevicePluginConfig[event->TaskIndex][0]" for some reason I could not understand was not available in the command "NeoPixelAll" and always equal to "1" intstead of the number entered in the GUI; maybe a bad patch but that's the only way I was able to make it working properly.

Code: Select all

and let the device handle this again:
addFormPinSelect(string, F("GPIO"), F("taskdevicepin1"), Settings.TaskDevicePin1[event->TaskIndex]);
This was not working as well (same problem in LCD and OLED plugin) as the value of the GPIO selected was not saved on clicking SUMBIT but the field reverted to "empty".
Any special reason I coudl not use the standard "1st GPIO" selection as I've done? Wasn't meant to be like this or again I missed something here?
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Martinus

Re: WS2812 single LED/Pixel Plugin

#9 Post by Martinus » 17 Jun 2017, 19:29

Handling the taskdevicepin within the plugin works with the current github release, but there may have been versions that don't work as they have been changing the naming within the webserver.ino.

The PLUGIN_WRITE section within every plugin is to handle generic commands that are fired to the system. The plugin handles commands but they are not in any way related to Tasks. Task settings can be accessed, but they could point to random data as they are not set by the framework upon calling a plugin with a write command. A WRITE request is not actually send to the list of tasks, but to the list of plugins until a plugin confirms true as a return value.

Just have a look on how this is done in code:

Code: Select all

    case PLUGIN_WRITE:
      for (x = 0; x < PLUGIN_MAX; x++)
        if (Plugin_id[x] != 0)
          if (Plugin_ptr[x](Function, event, str))
            return true;

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#10 Post by papperone » 17 Jun 2017, 20:21

ok understood the issue inside the WRITE command, clear!

About the handle of GPIO, I am using current github version which I forked to my github and I can confirm it does not work as GPIO selected is not saved.
This is the same for LED and OLED plugin which uses the same way. Should I open a "bug fix" request?
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Martinus

Re: WS2812 single LED/Pixel Plugin

#11 Post by Martinus » 17 Jun 2017, 21:56

It definitely works here, also with other plugins like the LCD. Unfortunately Edwin has abandoned the build number so it will be a bit more difficult to verify the exact source versions.

Are you running the standard unchanged and unmodified source? I'm using plain straightforward github code (commit 8d2303db5f0ef4cc822524fb2f594d57b38ba83f), compiled with Arduino IDE 1.6.9.
So pull from github, run the compiler, export to binary and upload to ESP. No manual changes, no additional plugins etc.

But even if the plugin(s) would fail, we ought to fix this within the framework instead of crippling plugin code.

Maybe we need to have this confirmed by other users as well and file a bug report that blames the ESP Easy framework as it seems that multiple plugins suffer from the same issue.
I know that the webserver.ino has had a huge amount of changes so there could be bugs in there...

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#12 Post by papperone » 17 Jun 2017, 22:26

Martinus wrote: 17 Jun 2017, 21:56 It definitely works here, also with other plugins like the LCD. Unfortunately Edwin has abandoned the build number so it will be a bit more difficult to verify the exact source versions.

Are you running the standard unchanged and unmodified source? I'm using plain straightforward github code (commit 8d2303db5f0ef4cc822524fb2f594d57b38ba83f), compiled with Arduino IDE 1.6.9.
So pull from github, run the compiler, export to binary and upload to ESP. No manual changes, no additional plugins etc.

But even if the plugin(s) would fail, we ought to fix this within the framework instead of crippling plugin code.

Maybe we need to have this confirmed by other users as well and file a bug report that blames the ESP Easy framework as it seems that multiple plugins suffer from the same issue.
I know that the webserver.ino has had a huge amount of changes so there could be bugs in there...
I have verified and i've latest github code (commit/8d2303db5f0ef4cc822524fb2f594d57b38ba83f so defintely the same as yours!).
Only difference is that I've compiled/tested with Arduino IDE 1.8.2; but bugs must be there as I've read many complaints on LED and OLED issue not saving the GPIO for button failing the same way as I see...
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#13 Post by papperone » 17 Jun 2017, 22:41

just to complete the tests, just flashed my device (WEMOS D1 MINI) with plain precompiled BIN from repository "ESPEasy_v2.0.0-dev10_dev_4096.bin" and same behaviour, on NewPixel, LCD and OLED display the GPIO value is not saved and when hitting submit it goes empty! (and of course plugin does not work as it supposed to be)...
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Martinus

Re: WS2812 single LED/Pixel Plugin

#14 Post by Martinus » 17 Jun 2017, 22:47

I can image the bug reports as the latest release (DEV-10) certainly has a bug in webserver.ino

This was fixed in commit b63e76adfe0fa55c8f96038584cba62746d93dcc on june 10th.
The LCD bug was confirmed as fixed, so i would expect the same for plugins that suffered from the same issue.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#15 Post by papperone » 18 Jun 2017, 15:38

Martinus wrote: 17 Jun 2017, 22:47 I can image the bug reports as the latest release (DEV-10) certainly has a bug in webserver.ino

This was fixed in commit b63e76adfe0fa55c8f96038584cba62746d93dcc on june 10th.
The LCD bug was confirmed as fixed, so i would expect the same for plugins that suffered from the same issue.
Hi Martinus, sorry to bother you more but the commit you talk about is referring to "Fix default controller settings (#360)" which seems to have nothign to do with issue in the WebServer.ino we are mentioning now!
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Martinus

Re: WS2812 single LED/Pixel Plugin

#16 Post by Martinus » 18 Jun 2017, 21:43

When i look at github esp easy it shows me this information on commit b63e76adfe0fa55c8f96038584cba62746d93dcc:
fix348.png
fix348.png (25.25 KiB) Viewed 30742 times
Would be nice to know why your information seems to be different.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#17 Post by papperone » 18 Jun 2017, 22:42

Martinus wrote: 18 Jun 2017, 21:43 When i look at github esp easy it shows me this information on commit b63e76adfe0fa55c8f96038584cba62746d93dcc:
fix348.png
Would be nice to know why your information seems to be different.
SORRY! my mistake, I'm still not familiar with GitHub; by the way I'm not sure why you can compile latest GitHub and have issue fixed while I do the same and issue is still there :(
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

cyberclwn
Normal user
Posts: 21
Joined: 25 Aug 2017, 21:19

Re: WS2812 single LED/Pixel Plugin

#18 Post by cyberclwn » 25 Aug 2017, 21:28

Hello Guys,

Sorry to ressurect an older post...

But i just connect a WS2812B to a wemos d1 mini, and then get stuck.

I downloaded the ESPEasy v2.0.0-dev11 and uploaded the "normal_4096" firmware into the wemos.
Then connect the wires, the 5v to 5v, GND to G, and the Din to D8.
Also added the device "NeoPixel - Basic", changed to LEDcount to 30 and changed GPIO to 15/D8.

And then i get stuck, Now what?

There is no light activated. But how to do it?
i tried http://x.x.x.x/control?cmd=NeoPixel,1,150,180,180
or cmd=NeoPixelall

I searched the wiki, forum and google, but i can't seem to find the next step(s)
Can you help me ?

ps. i'm not certain the ledstrip works, got a cheap chinese one. It should work, but you never know ...

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#19 Post by papperone » 26 Aug 2017, 10:03

cyberclwn wrote: 25 Aug 2017, 21:28 Hello Guys,

Sorry to ressurect an older post...

But i just connect a WS2812B to a wemos d1 mini, and then get stuck.

I downloaded the ESPEasy v2.0.0-dev11 and uploaded the "normal_4096" firmware into the wemos.
Then connect the wires, the 5v to 5v, GND to G, and the Din to D8.
Also added the device "NeoPixel - Basic", changed to LEDcount to 30 and changed GPIO to 15/D8.

And then i get stuck, Now what?

There is no light activated. But how to do it?
i tried http://x.x.x.x/control?cmd=NeoPixel,1,150,180,180
or cmd=NeoPixelall

I searched the wiki, forum and google, but i can't seem to find the next step(s)
Can you help me ?

ps. i'm not certain the ledstrip works, got a cheap chinese one. It should work, but you never know ...

can you try in the tools/command box type directly the command "NeoPixelAll,255,255,255"?
just checked my test-unit again and it works ok
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

cyberclwn
Normal user
Posts: 21
Joined: 25 Aug 2017, 21:19

Re: WS2812 single LED/Pixel Plugin

#20 Post by cyberclwn » 26 Aug 2017, 23:53

papperone wrote: 26 Aug 2017, 10:03 can you try in the tools/command box type directly the command "NeoPixelAll,255,255,255"?
just checked my test-unit again and it works ok
I just tried, nothing happens.
Starting to think i really got a broken led-strip.
Don't think it should be too hard to get this working.
(I got relays,DHTs and a LCD working)

Probably it's best to give up on this ledstrip and look for another.
Thanks for the help.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#21 Post by papperone » 27 Aug 2017, 09:56

cyberclwn wrote: 26 Aug 2017, 23:53
papperone wrote: 26 Aug 2017, 10:03 can you try in the tools/command box type directly the command "NeoPixelAll,255,255,255"?
just checked my test-unit again and it works ok
I just tried, nothing happens.
Starting to think i really got a broken led-strip.
Don't think it should be too hard to get this working.
(I got relays,DHTs and a LCD working)

Probably it's best to give up on this ledstrip and look for another.
Thanks for the help.
can it be a power issue? a long strip can require a lot of juice (amps) and esp8266 maybe cannot handle, try to setup only 10 LEDs lenght and see if this help?
(you can even try to cut few LEDs form the strip, ensure GPIO is connected to DIN of the strip and that strip is powered with stable 5V supply)
in order to power LEDs strips (specially long ones) it's very advisable to use an external power supply, not directly fromthe ESP!
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: WS2812 single LED/Pixel Plugin

#22 Post by Shardan » 27 Aug 2017, 14:16

There might be another issue.

Following the datasheet the WS2812B LEDs have a "High" level of 0.7Vdd.
If you run the LEDs on 5V this says the minimum high level at data input is 3,5V.

Using an ESP with 3,3V this might work or not due to tolerances of ESP and LED chips.
It is anyways below limits.

It's worth a try with a level shifter.

Regards
Shardan
Regards
Shardan

cyberclwn
Normal user
Posts: 21
Joined: 25 Aug 2017, 21:19

Re: WS2812 single LED/Pixel Plugin

#23 Post by cyberclwn » 27 Aug 2017, 18:06

Thanks for the idea's and thinking along/

I'll look into this soon and let you know my findings

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#24 Post by papperone » 28 Aug 2017, 08:50

Shardan wrote: 27 Aug 2017, 14:16 There might be another issue.

Following the datasheet the WS2812B LEDs have a "High" level of 0.7Vdd.
If you run the LEDs on 5V this says the minimum high level at data input is 3,5V.

Using an ESP with 3,3V this might work or not due to tolerances of ESP and LED chips.
It is anyways below limits.

It's worth a try with a level shifter.

Regards
Shardan
I think this is only theory, or all the WS2812 leds I do have are lucky ones as they are all perfectly driven by digital pin of ESP8266! (and they are literally hundreds either single, 8x bars, circle or 300 pixel strips...) :D
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: WS2812 single LED/Pixel Plugin

#25 Post by Shardan » 28 Aug 2017, 18:13

Hello papperone,

It depends only on the very first LED in chain as all other LEDs are driven by the output of the prior LED.
So it does not matter if you use 3 LED's or 300.

Nice if it works for you. But anyways it is out of specifications, at least with LEDs from that manufacturer i got the datasheet from.
Might work, might lead to undefined behaviour either.

Regards
Shardan
Regards
Shardan

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#26 Post by papperone » 29 Aug 2017, 15:56

Shardan wrote: 28 Aug 2017, 18:13 Hello papperone,

It depends only on the very first LED in chain as all other LEDs are driven by the output of the prior LED.
So it does not matter if you use 3 LED's or 300.

Nice if it works for you. But anyways it is out of specifications, at least with LEDs from that manufacturer i got the datasheet from.
Might work, might lead to undefined behaviour either.

Regards
Shardan
Hi Shardan
Indeed I know datasheet, but on the many application I've used WS2812b leds I've never used a level shifter and all of them are working just fine.
I started since a while to use only single WS2812b as indicators as it does not matter how many I needs, I will allocate only 1 pin!
Maybe clone chips are more tolerant, but really I do have many purchased in different form factors and lenght and all wokring without any issue, not even on the first led...
I will control them more carefully from now on to spot if any issue which I maybe did not see until now.

papperone
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

cyberclwn
Normal user
Posts: 21
Joined: 25 Aug 2017, 21:19

Re: WS2812 single LED/Pixel Plugin

#27 Post by cyberclwn » 29 Aug 2017, 19:17

papperone wrote: 27 Aug 2017, 09:56
cyberclwn wrote: 26 Aug 2017, 23:53
papperone wrote: 26 Aug 2017, 10:03 can you try in the tools/command box type directly the command "NeoPixelAll,255,255,255"?
just checked my test-unit again and it works ok
Thanks for the help.
can it be a power issue? a long strip can require a lot of juice (amps) and esp8266 maybe cannot handle, try to setup only 10 LEDs lenght and see if this help?
(you can even try to cut few LEDs form the strip, ensure GPIO is connected to DIN of the strip and that strip is powered with stable 5V supply)
in order to power LEDs strips (specially long ones) it's very advisable to use an external power supply, not directly fromthe ESP!
I cut the strip down to 3 LEDs, no change.

If i do a "http://x.x.x.x/control?cmd=NeoPixelall,255,255,255" should i get a JSON-response back ?
Like when you do a "http://x.x.x.x/control?cmd=GPIO,13,1"?

Because i get nothing from the neopixel command.

Also i tried supply the 5v from an external source, and only connect the G and the DIN pin to the wemos. Same result, nothing.
I'm just unlucky, i guess :)

lukecorkill
New user
Posts: 1
Joined: 09 Sep 2017, 13:06

Re: WS2812 single LED/Pixel Plugin - MQTT format

#28 Post by lukecorkill » 09 Sep 2017, 13:13

I found this thread whilst trying to work out how to control a neopixel LED strip via MQTT.

In case anyone else is looking in the same place, the command format is shown below (taken from the source code, shown as an mosquitto command line example). My ESPeasy is identified as ESPEasytest in MQTT. 6 is the LED number and 40/20/10 are the RGB values.

Code: Select all

mosquitto_pub -h 192.168.1.1 -t "ESPEasytest/cmd" -m "NeoPixel,6,40,20,10"
See either the source for plugin 38, or extract at; viewtopic.php?p=16818#p16818

Code: Select all

// List of commands:
// (1) NeoPixel,<led nr>,<red 0-255>,<green 0-255>,<blue 0-255>
// (2) NeoPixelAll,<red 0-255>,<green 0-255>,<blue 0-255>
// (3) NeoPixelLine,<start led nr>,<stop led nr>,<red 0-255>,<green 0-255>,<blue 0-255>
Hope this helps someone else
Luke.

dumbme
New user
Posts: 8
Joined: 20 Jun 2017, 12:45

Re: WS2812 single LED/Pixel Plugin

#29 Post by dumbme » 21 Sep 2017, 23:11

Tested it aswell The Neopixel Candle is working but NeopixelBasic it will not work with anycommands

esp 2.0 dev11

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: WS2812 single LED/Pixel Plugin

#30 Post by papperone » 22 Sep 2017, 13:08

Just upgraded my test modules with 2.0.0.dev12 / normal-4096 and I can confirm the Neo Pixel Basic plugin still works as it should...
It responds to all commands "neopixelall", "neopixel" and "neopixelline"
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

Igrek
New user
Posts: 3
Joined: 24 Sep 2017, 21:37

Re: WS2812 single LED/Pixel Plugin

#31 Post by Igrek » 24 Sep 2017, 22:00

With modules with 2.0.0.dev12 / normal-4096 and I can confirm. It work. But the plugin does not return anything and therefore in the error log: "Error: Error opening url: http://192.168.1.33/control?cmd=neopixelall,0,0,5".

mrcage
New user
Posts: 4
Joined: 03 Nov 2017, 23:21

Re: WS2812 single LED/Pixel Plugin

#32 Post by mrcage » 04 Nov 2017, 20:56

It took me a while to control the ws2812b by ESP Easy but I managed to do it by this helpfull thread :D
I want to use it in openhab, not sure how to control it:
Color LedStrip_color "LedStrip Color [%s]" <slider> (tuin, LedStrip) {mqtt=">[broker:/IoTCage107/cmd/NeoPixelAll:command:*:default]"}

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests