[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.
[youtube=http://www.youtube.com/watch?v=vZwySWBNNYw]
I think that TV looks like a computer monitor… Meh, WHO CARES :D This is pretty awesome :)
I’m not the biggest fan of Parallax’s Propeller chip (I think it’s a bit overrated), but it does make tv and vga displays easy, and it does color.
@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.
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 http://avga.prometheus4.com/index.php 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).
Here’s a very interesting project that uses AVR to generate PAL colour signals:
http://trznadel.info/kuba/avr/index.php
NTSC is basically the same.
I only did PAL modulation with FPGA so I can’t really estimate how much processor time will there be after the signal is colour-modulated. It’s very much possible that there will be enough time for a Tetris.
How totally cool!
Excellent! Looks like art.
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.
Might want to look into the F/uzebox. It’s got a few colour games with music. :) They love minimalization there, so maybe you can share.
http://www.belogic.com/uzebox/
It is using an overclocked ATmega644, though.
Someone in a comment on here the other day had me humming the Tetris tune all day. Now you’ve got me wanting to build one.
Is it possible to get it to output in ntsc?