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 – (
  • Tilt switch (
  • TP4056 Lithium battery regulator/charger (
  • Attiny 85
  • Proto board (1 board makes 2x)
  • Case
    • Acrylic, white and clear
    • 4x3mm screws and nuts


  • Cut proto board
  • Program attiny (via arduino as ISP)
  • Solder
  • Cut case


2-3 hours

Quantity produced:

2 (one prototype)


attiny85_bikelight (arduino IDE)

bikelight (case)


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.