forked from brabl2/narcoleptic
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
61 lines (48 loc) · 2.53 KB
/
README
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
Narcoleptic uses some features of the microcontroller to reduce power consumption.
These are:
Sleep mode:
Freezes all microcontroller functions to dramatically reduce power.
128kHz internal oscillator:
This is a very low power oscillator, used to inform the microcontroller when to
wake up.
Power reduction:
Unused microcontroller functions can be powered down to save additional power.
Power saving tips:
Narcoleptic only reduces the current used by the microcontroller. It does not
reduce the current of anything connected to it.
A power-on LED can use 20mA.
A voltage regulator can use 15mA.
The FTDI USB to serial chip uses about 15mA, so Arduino Duemilanoves and
Diecimilas are not suitable for low power use without modification.
Running at 3.3V and 8MHz uses much less energy than 5V at 16MHz.
Pull-up and pull-down resistors use energy if they are passing current. Prefer
normally-open switches over normally-closed. Consider using software pullups,
and only turning them on when you need them.
The Atmel ATmega328P data sheet has a section on "Minimising Power Consumption".
Narcoleptic tricks:
The 128kHz oscillator is not very accurate. It drifts by ±4.5% over the full
voltage and temperature ranges. Narcoleptic measures its speed against the main
clock, and bases all its timings on the corrected value. Provided the operating
voltage and temperature remain stable, Narcoleptic should maintain < ±1% accuracy.
The 128kHz oscillator only provides sleep periods of 8,4,2,1 seconds, 500, 250,
125, 62, 31 and 15ms. Narcoleptic performs multiple sleeps to achieve the requested
timing.
Keeping track of time:
Narcoleptic shuts down almost everything - even the millis() counting routine.
To get around this, Narcoleptic keeps track of the time in sleep mode.
If you replace: millis()
with: (millis() + Narcoleptic.millis())
your timing calculations will take into account the time in sleep mode.
Manages very small and very large delays:
delays smaller than 20ms are executed without calibration, but using the last known value of watchdogTime_us
delays up to more than 1000h are correctly managed.
Narcoleptic gotchas:
When doing a Narcoleptic.delay(), the following systems are frozen:
Serial communication
PWM outputs
millis() ticker
All timer activity
Narcoleptic is best used when nothing is going on anyway, to simulate a power-off
state.
In a well optimised circuit, Narcoleptic can run for several years off
a couple of AAA batteries.