Rfid crystal removal detection

Hi, first time poster looking for some assistance.

I have presets selection working via RFID values from different crystals. It currently works to switch between the specified presets when a crystal RFID tag is read but I would like it to switch to a missing crystal preset, similar to removing a blade using blade detect, when no RFID tag is detected. I’m assuming it is constantly searching for RFID, as it quickly changes once a different crystal is placed near the antenna.
The behavior I would like to change is when the crystal is removed, the preset persists. I would like it to act/sound broken when the ignite button is pressed but no crystal is detected. And perhaps a sound plays as soon as it no longer detects a crystal. Pretty much the same idea as the many examples i have seen for blade detect.

Any ideas how I might go about this?

Currently, it will load a default preset on bootup as well as allow preset switching via button presses without using Crystals at all. I think i will have to disable this.

Proffie OS 7.14
Proffieboard v2.2
RF125-ps RFID reader

The rf125-ps doesn’t say or do anything when the crystal is removed, so it’s not possible to implement based on the output from that only. You would need an extra signal, then you could use blade detect, or a different rfid reader to make it work.

I have something similar set up for an arduino board as well as an esp32c3 where I believe it keeps checking for a tag Id at the serial connection and if no RFID is detected within a time frame it sets an RGB LED to off, otherwise it sets the colour as defined for the specific RFID value. I can’t make much sense of this part of the code but I could share it if you’d like to see it. The reader board doesn’t need to do anything other than send the hex information to the serial input as, in this case, it is the main board’s programming that is doing the checking for the tag Id every so often. Or at least that is how I understand it. I am hoping to bring this feature over to my proffieboards.

Updated to share link to original project/code for arduino board
link to code: kyber_colors.ino - Google Drive
video: https://www.youtube.com/watch?v=wD9zHP9LdAc

That’s cool. It seems to be based on an RDM6300 rfid reader, which apparently keeps sending data for each rfid check. The RF125-PS does not do that. Unfortunately the RDM6300 is quite a bit bigger than the RF125-PS. (20x12mm vs 38.5x19mm)

OK, that’s too bad. I definitely can’t fit the RDM6300 into my saber. It looks like I will have to go the detect pin/switch route. Thanks!

1 Like

I think I’d like to use the blade detection feature for crystal detection using a switch the crystal will be held against to short a blade detect pin on the proffieboard (Tx) to gnd.

I believe this would be no different than the blade detect pin being shorted to the blade negative on a shtok nxpl pcb but I’m not 100% sure since the blade negative isn’t really gnd. Do I need to do any pull up or pull down resistors for this to work?

To my knowledge you won’t need any resistors added to the circuit for this to work. Check out this video I made to show off my saberkraft flame hilt.

About 20 seconds in I toggle a latching switch in the control box to trigger blade detect which in essence seems like what you want to do with your crystal. Wiring it up was super simple,
Switch common to Free 1
Left or right leg to GND

The hardest part for me was to figure out how the config file needed to be setup.

For you I believe it’ll be the same thing except with the switch common going to TX since you’re using proffie v2.2. Have you considered using a type of magnetic setup similar to what I’ve seen in the goth 3designs graflex grand master chassis?

2 Likes

I’m not too familiar with how the goth grand master chassis work but i am planning this hilt to be compatibility with the disney RFID-equipped kyber crystals so i can’t have a tightly fitting crystal holder like the goth chassis.

My design is much like the Disney Savis workshop lightsaber chassis, only I am using a momentary switch with a spring behind it to compress it against the crystal to signal that a crystal is present (circuit closed) and when unpressed (circuit open) to signal when the crystal is removed. It also doubles as a method to hold the crystals in place.

Essentially I want it to behave the same way as the blade detect feature. No ignition and glitchy sounds when no crystal is present and standard behaviour when present. Except at this point it will select the blade style based on a RFID tag in the crystal.

This is what @NoSloppy told me yesterday:

But I don’t know if it is possible to have more than one blade detect:

  • one for the main blade
    and
  • one for a crystal or other blade(s)

Can more than one BD be coded in the config ? Or would the second one need to be coded “something else” ?

Yes you can do multiple blade detects but it requires adding some code to write sequentially incremented blade detects. There’s some posts by @shadowfoil regarding it somewhere here on this forum.

1 Like

Found this thread:

multiple blades use blade detect:

Add this to events.h

BUTTON_BLADE_DETECT = 256,
BUTTON_BLADE_DETECT2 = 2048,
BUTTON_BLADE_DETECT3 = 4096,

Add this to your config header


#define BLADE_DETECT_PIN 8
#define BLADE_DETECT_PIN2 9
#define BLADE_DETECT_PIN3 22

Add this to your props file

#ifdef BLADE_DETECT_PIN
  case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_ON):
  case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_OFF):
    // Might need to do something cleaner, but let's try this for now.
    blade_detected_ = true;
    FindBladeAgain();
    SaberBase::DoBladeDetect(true);
    return true;

  case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_ON):
  case EVENTID(BUTTON_BLADE_DETECT, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_OFF):
    // Might need to do something cleaner, but let's try this for now.
    blade_detected_ = false;
    FindBladeAgain();
    SaberBase::DoBladeDetect(false);
    return true;
#endif

#ifdef BLADE_DETECT_PIN2
  case EVENTID(BUTTON_BLADE_DETECT2, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_ON):
  case EVENTID(BUTTON_BLADE_DETECT2, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_OFF):
    // Might need to do something cleaner, but let's try this for now.
    blade2_detected_ = true;
    FindBladeAgain();
    SaberBase::DoBladeDetect(true);
    return true;

  case EVENTID(BUTTON_BLADE_DETECT2, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_ON):
  case EVENTID(BUTTON_BLADE_DETECT2, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_OFF):
    // Might need to do something cleaner, but let's try this for now.
    blade2_detected_ = false;
    FindBladeAgain();
    SaberBase::DoBladeDetect(false);
    return true;
#endif

#ifdef BLADE_DETECT_PIN3
  case EVENTID(BUTTON_BLADE_DETECT3, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_ON):
  case EVENTID(BUTTON_BLADE_DETECT3, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_OFF):
    // Might need to do something cleaner, but let's try this for now.
    blade3_detected_ = true;
    FindBladeAgain();
    SaberBase::DoBladeDetect(true);
    return true;

  case EVENTID(BUTTON_BLADE_DETECT3, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_ON):
  case EVENTID(BUTTON_BLADE_DETECT3, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_OFF):
    // Might need to do something cleaner, but let's try this for now.
    blade3_detected_ = false;
    FindBladeAgain();
    SaberBase::DoBladeDetect(false);
    return true;
#endif

private:
#ifdef BLADE_DETECT_PIN2
  bool blade2_detected_ = false;
#endif

#ifdef BLADE_DETECT_PIN3
  bool blade3_detected_ = false;
#endif

Add this to ProffieOS.ino

#ifdef BLADE_DETECT_PIN
LatchingButtonTemplate<FloatingButtonBase<BLADE_DETECT_PIN>>
  BladeDetect(BUTTON_BLADE_DETECT, BLADE_DETECT_PIN, "blade_detect");
#endif

#ifdef BLADE_DETECT_PIN2
LatchingButtonTemplate<FloatingButtonBase<BLADE_DETECT_PIN2>>
  BladeDetect2(BUTTON_BLADE_DETECT2, BLADE_DETECT_PIN2, "blade_detect");
#endif

#ifdef BLADE_DETECT_PIN3
LatchingButtonTemplate<FloatingButtonBase<BLADE_DETECT_PIN3>>
  BladeDetect3(BUTTON_BLADE_DETECT3, BLADE_DETECT_PIN3, "blade_detect");
#endif
1 Like

This is very helpful, I had been wondering if more than one blade detect was possible and I ruled it out until I saw this so thank you for sharing this.

One thing I’m curious about is in the section for the config header, you said
#define BLADE_DETECT_PIN3 22

I see that this pin is for LED3, shouldn’t we use pins 7,8 and 9 for the 3 free pads?
So that it would be more like this

#define BLADE_DETECT_PIN 7
#define BLADE_DETECT_PIN2 8
#define BLADE_DETECT_PIN3 9

Please correct me if I’m wrong. I find there is always something new to learn with proffie

Sorry @starwalker ,

I do not want to hijack your thread but IMHO this could be helpful to you too.

@NoSloppy :

  • Is #define BLADE_DETECT_PIN 8 the same as #define BLADE_DETECT_PIN blade5Pin ?

  • current ProffieOS.ino has an extra line in the #ifdef BLADE_DETECT_PIN:

#ifdef BLADE_DETECT_PIN
LatchingButtonTemplate<FloatingButtonBase<BLADE_DETECT_PIN>>
  BladeDetect(BUTTON_BLADE_DETECT, BLADE_DETECT_PIN, "blade_detect");

USE_PIN_OUTPUT(BLADE_DETECT_PIN, PO_SubSystems::PO_BLADE_DETECT);
#endif

How to update USE_PIN_OUTPUT line to BladeDetect2 & 3 ?

Thank you,

FYI, I am working on a little helper function to reduce repetition in the case switch but since I used a bit of AI (not for the code but for coming up with pretty names, it is good at that bit :rofl:), I will test it first before posting it.

Edit: these are the names of the function and varibles I think of using:
“UpdateBladeInserted (int blade_detect_index, bool blade_inserted) { // blade_detect_index = 1, 2 or 3”