-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathATtiny85_settings.txt
74 lines (64 loc) · 3.02 KB
/
ATtiny85_settings.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# 1. Power Consumption
- **VCC Range** 2.7 V - 5.5 V
- **Target Voltage** 3 V {*2x 1.5 V rechargable AAA or button battery*}
- minimal Power consumption using [Watchdog](http://gammon.com.au/forum/?id=11497&reply=6#reply6Posteingangx).
# 2. PIN Usage
| Pin | PB | Function |
| ----- |--------| -----------------|
| 1 | PB5 | !RESET|
| 2 | PB3 | PCINT3 (Bluetooth) |
| 3 | PB4 | PCINT4 (Bluetooth) |
| 4 | --- | VCC |
| 5 | PB0 | PCINT0 (Hold-Switch)|
| 6 | PB1 | PCINT1 (Trigger) |
| 7 | PB2 | PCINT2 (StatusLED)|
| 8 | --- | GND |
# 3. Settings
## 3.1 Frequency
- use **8 MHz** for lowest energy consumption, also it seems to hold 8 MHz at 3 V and 25 °C with +-10%
- TODO: callibrate Clock?
# 4. Functions and Communication
- Different functions for changeing shutter intervalls
- Bluetooth communication is in Bytes (8 Bit)s
- ATtiny only has ineger ALU -> avoide floating point atithmetic
### 4.1 Protocol Handy -> ATtiny
- Since Bluetooth uses [CRC](https://return-false.de/archive/1098) , there is no need for parity check.
- User Layer: Contains a *Start Sequence*, N *Functions* and a *Stop Sequence*. The The User can concatinate different *Functions* to get a piecewise continous function which dictates the shutter delay.
| FUNC_1 | ... | FUNC_N | END |
- Function Layer: There are different Functions, defined in tha Table below. *TYPE* encodes which *Function* and thus, how many bytes to expect. A *Function* is defined as a recursive series which encodes the time between the n-th and n-1-th shot. It is completely defined by its constants and for how many pictures this function is valide.
| TYPE | CONST_1 | ... | CONST_M |
- Each function will be handeled like:
```cpp
for(int n = 0; n < n_max ; i++){
activate_shutter();
int next_delay_ms = f(n);
go_sleep(next_delay_ms);
}
```
| FUNCTION | Hex | Number of constants | Formular |
| -------------- | ----- | --------------------------- | ------------ |
| Constant | 0x01 | 2 |f(0) = c<br> f(n) = c ; n ∈ [0, n_max] |
| Linear | 0x02 | 3 |f(0) = c<br> f(n) = f(n-1) + b ; n ∈ [0, n_max] |
| Quadratic | 0x03 | 4 |f(0) = c<br> f(n) = f(n-1) a(n-1) + b ; n ∈ [0, n_max] |
- Bit Layer:
| Symbol | Hex | Length in Byte|
| --------- | ------ | ------------------ |
| STOP | 0x00 | 1 |
| STOP_AND_SHUTDOWN | 0x0F | 1 |
| FUNCTION | 0x01-0x03| 1|
| CONST | 0x00-0xFF | 4 (long) |
### 4.2 ATtiny Protocol -> Handy
- Single Debug Information [DBG_TYP|BYTES]
- thouse define what kind of variable to expect and how many bytes
| Symbol | Hex | number following BYTES|
| --------- | ------ | ------------------ |
| DEBUG_CURRENT_STATE | 0x00 | 1 |
| DEBUG_CURRENT_MILLIS | 0x01 | 4 |
| DEBUG_GOING_TO_SLEEP_FOR_MS | 0x02| 4 |
| DEBUG_CURRENT_FUNCTION | 0x03 | Defined over following TYPE (next byte) see above |
| DEBUG_CHAR_SEQUENCE | 0x04 | 4 (long) |
### 4.3 On Converstaion
- A **byte** in C is 0-255
- A **byte** in Java is -128 - 127
- A **long** on the ATtiny has 4 byte
- A **int** in Java has 4 byte