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.
Here is a video of the issue happening.
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 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.)
Thanks, I’ll have to have a play with your suggestions. what would you suggest as a starting point for the button debounce?
I need to note that I have tried it in two different hilts, with the same issues.I have another couple I can test.
I need to sit down with it and serial monitor to get some read outs. It’s hard spending much time with kids asleep!
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.
Btw, do you get ghost actions even when the blade is off? Or just when the blade is on?
Yes, as it turns itself off then on.
Another thing to note in the video is that not all the sounds play. The hum, for example.
Monitor output with the same setup
Another thing to add, one of my hilts used to have a cree setup in and didn’t have issues. Same hilt with this unit causes problems.
That is weird. Wonder why then?
Seems like the sort of thing we might need an oscilloscope to figure out.
Right, more testing…
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-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.
Is the body of the neocree connected to something?
Ok, practically speaking, what does that mean? Using tape to isolate, or just making sure joints aren’t touching the body? Or any of the above?
How do you mean? Internally?
Isolate the buttons legs where you solder the wires with a tape, so they didn’t make electrical contact with the metal saber hilt body.
Yeah cool, will try that. Though I’m pretty sure my original hilt is well isolated, it uses one of the SOROC dual tactile cradles.
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.