As a commuting cyclist, I often forget to turn my rear flashing light off. It doesn’t take long to flatten the battery if it’s on all night. Even worse, I rarely remember to turn it on unless it is particularly dark.
Using a set of super bright leds, a microcontroller and a tilt switch I cobbled together a pretty efficient little bike light which comes on when the bike moves and turns off after about 60s of no movement.
- 1000mah lithium ion battery
- 4x ‘Pirahna’ high brightness leds – (https://www.aliexpress.com/item/100pcs-5mm-Piranha-Led-Super-Flux-Water-Clear-4-Pins-Led-Lamp-Beads-eagle-eye-led/32419009167.html?spm=2114.13010608.0.0.5nJJOo)
- Tilt switch (https://www.aliexpress.com/item/10PCS-SW-520D-Vibration-Sensor-Metal-Ball-Tilt-Shaking-Switch/32327748938.html?spm=2114.13010608.0.0.7TLC1l)
- TP4056 Lithium battery regulator/charger (https://www.aliexpress.com/item/20pcs-lot-1a-lithium-battery-charging-and-protect-one-plate-protection-2-in-1-18650-lithium/2046101642.html?spm=2114.13010608.0.0.X7yfnJ)
- Attiny 85
- Proto board (1 board makes 2x)
- Acrylic, white and clear
- 4x3mm screws and nuts
- Cut proto board
- Program attiny (via arduino as ISP)
- Cut case
2 (one prototype)
attiny85_bikelight (arduino IDE)
The attiny85 flashes the LED for a very short time (the code says 50ms on, 3500ms wait but the timing is all off so those numbers are not correct). if the LEDs are consuming about 200ma total during the flash, then they average about 2.85ma based on the 50:3500 duty cycle. This works out to a 350h lifespan on the 1000mah battery. I hope to charge the light about once a year. Adding a light sensor would be a good strategy to detect if the light needs to be activated or not to avoid running it during the day time but I think that running it during the day is still alerting motorists.
Most of the time the attiny85 is in low power sleep with the interrupt set to wake on change of state. In the code I even turn the ADC off to save as much power as possible.
Resistors are 33ohm.
Very bright leds, almost blinding when looking into them in a dark room.