You Are Here: Home » AVR ATmega Projects » The Game of Life using ATtiny2313 microcontroller

The Game of Life using ATtiny2313 microcontroller




The reason for making this project is that I was always fascinated by Conways Game of Life. It’s a great demonstration of the fact that simple things with a very simple set of rules can do wonderful things: spawn more of them, modify themselves, do logical operations, even create Turing machines. I suspect much more can be done using them, but there are even more interesting methods of doing so.

LCD

I made a simple implementation of Life on a PC, but so have a bazilion other people before me, of which I found very useful this one. My implementation is on a simpler device: An AVR with a 4×20 character display.

The Rules of the Game

The rules are very simple: There’s a 2D space organized into an XY grid of cells. A cell can be either DEAD or ALIVE. Each cell has 8 neighbours. The game is not a real time one, but a “turn based” one.The behaviour for the next-generation of cells is this:

Any live cell with fewer than two live neighbours dies, as if by loneliness.

Any live cell with more than three live neighbours dies, as if by overcrowding.

Any live cell with two or three live neighbours lives, unchanged, to the next generation.

Any dead cell with exactly three live neighbours comes to life.

The outcome of these rules is somewhat complex – a simple patern may create real marvels. Try loading some examples from the link above.

The Hardware

I play with AVRs alot – therefore I have chosen to use an AVR to control the process. The circuit is extremely simple – one AVR – the ATTiny2313, two resistors, a button, an LCD, two caps and that’s it! The resistor is there to limit the current flowing into the backlight of the LCD. The button adds a few random cells into the space. The AVR is the brain. It must be programmed with the hex file contained in this ZIP file. The AVR must be programmed to use the internal RC oscillator running at 8MHz without the internal prescaler. The fuses can be left on the factory setting, but the whole system will run at 1/8 of the desired speed. Which may be useful for those who wish to view in more detail the complex interactions of the cells. Oh, and you also need to enable the brouwnout detection for 4.3V or so.  There’s only one board, which I made on an universal board and soldered together with wires. You can see it on the picture on the right

The LCD is connected to the controller board using a simple connector:

The whole device runs of 5V. Power consumption is quite low – when you have no backlight on the LCD. If you have, than it can be anything from 100mA to 0.5A, depending on the type of the LCD used.

 

For more detail: The Game of Life using ATtiny2313 microcontroller

Leave a Comment

You must be logged in to post a comment.

Read previous post:
PICkit 2 programmer
Build your own PICkit 2 programmer

There are many PIC programmer available, commercial and DIY devices. As Microchip introduces the new microprocessors the programming software got...

Close
Scroll to top