Keep Inline neopixel always on while blade of

I have just built a saber that uses an extra neopixel to light the crystal chamber. I believe it is just recognized as the first LED in the LED. i would like to have it always be lit up even if the blade is not on for aesthetic purposes. Help with the configs would be great. for reference, I’m using proffie 3.9
image

You’ll probably want to set it up as a sub blade, then use another style for the crystal chamber.

I’ll show how you can do this using ProffieConfig, since it makes it easier to see what’s happening (and I’d recommend using it if you’re not comfortable with code), but I’ll post the exported config file snippets too.

Let’s say your blade has 132 pixels, plus the 16 in a shtok NPXL connector, as well as that 1 accent led for the crystal chamber (I assume it’s a single pixel, if there’s more than one you can set it accordingly.

So 132(Blade)+16(Connector)+1(CrystalChamber)=149 (Total), as an example.

This would actually be beyond the default limit, so we’d need to change that in the General Page:

Which would be like doing the following in the config:

#ifdef CONFIG_TOP
/* Other setup */
const unsigned int maxLedsPerStrip = 149;
/* Other setup */
#endif

Then we can set our Number of Pixels to 149, and add two sub blades. Set the data pin accordingly, (I’m assuming just the default Data1, bladePin. Set the used power pins (I assume LED2 and 3), then you can layout the sub blades however you like.

Let’s say you want your actual lightsaber blade to be first in the list (This will only determine the order for your blade styles in the presets, it doesn’t matter too much).

For SubBlade 0, we can set it to start after the crystal chamber and NPXL, which would be 1+16=17. Since the numbers start from 0, even though the 17th Pixel would be the very last pixel on the connector, we’re actually talking about the 18th pixel. (if you count from 0 to 17 you’ll be counting 18 times…)

And then set the end to 17(start)+132(length)-1=148 (Notice how when we calculate the end we must subtract by 1).

All that would look like this:

Or in the config the start of the bladeconfig would take shape like this:

BladeConfig blades[] = {
	{ 0,
		SubBlade( 16, 148, WS281XBladePtr<149, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>()),

Then you’d just need to set the SubBlade Start and End for the other two. If we wanted the NPXL connector to be next, then it would start after the crystal chamber, so 1(# of Crystal Chamber LEDs), and we’d end at 1(start)+16(length)-1 = 16. (I won’t show a screenshot for this since it takes up precious space on fredrik’s server, if you have the app open it’ll be pretty clear how to do this)

Finally, for the Crystal Chamber Pixel, it’s going to be very first in the line, so it starts at 0! Then our end calculation looks like 0(start)+1(length)-1=0. Notice how they’re the same! That’s not a mistake. Since it’s only one pixel, it starts and ends at the same pixel.

At this point if you’re doing it by hand the config code would look like:

BladeConfig blades[] = {
	{ 0,
		SubBlade( 17, 148, WS281XBladePtr<149, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>()),
		SubBlade( 1, 16, NULL),
		SubBlade( 0, 0, NULL),
		CONFIGARRAY(blade_in), "blade_in"
	}
};

(Note if you’re doing it by hand you’ll need to match the names of your preset array and such)

Then in order to make it stay on when the blade is off, you’d just need to setup the separate bladestyles for each preset on the Presets And Styles page:

ProffieConfig puts a default style that looks like:
StyleNormalPtr<AudioFlicker<Blue,DodgerBlue>,BLUE,300,800>()
But you can change that to anything you want for the main blade.

You could put an identical style for the neopixel connector, or something different if you wanted (That’d be on Blade 0:1, read as Blade 0, SubBlade 1, which corresponds to what we did on the Blades page)

Then, for the crystal chamber (Blade 0:2 here) you could perhaps do something like:
StylePtr<AudioFlicker<Blue,DodgerBlue>>()
Which would just always flicker blue.

Of course, you can make/find/edit your own styles to do whatever you want now that you have the blades separated and the freedom to do anything with each of them independently :slight_smile:

One thing to be aware of is that keeping that one pixel on will provide power to the blade as well. Neopixels aren’t fantastic about not drawing any power when off (black), so each pixel will draw some fraction of a milliamp while powered. (If neopixels were great at not drawing power when black, then we wouldn’t even need FETs to turn them off.)

That one pixel that’s on might draw 10-30mA depending on color, but the rest of the pixels might draw 100-200mA, even though they are “off”, resulting in fairly poor standby time. (less than a day)

You can use the IDLE_OFF_TIME define to work around this, or simply employ a kill switch.

1 Like

That’s an excellent point to be aware of. This setup is indeed less than ideal for the intended use-case (keeping the crystal chamber on) and battery life. Ideally the crystal chamber would probably be wired to be powered separately (which would also require it having a separate data line), though this may not be possible with the given room.

Given the setup and to that end: IDLE_OFF_TIME is set in ProffieConfig on the General Page as “Idle Timeout.” (Nothing stopping you from putting it into ProffieConfig as a define in “Custom Options…”, but it’ll simply be put back into the Idle Timeout box This doesn’t actually seem to be the case, I might look at that.)