Pyralis
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Simulation of firefly behavior with LEDs and AVR ATtiny45/85 microcontroller
* Simulate fireflies in a jar
Uses the same hardware circuit as the [[http://www.instructables.com/id/Jar-of-Fireflies/][Jar-of-Fireflies Instructable]],
and posted as [[http://www.instructables.com/id/New-Jar-of-Fireflies][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]].

[[http://kjordahl.net][Kelsey Jordahl]]
~kjordahl@alum.mit.edu~

Time-stamp: 

* 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

* 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 [[http://www.atmel.com/dyn/resources/prod_documents/doc8020.pdf][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.

* REFERENCES

Buck, J., [[http://www.jstor.org/pss/2830425][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,
     [[http://dx.doi.org/10.1093/icb/44.3.250][doi:10.1093/icb/44.3.250]], 2004.

Lewis, S. M. and C. Cratsley, [[http://ase.tufts.edu/biology/labs/lewis/publications.html][Flash signal evolution, mate choice, and
     predation in fireflies]], /Ann. Rev. Ent./,
     [[http://dx.doi.org/10.1146/annurev.ento.53.103106.093346][doi:10.1146/annurev.ento.53.103106.093346]], 2008.

Lloyd, J.. [[http://deepblue.lib.umich.edu/handle/2027.42/56374][Studies on the flash communication system in /Photinus/ fireflies]],
     Museum of Zoology, University of Michigan, 1966.

* 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.

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。