Close
0%
0%

GameOfLife_ht1632c_display_AVR

displaying Conway's Game of Life on a ht1632c-based 32x8 LED matrix using an AVR ATtiny26 mcu

Similar projects worth following
This is a project of mine to display Conway's Game of Life on a ht1632c-based 32x8 LED Matrix. I am using an AVR ATtiny26 I had laying around to push pixel data to the ht1632c LED matrix controller and display the current generation count on 3 mux'd 7 segment displays.

copied for my github readme:

GameOfLife_ht1632c_display_AVR

Code for to display Conway's Game of Life on a ht1632c-based 32x8 LED matrix board, controlled by an AVR ATtiny26 microcontroller. The extra I/O pins on the ATtiny26 are used to control 3 multiplexed seven-segment displays to show the generation count. The code has counters of generations that have low differences, and when it reaches a threshold it resets the display with a new "random" pattern. This is to keep it interesting, and to prevent oscillators from staying indefinitely and preventing reset.

ADDITIONAL FEATURES:

  • There is a button connected to PB6 of the ATtiny26, which triggers external interrupt INT0 which can reset the display if the spectator desires to do so. Using this button with INT0 is optional, and can be disabled by clearing DO_YOU_WANT_BUTTON_INT0 to 0 in main.c before compiling.
  • There is the option to have a potentiometer or other analog sensor (photoresistor/LDR perhaps?) connected to PA7 (ADC6) to control the PWM brightness setting of the ht1632c-based display! This is also optional, and can be disabled by clearing DO_YOU_WANT_ADC6_INPUT_TO_HT1632C_PWM to 0 in main.c before compiling.
  • At startup, when PB6 doesn't have INT0 or it's internal pullup enabled yet, the init_srand(void) function takes the lower byte of the floating ADC value on ADC9 (on PB6), which should have a bit of interference. It then feeds this byte into C's srand() function to seed the Pseudo Random Number Generator rand(), which is used later to put a "random" pattern onto the display when the Game of Life resets in the reset_grid(void). This is to make it have a hopefully different set of random patterns every time you reboot/reset the MCU.
  • If using INT0 for the button on PB6, and the ADC6 input on PA7, the code compiles to exactly 2048 bytes!. This isn't exactly a feature but is pretty interesting (the ATtiny26 only has 2048 bytes of flash! So be careful with changes to the code, or it may compile to be too big to fit in the ATtiny26! If unsure, type make size using the included Makefile to find out flash and ram usage). This may change later if I put some constants into EEPROM instead of PROGMEM (flash), but reads from EEPROM are slower than flash, so I probably won't change that unless I have to. The code can surely be better optimized ( I did as much as I could ), so feel free to do so. (compiler flags were a miracle as well, the --combine -fwhole-program gcc flags helped shave off many bytes!). NOTE: interesting coincidence, based on my link on Hackaday Projects, my project is number 2048! Very interesting indeed!

Now has been soldered on protoboard pcb!

Project has been posted on Hackaday Projects!

Original development and testing of the code had been done within my driving_ht1632c_AVR repository.

  • 1 × ATtiny26 Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 3 × 2n3904 Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs
  • 7 × 220k ohm resistors
  • 3 × common cathode 7 segment display
  • 1 × sure electronics 3208 32x8 LED display (or other ht1632c-based)

View all 6 components

  • Made an online simulation using Processing/Processing.js !

    Ethan Durrant09/02/2014 at 05:27 0 comments

    I made a virtualization/simulation of this hardware device, which runs in a browser using Processing.js or in Java via the Processing IDE.

    Link to the online web page simulation:

    http://emdarcher.github.io/processing_GameOfLife_simulation/

    Link to the github repo with the simulation code:

    https://github.com/emdarcher/processing_GameOfLife_simulation/

  • Added a Video showing the project in action!

    Ethan Durrant08/29/2014 at 04:34 0 comments

    here is the video:

    link:

    http://youtu.be/nCIYj61XwAQ

  • Interesting coincidence, and the number 2048.

    Ethan Durrant07/27/2014 at 07:25 0 comments

    According to the link for this project. I must be project number 2048 on Hackaday Projects! If you look at the number in the link.

    This is pretty crazy to figure out, after just recently finding out that my program compiles to exactly 2048 bytes, for a AVR ATtiny26 which has exactly 2048 bytes of flash program memory. I am also having a strange incling to play the 2048 game now as well...

    Is 42 really the answer to life the universe and everything? Or is it 2048 now.

    What has just happened?

  • Soldered up the circuit on protoboard pcb!

    Ethan Durrant07/27/2014 at 06:39 0 comments

    I have decided that this project is mostly done electronics-wise (and probably code-wise since flash is full). So in this decision, I concluded that I sould solder up the circuit I have been prototyping into a more permanent form on a scrap of protoboard, so I did so ( but a made a non-fatal mistake soldering the button, easily fixable though ). The picture (very blurry due to horrible old camera and macro setting) has been added to the set up pictures in the project. Also updated the cover photo to show the display and protoboard circuit in action, uncovered, with no case. Next addition is to make a really awesome enclosure later when I have time, possibly made out of wood, plastic (lego maybe?), or just some cardboard ( most likely ).

  • Flash packed to the brim at exactly 2048 bytes!

    Ethan Durrant07/25/2014 at 23:59 0 comments

    I have been working on adding additional features, and am finally done with them. 

    ADDITIONAL FEATURES:
    ---------------------

    * There is a button connected to PB6 of the ATtiny26, which triggers external interrupt INT0 which can reset the display if the spectator desires to do so. Using this button with INT0 is optional, and can be disabled by clearing `DO_YOU_WANT_BUTTON_INT0` to `0` in `main.c` before compiling.

    * There is the option to have a potentiometer or other analog sensor (photoresistor/LDR perhaps?) connected to PA7 (ADC6) to control the PWM brightness setting of the ht1632c-based display! This is also optional, and can be disabled by clearing `DO_YOU_WANT_ADC6_INPUT_TO_HT1632C_PWM` to `0` in `main.c` before compiling.

    * At startup, when PB6 doesn't have INT0 or it's internal pullup enabled yet, the `init_srand(void)` function takes the lower byte of the floating ADC value on ADC9 (on PB6), which should have a bit of interference. It then feeds this byte into C's `srand()` function to seed the Pseudo Random Number Generator `rand()`, which is used later to put a "random" pattern onto the display when the Game of Life resets in the `reset_grid(void)`. This is to make it have a hopefully different set of random patterns every time you reboot/reset the MCU.

    * If using INT0 for the button on PB6, and the ADC6 input on PA7, the code compiles to **exactly 2048 bytes!**. This isn't exactly a feature but is pretty interesting (the ATtiny26 only has 2048 bytes of flash! So be careful with changes to the code, or it may compile to be too big to fit in the ATtiny26! If unsure, type `make size` using the included Makefile to find out flash and ram usage). This may change later if I put some constants into EEPROM instead of PROGMEM (flash), but reads from EEPROM are slower than flash, so I probably won't change that unless I have to. The code can surely be better optimized ( I did as much as I could ), so feel free to do so. (compiler flags were a miracle as well, the `--combine -fwhole-program` gcc flags helped shave off many bytes!)

  • Prototyping mostly done, code seemingly stable.

    Ethan Durrant07/24/2014 at 03:42 0 comments

    Prototype runs fine on the STK500 and when built on a breadboard. Code is now running and not crashing for many hours.

View all 6 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates