How can I code my own firmware for the D4v2 Flashlight?

I have experience in C/C/python and a handful of a smaller scripting languages. I have an electric skateboard and I wanted to use a little arduino chip to tap into it’s RF remote and control the D4v2 colors with. Is anything like this at all possible? I did not see anyone actually writing code, and it seems the Anduril software isn’t open sourced (unless I just can’t find info on it). Does anyone have details on this?

Welcome to BLF.

With code you can do whatever you want, but does the hardware support it? In this case, no, there is no wireless communication IC in the D4v2. This needs to be added, as well as a method to pulse the switch signal pin of the D4v2’s MCU in order to make it change modes and such, if not some other method of control.

There is probably not enough room for the additional hardware in the unmodified light, and the RF signal would have to go through a bunch of aluminum. A smaller battery could be used to create internal space for the added hardware, and just the antenna could be external to the body. Otherwise everything could be external to the light, but you’ll need to tap into the light one way or another to signal the MCU. Through the switch boot is one way, connecting a wire to one leg of the E-switch there, but this is a less than ideal modification, and the light will not be so readily removable from the skateboard. Attaching the requisite hardware to the outside rear of the tailcap, and routing the switch signal through the body up to the driver, would be a way to keep the full sized battery and make the light readily removable from the skateboard, it will just add some length to the host.

Anduril is open source. The code is hosted multiple places such as the flashlight firmware repository. This is the branch where Anduril is located. Here is the user manual.

Here is the source code for Anduril 2: anduril2 : Code : Flashlight Firmware Repository

Thank you both for the helpful comments. I am still brainstorming the best way to do this if it’s even possible. I do not want to worry about form factor because I think I can come up with clever solutions for that. Is there a way to send a pulse to the flashlight through a physical communication line?

I figured I could probably dremil a hole into the flashlight enclosure then solder two copper wire leads on the both ends with some nickel that leads outside the flashlight’s body. From there I could power an arduino tiny or arduino nano off 3v3 - 4.2v from the 18650 and connect an RF receiver to the Arduino to relay signal from the skateboard remote. The arduino MCU can send PWM to the flashlight for communication. A saw from the flashing tutorial on the forums here that there is a data bus for firmware flashing, so I wonder if this could be use for communicating between the MCU’s too with Anduril.

Unless there is a well documented API for Anduril, I imagine this would be difficult to pull off. I wonder if instead I could use the existing Anduril software and then program an Arduino with very-quick button press sequences and tap onto the push button circuit on the flashlight instead. I wanted to code something that could turn up and down the brightness when I accelerate. I know there is a way to do this via the physical buttons, so theoretically the arduino could emulate this effect if I spliced onto the button circuit.

Is there a communication line on the D4v2 I could use instead?