Andúril is an open-source firmware for LED flashlights, which runs on several versions of ATtiny chip. It provides advanced functionality like configurable modes, brightness ramping, safety lockout, etc. via a UI controlled by a single button.
Many Andúril lights are equipped with auxiliary LEDs, often multi-colored, which can be configured to shine or flash when the light is powered off. This can be useful for locating a flashlight in the dark, checking battery voltage, or determining at a glance whether lockout mode is active.
In Andúril 2, the user toggles the aux LED mode by with 7C (7 clicks) of the e-switch. Existing modes are: off low high flashing
Some members of the user community have expressed interest in a medium brightness setting, between low and high. This Hack Week project aims to implement such an option. Users will configure the new setting using the existing 7C toggle mechanism - it will be reached between low and high modes in the rotation.
Goal for this Hackweek
Objective: Add the above-described medium brightness level and test it successfully on production hardware.
This will be my first experience with firmware so I do not know if this feature will require additional effort to implement across different models of flashlight. If I am successful with one model, I will use any remaining time to implement the feature for other models I own. I will make any results of this project available to the community, including code, testing outcomes, research, and any other relevant information.
The objective is incompatible with hardware constraints. This was unexpected, but it makes sense in the context of what I now know about ATtiny architecture and Andúril flashlight hardware.
Details to follow, but first a note about hardware: the device I intended to use for testing is a Noctigon DM11 flashlight. Andúril runs on a wide variety of different flashlights with different designs. Manufacturers differentiate their models by their case designs, optical properties, LED configurations, and driver designs. Despite significant variation in these properties, Andúril devices are homogeneous in the way their ATtiny microcontrollers interact with the rest of the hardware. Even across different versions of the ATtiny controller, implementation is similar and the findings of this exercise are applicable.
An Andúril flashlight comprises the following components:
- Host - the body of the device
- Main emitter(s) - the LED(s) producing the device's primary light source. Some lights have multiple channels of main emitters.
- e-switch - An Andúril light uses its power switch to control multiple parameters, even when the main emitter is turned off. As a result, an Andúril light cannot have a power switch that mechanically disconnects the power source. Instead, the MCU accepts input via a button and controls the driver accordingly.
- MCPCB - A metal core printed circuit board houses the main emitters and AUX LEDs, providing electrical connection to the driver and thermal transfer to the host.
- Driver - The main emitters require ample power supply, which must be regulated and modulated according to user input. The driver receives instructions from the MCU and supplies power to the emmiters accordingly.
- AUX LEDs - Some Andúril lights have auxiliary LEDs mounted to the MCPCB and/or inside the switch. These can be a single color or RGB. The user can configure Andúril to illuminate them when the main emitter is off.
- Optics - reflectors, lenses, etc.
Since the AUX LEDs illuminate when the light is off, they tend to remain illuminated for extended periods of time. The user can configure them to high, low, or flashing modes, or disable them. Note the absence of a discrete driver for these LEDs in the list of components above. Using a driver to supply the AUX LEDs would increase their energy usage beyond an acceptable level, so they receive their power supply from the MCU pins.
The pin mapping for the DM11 flashlight can be found in the source file hw/hank/noctigon-dm11/hwdef.h lines 9-30. The DM11 uses an ATtiny 1634 MCU.
PA5, PA4, and PA3 supply red, green, and blue AUX LEDs, respectively. If a light is equipped with RGB switch lights, they run on the same circuits as their AUX counterparts of the same color. If a light has single-color switch LED, The MCU powers it from pin PA2. Andúril controls AUX LED color by illuminating the red, green, and blue in combinations.
To control AUX LED brightness, the MCU needs to vary the voltage supplied to the AUX LEDs. Andúril implements its existing low and high brightness settings by enabling or disabling, respectively, the pullup resistors for the relevant pins. The pullup reistors are not variable - they can either be fully enabled or fully disabled - and each pin has only one pullup resistor. Thus, implementing a brightness level between low and high is not possible with only a software change. Rather, the hardware would also need to be modified.
Unfortunately, this is a terminal blocker for this Hackweek project. I do not have the requisite knowledge or tools to modify hardware in a way that would make the objective possible. That said, I have enjoyed getting acquainted with Andúril and ATtiny, and I feel empowered to pursue related projects in the future.
Andúril's upstream repository, maintained by a community of developers and flashlight enthusiasts.
This project is part of:
Hack Week 23
[comment]: # (Please use the project descriptio...
Avahi Integration and Network Connection
The Linux Test Projec...
OTPClient is currentl...
[comment]: # (Please use the project descriptio...