README.md 3.58 KB
Newer Older
Sven Greiner's avatar
Sven Greiner committed
1
2
3
4
5
6
7
8
9
10
# Firmware for ATtiny13-based flashlights

This firmware is compatible with the driver commonly found in Convoy flashlights like the S2+ or C8+. More specifically it expects an ATtiny13 microcontroller, single PWM output on PB1, (optionally) voltage devider on PB2 and a single on/off switch. The microcontroller must run at 4.8 MHz (fuses H:FF L:75).


## Features

- Two modes of operation: ramping and fixed levels
- Turbo mode: immediately switch to maximum output
- Battery check: one to four flashes
Sven Greiner's avatar
Sven Greiner committed
11
- Low voltage protection: flicker every 15 seconds if the voltage is low and turn off if the voltage is critical
Sven Greiner's avatar
Sven Greiner committed
12
13
- Mode memory: start with last frozen ramp value or with last fixed level (off-time memory)
- Stop at high: in ramping UI, stop if ramping reaches maximum output
Sven Greiner's avatar
Sven Greiner committed
14
15
16
- Start at high: after the flashlight was off, start with the highest output (and go from high to low)
- Beacon mode: low background light with regular flashes
- Tactical strobe: if enabled, always start with fast strobe mode
Sven Greiner's avatar
Sven Greiner committed
17
18
19
20
21
22
23
24
25
- Runtime configuration: options can be toggled via configuration menu


## Operation

### Configuration menu

1. Turn the light on
1. Shortly tap the switch 10+ times, the light will turn off
Sven Greiner's avatar
Sven Greiner committed
26
27
1. The light starts counting via flashes, each group followed by a short burst of flashes. Turn off the light during the burst to toggle the option. Options are:
    1. Start with strobe
Sven Greiner's avatar
Sven Greiner committed
28
29
30
31
32
    1. Ramping or fixed levels
    1. Mode memory on or off
    1. Freeze on high
    1. Start on high

Sven Greiner's avatar
Sven Greiner committed
33
The default is: no strobe, ramping UI, no mode memory, do not freeze on high, start on low
Sven Greiner's avatar
Sven Greiner committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56


### Ramping UI

Turn the light on and it will start ramping up and down. Short tap the switch to freeze the current brightness. Tap again to resume ramping.

Tap two times to go into turbo mode. There is no timer, so make sure to monitor the temperature. Tap again to go back to ramping.


### Fixed level UI

There are four brightness levels in the fixed mode:

1. Low
1. Medium
1. High
1. Turbo

Turn the light on, it starts with a fixed output level. Tap the button to switch to next mode. After the highest mode it will start with the lowest mode again.


### Battery check

57
Tap six times to enter battery check mode. The flashlight starts blinking one to four times. The number of flashes corresponds to the remaining capacity / current voltage:
Sven Greiner's avatar
Sven Greiner committed
58
59
60
61
62
63
64
65
66

- 4 flashes: above 4.0 V (75%)
- 3 flashes: above 3.8 V (50%)
- 2 flashes: above 3.5 V (25%)
- 1 flashes: below 3.5 V

Tap again to return to normal flashlight mode.


Sven Greiner's avatar
Sven Greiner committed
67
68
### Beacon mode

69
Tap five times to enter beacon mode. In this mode the flashlights runs at low intensity and flashes every two seconds. Tap again to return to normal flashlight mode.
Sven Greiner's avatar
Sven Greiner committed
70
71
72
73
74
75
76
77
78


### Strobe mode

If users want a strobe mode, they usually want it for defence purposes. Thus it should be possible to enter it as fast as possible.

If strobe is enabled in the preferences, the flashlight always starts in a fast strobe mode. Then a single press of the power switch enters normal flashlight mode.


Sven Greiner's avatar
Sven Greiner committed
79
80
81
82
83
84
85
86
### Low voltage protection

If the voltage is below 3.2 V the flashlight will flicker for half a second every 15 seconds. If the voltage is below 2.7 V the light will turn off and flash regularly to notify the operator that the light is still turned on but the battery is empty.


## Development

TODO
Sven Greiner's avatar
Sven Greiner committed
87
88
89
90
91
92
93
94


## License and acknowledgments

Thanks to ToyKeeper who was a great inspiration while writing this code. Her [flashlight firmware repository](https://launchpad.net/flashlight-firmware) contains a huge collection of flashlight firmwares.

Copyright (c) 2018 Sven Karsten Greiner  
This code is licensed under GPL 3 or any later version, see COPYING for details.