I bought a ShtokCustomWorx NeoCree adapter and have been playing with some bladestyles for it, but I’m getting really weird behaviour… as soon as the adapter touches the pins, I get these ‘ghost gestures/actions’ where the saber will ignite, retract, play music all on its own.
I’ve tested this on both OS5.9 and OS6.4 with Fett263 prop and get the same behaviour. I’ve even stripped down my config to remove any gestures, and I tried turning the sensitivity up to 10.0.
First of all, we should take a look at what the serial monitor says.
Second, this sort of behavior reminds me of something that used to happen with tri-cree setups sometimes: We would get ghost button presses. These ghost button presses would be really really fast, like less than a microsecond fast… My theory is that these ghost button presses were caused by induction or capacitance between wires, which injects small current spikes into nearby cables, possibly causing this effect. However, the math for that didn’t seem to work out well, unless something is also overcoming or disabling the pullup resistor that holds the button signals high normally, so I’m not entirely sure if that is what is happening or not.
It sort of makes sense that this would happen to tri-cree but not neopixels though, because tri-cree pulls all of it’s power on/off synchronously, while neopixels have hundreds of little on/off circuits that are all working asynchronously.
Ok, fixes, things to try, etc:
check out the serial monitor
You could try fiddling with the button debounce value[1] to see if that helps
You could try to shield or separate the button wires from the power wires.
You could add a stronger pullup resistor, something like a 2.2k resistor between 3.3V and whatever button pad has the problem. (The builtin pullups are about 45k or so.)
Try debounce values from 20 to 50 ms maybe? (Default is 10)
One more thing to potentially try: If you have a free data pad on the board, move the button to there, update the config and see if that works any better.
Tried increasing debounce to 50 and still has the issue.
Tested on another hilt (converted MR Anakin ROTS with one button) and it was fine. Though, interestingly, I get a hum on the speaker with that one. To make this relevant info, the board sits at the back of the chassis, with the speaker in the middle, then the battery, then the pixel connector.
I tried changing to 1 button on the first hilt and issue is still present. I feel like this all points to your original hypothesis being the right direction.
So I looked at the serial monitor output, but it’s not entirely clear to me, so I’m going to ask:
Is it just the power button that you see these ghost events on, or is it other things too?
As far as I can tell, just POW. IT seems like ignitions, retraction, and music playing. When I tried one button, it also did stuff like activate presets etc.
I went and copied out just the press/release events from the serial monitor, and I add a delta value at the end which states how long it’s been since the last event. Many of these events are very short, but not single-millisecond kind of short. (Which should be impossible due to debouncing.) I also noticed something weird: There are two “released” events in a row (millis = 21322 and 21638) no idea how that is even possible. That may mean that there is something really weird going on, or that I’m missing something.
Power-Released 21286
Power-Pressed 21302 16
Power-Released 21322 20
Power-Released ON 21638 316
Power-Pressed ON 21649 11
Aux-Pressed mods Power ON 29061 7412
Aux-Released mods PowerAux ON 29214 153
Aux-Pressed ON 30083 869
Aux-Released ON 30243 160
Aux-Pressed ON 31433 1190
Aux-Released ON 31582 149
Power-Released ON 39720 8138
Power-Pressed ON 39738 18
Make sure your buttons are well isolated from the hilt body. You can check the isolation by a multimeter in continuity test mode between hilt metal body and sound board buttons pads, including GND pad.
That’s actually a big risk of electrical short between switches and hilt body in those kind of custom made metal switches, you can’t be sure until you check it yourself…
Well, we use metal core star pcbs for the Cree leds with a direct thermal path from the led chip to the heat sink (the module body) for best possible heat dissipation from the leds (TCSS sells same type of Cree led stars), and the module metal body touches the saber hilt metal body when inserted, so when something isn’t well isolated, it can cause issues.