-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.txt
136 lines (104 loc) · 5.61 KB
/
README.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
README
======
Author: Kelsey Jordahl
Date: 2011-07-27 23:51:06 EDT
Table of Contents
=================
1 Simulate fireflies in a jar
2 NOTE
3 FILES
4 REFERENCES
5 LICENSE
1 Simulate fireflies in a jar
------------------------------
Uses the same hardware circuit as the [Jar-of-Fireflies Instructable],
and posted as [New Jar of Fireflies].
These programs are written for the AVR ATtiny85 microcontroller. They
also run on the ATtiny45, and the two smaller ones should even run on
the ATtiny25 with only 2k of flash memory, but I have not tested it.
They are written to be compiled in avr-gcc.
The full simulation program is ~pyralis.c~. The other two programs are
simpler versions and can easily be extended to model other behaviors.
The included ~Makefile~ will build and install ~pyralis.c~. It will need
to be modified for chips other than the ATtiny85 and for programmers
other than the USBtinyISP. Pre-compiled .hex files are provided for
all three programs that are ready to install.
The subdirectory ~t84~ contains a port of the firmware to the ATtiny84,
an AVR with more output pins than the ATtiny45/85. The simulation
program there can simulate 12 fireflies.
More information is at [http://kjordahl.net/firefly.html].
[Kelsey Jordahl]
~kjordahl@alum.mit.edu~
Time-stamp: <Wed Jul 27 23:51:06 EDT 2011>
[Jar-of-Fireflies Instructable]: http://www.instructables.com/id/Jar-of-Fireflies/
[New Jar of Fireflies]: http://www.instructables.com/id/New-Jar-of-Fireflies
[Kelsey Jordahl]: http://kjordahl.net
2 NOTE
-------
Updated ~pyralis.hex~ to be compiled for attiny45, which seems to
run correctly on both ATtiny45 and ATtiny85 (the reverse is not true,
as I just found out). 14-Jan-2010
3 FILES
--------
~t45/oneflymoving.c~: A very simple program using timer1 for PWM but just
~_delay_ms()~ for timing flashes and intervals. Only one male
at a time, moving sequentially from one LED to the next. No
randomness, sequence repeats every 6 flashes.
(uses only 338 bytes of flash memory)
~t45/pair.c~: The simplest possible program using internal timers for both
PWM and generating interrupts. Simulates a pair of fireflies,
the male is always flashing every 6 s, from a random location
each flash. The female will [pseudo-]randomly appear and
disappear, responding 2 s after the male's flash.
(uses 1344 bytes of flash memory)
~t45/pyralis.c~: The full simulation program. Starts with one male flashing
with a period of 5.9 ± 0.6 s. Additional males will arrive
randomly at different times and periods, and will fall into
sync with existing males. Females may respond if all males
are flashing in sync, 2.1 ± 0.2 s later. Appearance of an
unsynchronized male will cause the female to stop responding.
The end state is usually 6 males flashing and one female
responding. After a randomly selected number of cycles
(lasting 5-25 minutes), the system will reset with no
flashing males or females, and gradually build up again. The
likelihood of new males or females appearing each cycle is
reset as well, changing the character of the interactions each
time around. Random number generator seed is stored to use a
different one each time.
(currently uses 2488 bytes of flash memory)
~t84/softpwm.c~: A trial program to use software PWM to drive 8
LEDs independently. I didn't find it to be fast enough to run a
firefly simulations. Based on Atmel Application Note [AVR136].
~t84/simple.c~: Trivial blinky program for testing ATtiny84.
~t84/pyralis84.c~: Port of ~pyralis.c~ to ATtiny84. Uses 12 LEDs
in two sets of six. Also uses a button to switch on and off in
software.
[AVR136]: http://www.atmel.com/dyn/resources/prod_documents/doc8020.pdf
4 REFERENCES
-------------
Buck, J., [Synchronous rhythmic flashing of fireflies II]. /The Quarterly
Review of Biology/, 63(3):265–289, 1988.
Case, J., Flight studies on photic communication by the firefly
/Photinus pyralis/, /Integrative and Comparative Biology/, 44(3), 250,
[doi:10.1093/icb/44.3.250], 2004.
Lewis, S. M. and C. Cratsley, [Flash signal evolution, mate choice, and predation in fireflies], /Ann. Rev. Ent./,
[doi:10.1146/annurev.ento.53.103106.093346], 2008.
Lloyd, J.. [Studies on the flash communication system in /Photinus/ fireflies],
Museum of Zoology, University of Michigan, 1966.
[Synchronous rhythmic flashing of fireflies II]: http://www.jstor.org/pss/2830425
[doi:10.1093/icb/44.3.250]: http://dx.doi.org/10.1093/icb/44.3.250
[Flash signal evolution, mate choice, and predation in fireflies]: http://ase.tufts.edu/biology/labs/lewis/publications.html
[doi:10.1146/annurev.ento.53.103106.093346]: http://dx.doi.org/10.1146/annurev.ento.53.103106.093346
[Studies on the flash communication system in /Photinus/ fireflies]: http://deepblue.lib.umich.edu/handle/2027.42/56374
5 LICENSE
----------
These programs are free software: you can redistribute them and/or
modify them under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version. A copy of the GPL
version 3 license can be found in the file COPYING or at
[http://www.gnu.org/licenses].
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.