More AVR Tetris

[Ben] built an AVR based Tetris game that uses a TV as the display. He linked his project in a comment from the AVR Tetris project featured last week. His work taps the power of his own tvText library to handle the composite video out. Using a TV takes all of the hardware work out of the equation, leaving just the composite jack and a few buttons to connect to the ATmega168 and its 20MHz clock. We’ve embedded the game play video after the break. It’s black and white but also clean and crisp.

[Ben] didn’t include music with his build but another commenter, [Eric], has started to work on that. We can’t help but think that they both should have tipped us off sooner about their projects.


11 thoughts on “More AVR Tetris

  1. @Agent420-I am the biggest fan of Parallax’s Propeller chip, and it is not overrated, but besides that you are completely right :D

    From my own experience at trying to get NTSC video output from an even beefier Atmega32 micro, this is a huge accomplishment. The video is crisp and clear and there seems to be no lag. Excellent work. I’m curious to see how enough clock cycles were ecked out to run the video and play the game.

  2. Thanks for the feature!

    Benny M: Very observant. ;-) I have a VGA box hooked up to my monitor. One thing I haven’t worked out yet is why I get colourful rainbows around every black-white transition when viewed on a TV tuner or VGA box (easily fixed by switching the saturation right down) but no such effect on the handful of “real” TVs I tested on (crisp black and white from the start). Maybe real TVs can detect a black and white signal better than a TV tuner or VGA box?

    Agent420: You can get decent colour out of an ATmega168 if you output RGB (see for an example) but as I only had access to an old TV tuner and VGA box, both of which only support composite or S-Video, I kept it black and white. You can get RGB to composite/S-Video ICs, but they were pretty expensive when I looked. I did also look into Propellers some time ago, but hastily closed the tab when I saw that they were going charge around $50 to ship to the UK!

    Nemo: I did a rough test by counting the number of frames it took for a _delay_ms() call to execute, and estimated around 3 MIPS. After enabling TVTEXT_SKIP_ALTERNATE_ROWS I estimated around 9 MIPS. These weren’t very scientific tests so could be completely wrong, but there’s more than enough CPU time left to run a C implementation of Tetris smoothly. (I’m using a 20MHz clock).

  3. The tetris gods are angry….

    “Line piece…LINE piece….. LINE PIECE!”

    But srsly, isn’t the best part about Tetris the theme music? I know composite out on an AVR is a pretty nice accomplishment but I need my russian choon fix or the little lines don’t dance right for me.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.