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