# True Charge Detection for Use with Custom Presets w/ or w/out Blade ID!

**URL:** <https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587>\
**Category:** Hacks\
**Tags:** idea, coding, helpful\
**Created:** [March 31, 2025, 5:26pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587 "2025-03-31T17:26:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedimaster](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/jedimaster/32/7074_2.png) [@jedimaster](https://crucible.hubbe.net/u/jedimaster)\
**Post date:** [March 31, 2025, 5:26pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/1 "2025-03-31T17:26:06Z")

</div>

After not finding anything that really did what I needed, I’ve done some work on charge detection and wanted to share - hoping it will be considered for a future version of the OS.

’ve added a **CHARGE\_DETECT\_PIN** feature to ProffieOS that acts like a virtual button, similar to **BLADE\_DETECT\_PIN** , to detect when a saber is actively charging. It works with modules like the TP4056 or any other Li-Ion charger that provides a logic-level output when charging.

You can also use the built-in charger detection on Proffieboards or better (safer and better chargin) a pin that goes low when charging on an external charge module. This would be connected to any free pin and defined in your config file.

**In `my_config.h`:**

```auto
#define CHARGE_DETECT_PIN CHARGER_MONITOR // pin 20 is CHARGER_MONITOR

```

Just add that or your actual charge detect pin from the external source once this logic updates I provide below are in place.

* * *

### Key Benefits:

- Lets users define a pin to trigger CHARGE\_MODE.
- Automatically switches to a dedicated preset bank when charging.
- Integrates cleanly alongside existing blade detection logic including blade ID — still functions.

* * *

### Example Presets and Blade Config

**Preset definition:**

```auto
Preset charge_detect_presets[] = {
  { "ChargeFont;common", "",
    StylePtr<Black>(), // Main blade off
    StylePtr<Layers<
      Mix<
        SmoothStep<Scale<BatteryLevel, Int<0>, Int<32768>>, Int<1>>,
        Mix<BatteryLevel, Red, Green>,
        Black
      >
    >>(), // Pixel switch or secondary blade
    "Charging"
  }
};

```

**Blade config entry:**

```auto
{ CHARGE_MODE, 
  WS281XBladePtr<16, blade3Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>(), 
  WS281XBladePtr<6, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin4>>(), 
  CONFIGARRAY(charge_detect_presets), "charge_save"
},

```

Since CHARGE\_MODE is defined as 2000000000, it always ranks higher than NO\_BLADE or any blade ID.

* * *

### Code Changes (by file and location)

**ProffieOS.ino – In Warmup() block (above BladeDetect.Warmup):**

```auto
#ifdef CHARGE_DETECT_PIN
  ChargeDetect.Warmup();
#endif

```

**ProffieOS.ino – Register virtual button (below BladeDetect):**

```auto
#ifdef CHARGE_DETECT_PIN
LatchingButtonTemplate<FloatingButtonBase<CHARGE_DETECT_PIN>>
    ChargeDetect(BUTTON_CHARGE_DETECT, CHARGE_DETECT_PIN, "charge_detect");
#endif

```

* * *

**events.h – Below BUTTON\_BLADE\_DETECT:**

```auto
BUTTON_CHARGE_DETECT = 2048,

```

**events.h – Below NO\_BLADE:**

```auto
#define CHARGE_MODE 2000000000 /* 2 billion */

```

* * *

**prop\_base.h – Near blade\_detected\_ flag:**

```auto
#ifdef CHARGE_DETECT_PIN
  bool charge_detected_ = false;
#endif

```

**prop\_base.h – Inside id() before blade\_detected\_ section:**

```auto
#ifdef CHARGE_DETECT_PIN
STDOUT << "CHARGE PIN READ: " << digitalRead(CHARGE_DETECT_PIN) << "\n";
  if (charge_detected_) {
    STDOUT << "CHARGING\n";
    ret += CHARGE_MODE;
  } else
#endif

```

* * *

**saber\_fett263\_buttons.h – Before BLADE\_DETECT\_PIN section:**

```auto
#ifdef CHARGE_DETECT_PIN
  case EVENTID(BUTTON_CHARGE_DETECT, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_ON):
  case EVENTID(BUTTON_CHARGE_DETECT, EVENT_LATCH_ON, MODE_ANY_BUTTON | MODE_OFF):
    charge_detected_ = true;
    FindBladeAgain();
    SaberBase::DoBladeDetect(true);
    return true;

  case EVENTID(BUTTON_CHARGE_DETECT, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_ON):
  case EVENTID(BUTTON_CHARGE_DETECT, EVENT_LATCH_OFF, MODE_ANY_BUTTON | MODE_OFF):
    charge_detected_ = false;
    FindBladeAgain();
    SaberBase::DoBladeDetect(true);
    return true;
#endif

```

* * *

I’ve tested this on a Proffie v3.9 using a TP4056 module. Works smoothly with no conflicts. Screenshots of the changes are attached for reference.

If you have any questions or need more information, please let me know. I’m looking into making this a patch and will be doing the same for OS8 assuming it doesn’t make the cut yet.

Thanks!

---

<div class="post-metadata">

**Author:** ![profezzorn](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/profezzorn/32/8_2.png) [@profezzorn](https://crucible.hubbe.net/u/profezzorn)\
**Post date:** [March 31, 2025, 5:32pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/2 "2025-03-31T17:32:54Z")

</div>

Interesting.

> [@jedimaster](#):
>
> ```auto
> #define CHARGE_MODE 2000000000 /* 2 billion */
> 
> ```

Some hilts already use 2b as a chassis-has-been-removed-from-hilt mode.  
Maybe make this 900m instead.

---

<div class="post-metadata">

**Author:** ![jedimaster](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/jedimaster/32/7074_2.png) [@jedimaster](https://crucible.hubbe.net/u/jedimaster)\
**Post date:** [March 31, 2025, 5:33pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/3 "2025-03-31T17:33:23Z")

</div>

Good to know! Thank you.

---

<div class="post-metadata">

**Author:** ![jedimaster](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/jedimaster/32/7074_2.png) [@jedimaster](https://crucible.hubbe.net/u/jedimaster)\
**Post date:** [April 2, 2025, 3:58am UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/4 "2025-04-02T03:58:43Z")

</div>

Just a quick follow-up and correction to my original post:

While the Proffieboard V3 does support USB charging at a low current (~450mA), the VBUS line (pin 20) can’t be read in firmware — it’s not connected to a GPIO. That means it can’t be used directly for charge detection as I had suggested.

The most reliable approach is still what I’ve implemented: using a separate charge module with its own dedicated charge detect line wired to a GPIO. I have my charge detect line wired to **pin 7** , defined like this:

```auto
#define CHARGE_DETECT_PIN 7

```

I also implemented profezzorn’s recommendation for the value for CHARGE\_MODE in the events.h file:

```auto
#define CHARGE_MODE 900000000 /* 900 Million */

```

---

<div class="post-metadata">

**Author:** ![dg4prez](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/dg4prez/32/2868_2.png) [@dg4prez](https://crucible.hubbe.net/u/dg4prez)\
**Post date:** [April 5, 2025, 1:02pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/5 "2025-04-05T13:02:34Z")

</div>

Is there more info on this removal mode? That sounds super interesting.

---

<div class="post-metadata">

**Author:** ![profezzorn](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/profezzorn/32/8_2.png) [@profezzorn](https://crucible.hubbe.net/u/profezzorn)\
**Post date:** [April 5, 2025, 9:25pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/6 "2025-04-05T21:25:51Z")

</div>

There should be some threads around here about it, but it might require some spelunking, because the first two searches I tried did not find it.

---

<div class="post-metadata">

**Author:** ![dg4prez](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/dg4prez/32/2868_2.png) [@dg4prez](https://crucible.hubbe.net/u/dg4prez)\
**Post date:** [April 12, 2025, 11:04pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/7 "2025-04-12T23:04:56Z")

</div>

Same. Couldn’t find it yet.

---

<div class="post-metadata">

**Author:** ![awhite89](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/awhite89/32/4466_2.png) [@awhite89](https://crucible.hubbe.net/u/awhite89)\
**Post date:** [June 2, 2025, 7:28pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/8 "2025-06-02T19:28:52Z")

</div>

This topic got my brain going and I think I’ve come up with another solution to trigger charging detection. Same benefits as before but with a smaller (6mm square) add on board, I’ll include links below for the parts needed. There will still need to be the usual stuff added in the config for Blade ID to work of course

##Key Benefits:

- Lets users define a pin to trigger CHARGE\_MODE.
- Automatically switches to a dedicated preset bank when charging.
- Integrates cleanly alongside existing blade detection logic including blade ID — still functions.

###How it works  
Once the USB port is connected it’ll activate the mosfet and deliver the negative voltage to the Free 1 pad and activate the change of presets.

####Wiring

The wiring would be fairly simple on this  
USB + goes to mosfet Gate (1) and Proffie V3 VUSB pad  
USB - goes to mosfet Source (2) and Proffie V3 GND pad  
USB D+ goes to Proffie V3 D+ pad  
USB D- goes to Proffie V3 D- pad  
Mosfet Drain (3) goes to Proffie V3 Free 1 pad

#####Part links

Profezzorn oshpark link  
[https://oshpark.com/profiles/hubbe](https://oshpark.com/profiles/hubbe)

N- Channel mosfet  
[https://www.mouser.com/ProductDetail/Vishay-Siliconix/SI2302CDS-T1-BE3?qs=CiayqK2gdcKmknxSqRbb7w%3D%3D](https://www.mouser.com/ProductDetail/Vishay-Siliconix/SI2302CDS-T1-BE3?qs=CiayqK2gdcKmknxSqRbb7w%3D%3D)

100K Ohm resistor  
[https://www.mouser.com/ProductDetail/71-RCG0603100KJNEA](https://www.mouser.com/ProductDetail/71-RCG0603100KJNEA)

---

<div class="post-metadata">

**Author:** ![jedimaster](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/jedimaster/32/7074_2.png) [@jedimaster](https://crucible.hubbe.net/u/jedimaster)\
**Post date:** [June 18, 2025, 4:54pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/9 "2025-06-18T16:54:42Z")

</div>

Hey there! This is a super clean method of grabbing the low signal needed for charge detect. Nicely done! I wanted to charge separate from the board to give faster charging rather than the trickle available on the v3.9 so that’s why I used the USB Charge Port available on a lot of lightsaber parts sites like this one from TCS:

[https://www.thecustomsabershop.com/Electronics/Batteries-and-Packs/Clips-Connectors/USB-C-Charge-Port](https://www.thecustomsabershop.com/Electronics/Batteries-and-Packs/Clips-Connectors/USB-C-Charge-Port)

The biggest challenge on this one was determining how to get the charge detect low signal I wanted. I have since found that connecting to pin 7 on the TP4056 gives a clean signal while actually charging rather than just plugged in and comes in a pretty small package. It’s still not exactly how I want it though for ease of use - especially because I like to also have data lines on my USB connector so end up with an additional module on top if this. I’m in the process of a new design to address all that which I’ll post here when complete for anyone who wants it. Still, hard to beat your 6mm square package solution.

![image](https://crucible.hubbe.net/uploads/default/original/2X/3/3ce443a789e5ff271467b0a5902f9a81b48ad2cb.png)

---

<div class="post-metadata">

**Author:** ![awhite89](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/awhite89/32/4466_2.png) [@awhite89](https://crucible.hubbe.net/u/awhite89)\
**Post date:** [June 23, 2025, 4:26pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/10 "2025-06-23T16:26:17Z")

</div>

Here’s some small tp4056 breakout boards on oshpark that could work. You’d have to solder directly to the pins for the signals and use the usual data pads on the v3 for data. I love it when creators share their pcb designs on oshpark, super helpful

[https://oshpark.com/profiles/mzst](https://oshpark.com/profiles/mzst)

---

<div class="post-metadata">

**Author:** ![jedimaster](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/jedimaster/32/7074_2.png) [@jedimaster](https://crucible.hubbe.net/u/jedimaster)\
**Post date:** [July 15, 2026, 11:42pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/11 "2026-07-15T23:42:22Z")

</div>

I have since outgrown this method and created a new one that I think works much better, does not require any source code modification, and is built around an unmodified Fett263 prop set up. If there is interest, I will create a post sooner than later.

---

<div class="post-metadata">

**Author:** ![profezzorn](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/profezzorn/32/8_2.png) [@profezzorn](https://crucible.hubbe.net/u/profezzorn)\
**Post date:** [July 26, 2026, 2:03pm UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/12 "2026-07-26T14:03:10Z")

</div>

There is interest.

---

<div class="post-metadata">

**Author:** ![jedimaster](https://crucible.hubbe.net/user_avatar/crucible.hubbe.net/jedimaster/32/7074_2.png) [@jedimaster](https://crucible.hubbe.net/u/jedimaster)\
**Post date:** [July 27, 2026, 4:13am UTC](https://crucible.hubbe.net/t/true-charge-detection-for-use-with-custom-presets-w-or-w-out-blade-id/6587/13 "2026-07-27T04:13:39Z")

</div>

Ok post coming soon!
