Planned features:
- brake light: light up when braking
- one button on/off: no need to press often
- advanced blinking modes: not only blinking, support also fading
- auto off: turn off light after certain time or if no movement for some defined period
Currently for motion a tilt switch is used. This won't work very well. You could also connect it directly to your brakes. In future an acceleration sensor would be fun.
How to upload new firmware:
(Details see http://highlowtech.org/?p=1695)
Tested with Arduino 1.8.1.
In Arduino preferences add repository: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
In Boardmanager add "attiny by David A Mellis"
Then select:
Board: ATiny Processor: ATiny 85 Clock: 1Mhz internal
And: Arduino as ISP
Use an Arduino Uno or Mega (Leonardo does not easily work!) and upload the ISP firmware to the Arduino (Examples --> Arduino ISP). Then connect a 10uF capacitor between Arduion reset and GND and the following pins of the attiny85 to the Arduino:
pin name: not-mega: mega(1280 and 2560)
slave reset: 10: 53
MOSI: 11: 51
MISO: 12: 50
SCK: 13: 52
...to the bike light:
5 VCC
6 SCK
1 Reset
7 MISO
8 MOSI
4 GND
^--- the pinched off here end
These pins are connect to attiny85:
___
RST 1 -|° |- 5 VCC
AIO 2 -| |- 6 PIN2, button on/off
AIO 3 -| |- 7 PIN1, brake button
GND 4 -|___|- 8 PIN0, LED output
Reverse engineered circuits of popular USB bike lights:
___
-|° |- GND
Button -| |-
-| |- Signal PWM
VCC -|___|- ? also signal?
Signal pin is a sink, pull to GND to turn on LED!
___
VCC? -|° |- GND
Button -| |- high?
high? -| |- Signal PWM
VCC? -|___|- ? also signal?
Marcel's bike frame: 37.7mm diameter, 14mm - 24mm depth
Some links:
- http://www.engblaze.com/hush-little-microprocessor-avr-and-arduino-sleep-mode-basics/
- https://thewanderingengineer.com/2014/08/11/pin-change-interrupts-on-attiny85/
- http://forum.arduino.cc/index.php?topic=8640.0
"V-USB is a software-only implementation of a low-speed USB device for Atmel’s AVR® microcontrollers, making it possible to build USB hardware with almost any AVR® microcontroller, not requiring any additional chip."