]> www.fi.muni.cz Git - bike-lights.git/blob - pins.txt
mudflap for dual rearlights
[bike-lights.git] / pins.txt
1 ATTiny 861A pin assignment
2 ==========================
3      (MOSI/DI/SDA/!OC1A/PCINT8) PB0 MOSI,SERIAL         PA0 (ADC0/DI/SDA/PCINT0)
4           (MISO/DO/OC1A/PCINT9) PB1 MISO,MODELED 5V_OUT PA1 (ADC1/DO/PCINT1)
5    (SCK/USCK/SCL/!OC1B/PCINT10) PB2 SCK,SW2   AMB_SENSE PA2 (ADC2/INT1/USCK/SCL/PCINT2)
6                  (OC1B/PCINT11) PB3 PWMLED1             PA3 (AREF/PCINT3)
7                                 VCC                     AGND
8                                 GND                     AVCC
9 (ADC7/!OC1D/CLKI/XTAL1/PCINT12) PB4 STATUSLED           PA4 (ADC3/ICP0/PCINT4)
10  (ADC8/OC1D/CLKO/XTAL2/PCINT13) PB5 PWMLED2  LED1SENSE+ PA5 (ADC4/AIN2/PCINT5)
11          (ADC9/INT0/T0/PCINT14) PB6 SW1     LED12SENSE- PA6 (ADC5/AIN0/PCINT6)
12           (ADC10/RESET/PCINT15) PB7 RST      LED2SENSE+ PA7 (ADC6/AIN1/PCINT7)
13
14 MISO
15 MOSI
16 SCK
17 RST
18
19 LED1 PWM
20 LED1 SENSE, diff/gain 8
21
22 LED2 PWM
23 LED2 SENSE, diff/gain 32
24
25 AMBIENT SENSE, single-ended
26 BATT-V SENSE, single-ended
27
28 STATUS LED (PWM?)
29
30 BRAKE HALL OUT
31 BRAKE HALL IN
32
33 SW1
34 SW2
35
36
37 Components
38 ==========
39 PWM1 LED1 rear spotlight: step-down, differential SENSE1
40 PWM2 LED2 rear LED strip: step-up,   differential SENSE2
41 PWM3 LED3 front light:    step-down, single-ended SENSE3, inverted stride
42
43 SENSE4 - ambient light sensor,   single-ended
44 SENSE5 - battery voltage sensor, single-ended
45
46 LED4 - status LED (green)
47 LED5 - error LED (red)
48
49 LED6 - speedometer illumination LED
50 LED7 - front UV LED
51
52 SW1 - on/off; mode switch
53 SW2 - temporary light boost or whatever
54
55
56 ADC Gain
57 ========                                                  0.033R sensign res.
58 single-ended resolution:          0.001074 V .. 1.1000 V  32.55 .. 33333 mA
59 differential resolution  8x gain: 0.000134 V .. 0.1375 V   4.06 ..  4166 mA
60 differential resolution 20x gain: 0.000054 V .. 0.0550 V   1.64 ..  1666 mA
61 differential resolution 32x gain: 0.000036 V .. 0.0344 V   1.09 ..  1042 mA
62
63 analog input resistance 100 MOhm
64
65
66 PWM LED current sense
67 =====================
68 0.033R sensing resistor:
69                        max gain    min gain
70    20 mA => 0.00066 V              8x
71   100 mA => 0.0033 V
72   150 mA => 0.0050 V
73   300 mA => 0.0099 V               Power burned at sensing resistor:
74   350 mA => 0.0116 V               0.004 W
75   700 mA => 0.0231 V               0.016 W    
76  1000 mA => 0.0330 V   32x         0.033 W
77  1500 mA => 0.0495 V   20x         0.074 W
78  2000 mA => 0.0660 V    8x         0.132 W
79  3000 mA => 0.0990 V    8x         0.297 W
80
81 Battery sense
82 =============
83 range 5-15 V
84 1.5M..100k
85
86 voltage    current   sense voltage
87 15V:       9.3 uA    0.94 V 
88 12V:       7.5 uA    0.75 V
89  5V:       3.1 uA    0.31 V
90
91 Ambient light sensor
92 ====================
93 5 V, 1M5 resistor + photodiode: voltage at the photodiode
94 darkness: 3.71 V => 4.31 MOhm
95 bathroom without lights, only outside lights: 3.68 V => 4.18 MOhm
96 kitchen light: 3.29 V => 2.89 MOhm
97 room 30min before midnight: 0.26 V => 82 KOhm
98 outside 30min before midnight: 0.05 V => 15 KOhm
99 bathroom halogen lights 0.02 V => 6 KOhm
100 battery light: 0.01 V => 3 KOhm
101
102 Use 1M5 main resistor + 300K sensing resistor, 1.1V single-ended sense
103
104 Expected         voltage     ADC readings
105 darkness:        0.244 V     226.8
106 bathroom:        0.249 V     231.8
107 kitchen light:   0.318 V     296.2
108 halogen light:   0.831 V     773.1
109 battery light:   0.832 V     774.5
110
111 Plain LEDs
112 ==========
113 @5 V source
114 20 mA/3V: 100 R resistor
115 20 mA/2V: 150 R resistor
116  2 mA/2V: 1K5 resistor
117
118 Battery idle current
119 ====================
120 2000 mAh: 1.0 mA -> 83 days capacity
121 2000 mAh: 0.1 mA -> 833 days capacity
122
123 Converter reaction
124 ==================
125 step-up: 4-5 adc measurements to ADC voltage increase
126 step-down 2: 1-2 ---""---
127 timer: 34-38 ADC measurements per jiffy (200 Hz)