Interaktives Tetris Gemaelde
Mehrere fingerfertige und geistreiche Geraetebastler haben sich zusammen gefunden und ein interaktives Gemaelde angefertigt: ein 12 x 2o Tasten breites Feld, bei dem jeder Button mit einer RGB Diode ausgestattet ist und somit in jeder Farbe leuchten kann. Interaktiv fragt Ihr Euch? Ja, denn darauf kann man Tetris spielen ... [...]
(show me)(don't show me)
Das Ganze erinnert mich ein Bisschen an Blinkenlights.
Fehlt nur noch die abgefahrene Musik von Tetris (^^ )
<<
Picture Frame Tetris
As Paul (a SparkFun employee) says, 'that's a whole lotta tetris'.
We string together 15 buttons pads, a bunch of ATmega8s, program in some rules to Tetris, and out comes a wall-sized interactive Tetris game.
You gotta thank the team of people that made this thing work:
What is this thing? It's the game of Tetris but played on a device that is composed of 240 buttons. So if you want to move the Tetris block right/left, you simply touch a button left or right of the current piece. To rotate a block you touch a button in one of the top two rows. And to drop a block you touch the bottom row. It's a hands on Tetris game! Watch:
A few 'wow' numbers:
If you're into embedded electronics, you may start to see what monumental task we thought ourselves into. The standard Tetris board is 10x20 cells and each cell needs to light up 1 of 7 different block colors. Our button pads are 4x4, multiply by 15, and you've got an array of 12x20 buttons. You stick a RGB LED behind each button and you have the potential to light any button, any color (you just mix different intensities of Red, Green, and Blue and you'll get any color).
The problem arises in the mass of numbers:
Here you see the ATmega8 running at 16MHz with two shift register and a ULN2003 sink driver. The board has a 6-pin connector for the SPI interface (5V, GND, MISO, MOSI, SCK, CS).
These basic driver/sink circuits were designed for another product, the serial backpack for the Tri-Color LED Matrix:
Because the LED matrices shown aboard were 8x8 (64 LEDs) we could reduce the shift registers on the button pad controller (16 LEDs) by one shift register IC, but we also needed to monitor button presses. It's beautiful how the final button pad schematic came out. We were able to use the extra 4 pins on the 2nd shift register to use in the button scanning process.
The idea was to have one master that would send color data to each of the 15 button boards. The button boards would have no idea about the game of Tetris or where they were in the Tetris board - they would only be responsible for continuously updating (PWM) their local LEDs and giving button press data back to the main controller. The main controller would be in charge of creating blocks, running rules, responding to button presses, and would only have to refresh the entire board (15 pads) a couple times a second and the button boards would do the rest.
Each time the main controller sent frame data to the button boards, the button boards would also respond to any button presses. The master would receive these button presses, and because the master knew which pad it was talking to, it could correctly load that button press into a large array that represented the Tetris game.
The main controller board (schematic) was responsible for the rules and for sending all the color data to the 15 individual button boards. We also rigged up a 20x4 SerLCD so that we could display Time, Score, Lines, stuff like that. There's a buzzer for annoyance factor and RS232 for debugging. There are 16 channels built into this board just for aesthetics (the pin was available on the shift register). We only ever use 15 channels. Everyone plays together on an SPI bus. All 15 button boards have 5 identical wires (5V, GND, MISO, MOSI, SCK) so we can string together almost all the pins together. The only difference is that we need 15 independent Chip Select (CS) pins. That way, the master controller can select one out of the 15 button boards and give it a data update, while the other 14 boards ignore what's coming down the SPI bus.
How does the master controller access 15 different CS lines? By using two shift register of course! Here is the schematic for the Tetris controller board.
The board assumes a *regulated* 5V input. Why don't we throw a voltage regulator on there? Because the master board powers all the other button boards. This gets power hungry really fast:
So we've got the main controller board powering all 15 button boards. The main board has access to all 15 unique CS lines. Now we've just got to wire everything up and write some code.
There was a lot of code to be written! The data frame protocol, the LED PWMing, the Tetris rules, the button response routines, even block gravity (when a Tetris line goes away, the blocks above drop down and fill the open gaps). It's still amazes me it works. We actually found out that our system speed (16 individual ATmega8s running at 16MHz) was way faster than we originally thought! We actually have to slow down the overall board update rate. We can do a complete board update (send the appropriate color data to all 15 button boards) 100 times a second! This is much faster than the eye can detect and so we can do some really interesting color demonstrations and user interfaces. This is where Monome exceeds! The monome project was originally designed to be controlled by a computer. It's really difficult to program complex math routines into our main controller board to do any fun fractal, wave, spiral, or other neat graphic demonstrations. We obviously need to build another board that has a computer interface!
Once everything was working, the mechanical gurus still needed to figure out a way to package this rats nest.
Cables. Lots of cables. And you have to be really creative how you route them so that everything fits. The frame is 1" aluminum. Once you get all the cables in place, inevitably one of the connections breaks then you get to take everything apart and go hunting. In the end, we would have been better off with a split controller design (two controllers, one in each lower corner) to save some cable headaches, but we got it all working!
It's a hefty picture to hang. At 10lbs, you need a good anchor to hoist the board.
That's it! I hope you enjoyed reading about the Picture Frame Tetris game. Before you ask if we'll sell you one, realize just how much hardware, man hours, and customization this device takes. The monome folks have done well building smaller 8x8 mono-color units. We believe we can build 16x16 button/Tri-color LED boards (not Tetris - just a very wild interface board) for about $1500. If anyone is interested, please email us!
We will be demo-ing the Picture Frame Tetris game at the 2007 Maker Faire (May 19th and 20th, 2007) at the San Mateo fair grounds. Please stop by and say hi!
Back to the tutorials.
Copyright (c) 2007 Spark Fun Electronics.
ALL RIGHTS RESERVED.
This material may be distributed for educational purposes provided the copyright information for Spark Fun Electronics remain in the source and publicly visible on at least one page of any printed material (e.g. title page, table of contents, etc.).
©2005 Spark Fun, all rights reserved. Privacy and Security
>> # top # | Q: Spark Fun.com
(show me)(don't show me)
Das Ganze erinnert mich ein Bisschen an Blinkenlights.
Fehlt nur noch die abgefahrene Musik von Tetris (^^ )
<<
Picture Frame Tetris
As Paul (a SparkFun employee) says, 'that's a whole lotta tetris'.
We string together 15 buttons pads, a bunch of ATmega8s, program in some rules to Tetris, and out comes a wall-sized interactive Tetris game.
You gotta thank the team of people that made this thing work:
- Bill Barker - The cable guy
- Tyler Talmage - "As long as I don't have to solder another RGB LED"
- Casey Haskell - Tool path and mechanical design
- Josh Nathan - Plastic and mechanical fabrication
- Nathan Seidle - Hardware, coder, and idea guy
- Adrian Moorhouse - Coder and proto assembly
- Bob Hunke - Pad builder
- Matt Bolton - Assembly Overlord
- Anndrea Boe - Fantastic photos of a very awkward subject
What is this thing? It's the game of Tetris but played on a device that is composed of 240 buttons. So if you want to move the Tetris block right/left, you simply touch a button left or right of the current piece. To rotate a block you touch a button in one of the top two rows. And to drop a block you touch the bottom row. It's a hands on Tetris game! Watch:
Playing Wall Tetris
A few 'wow' numbers:
- 16 microcontrollers
- Total of 256 MIPS
- 720 LEDs
- 1.5A current draw
- 1300 lines of code
- 28800 bits being updated per second
- 9 people
- ? man hours
If you're into embedded electronics, you may start to see what monumental task we thought ourselves into. The standard Tetris board is 10x20 cells and each cell needs to light up 1 of 7 different block colors. Our button pads are 4x4, multiply by 15, and you've got an array of 12x20 buttons. You stick a RGB LED behind each button and you have the potential to light any button, any color (you just mix different intensities of Red, Green, and Blue and you'll get any color).
The problem arises in the mass of numbers:
- 12x20 = 240 cells
- 240 cells * 3(RGB) = 720 individual LED channels
- Each channel needs to be Pulse-Width-Modulated (PWM) faster than ~30Hz so the human eye doesn't notice the flicker
- We also need to scan each button to see if it's being pressed!
- Some sort of processor needs to update all 720 LEDs, run the rules of Tetris, and react to any button presses
Here you see the ATmega8 running at 16MHz with two shift register and a ULN2003 sink driver. The board has a 6-pin connector for the SPI interface (5V, GND, MISO, MOSI, SCK, CS).
These basic driver/sink circuits were designed for another product, the serial backpack for the Tri-Color LED Matrix:
Because the LED matrices shown aboard were 8x8 (64 LEDs) we could reduce the shift registers on the button pad controller (16 LEDs) by one shift register IC, but we also needed to monitor button presses. It's beautiful how the final button pad schematic came out. We were able to use the extra 4 pins on the 2nd shift register to use in the button scanning process.
The idea was to have one master that would send color data to each of the 15 button boards. The button boards would have no idea about the game of Tetris or where they were in the Tetris board - they would only be responsible for continuously updating (PWM) their local LEDs and giving button press data back to the main controller. The main controller would be in charge of creating blocks, running rules, responding to button presses, and would only have to refresh the entire board (15 pads) a couple times a second and the button boards would do the rest.
Each time the main controller sent frame data to the button boards, the button boards would also respond to any button presses. The master would receive these button presses, and because the master knew which pad it was talking to, it could correctly load that button press into a large array that represented the Tetris game.
The main controller board (schematic) was responsible for the rules and for sending all the color data to the 15 individual button boards. We also rigged up a 20x4 SerLCD so that we could display Time, Score, Lines, stuff like that. There's a buzzer for annoyance factor and RS232 for debugging. There are 16 channels built into this board just for aesthetics (the pin was available on the shift register). We only ever use 15 channels. Everyone plays together on an SPI bus. All 15 button boards have 5 identical wires (5V, GND, MISO, MOSI, SCK) so we can string together almost all the pins together. The only difference is that we need 15 independent Chip Select (CS) pins. That way, the master controller can select one out of the 15 button boards and give it a data update, while the other 14 boards ignore what's coming down the SPI bus.
How does the master controller access 15 different CS lines? By using two shift register of course! Here is the schematic for the Tetris controller board.
The board assumes a *regulated* 5V input. Why don't we throw a voltage regulator on there? Because the master board powers all the other button boards. This gets power hungry really fast:
- Each RGB channel has the potential to draw 20mA
- 720 channels * 20mA = 14.4A
So we've got the main controller board powering all 15 button boards. The main board has access to all 15 unique CS lines. Now we've just got to wire everything up and write some code.
Vegas lights demo on button pads
Watch the video!
Watch the video!
Tetris and Button Droplet Example
Another demo of droplets and LED control
Another demo of droplets and LED control
There was a lot of code to be written! The data frame protocol, the LED PWMing, the Tetris rules, the button response routines, even block gravity (when a Tetris line goes away, the blocks above drop down and fill the open gaps). It's still amazes me it works. We actually found out that our system speed (16 individual ATmega8s running at 16MHz) was way faster than we originally thought! We actually have to slow down the overall board update rate. We can do a complete board update (send the appropriate color data to all 15 button boards) 100 times a second! This is much faster than the eye can detect and so we can do some really interesting color demonstrations and user interfaces. This is where Monome exceeds! The monome project was originally designed to be controlled by a computer. It's really difficult to program complex math routines into our main controller board to do any fun fractal, wave, spiral, or other neat graphic demonstrations. We obviously need to build another board that has a computer interface!
Once everything was working, the mechanical gurus still needed to figure out a way to package this rats nest.
Cables. Lots of cables. And you have to be really creative how you route them so that everything fits. The frame is 1" aluminum. Once you get all the cables in place, inevitably one of the connections breaks then you get to take everything apart and go hunting. In the end, we would have been better off with a split controller design (two controllers, one in each lower corner) to save some cable headaches, but we got it all working!
It's a hefty picture to hang. At 10lbs, you need a good anchor to hoist the board.
Playing Wall Tetris
Playing Tetris! - same vid as above [note from Wood.]
Playing Tetris! - same vid as above [note from Wood.]
That's it! I hope you enjoyed reading about the Picture Frame Tetris game. Before you ask if we'll sell you one, realize just how much hardware, man hours, and customization this device takes. The monome folks have done well building smaller 8x8 mono-color units. We believe we can build 16x16 button/Tri-color LED boards (not Tetris - just a very wild interface board) for about $1500. If anyone is interested, please email us!
We will be demo-ing the Picture Frame Tetris game at the 2007 Maker Faire (May 19th and 20th, 2007) at the San Mateo fair grounds. Please stop by and say hi!
Back to the tutorials.
Copyright (c) 2007 Spark Fun Electronics.
ALL RIGHTS RESERVED.
This material may be distributed for educational purposes provided the copyright information for Spark Fun Electronics remain in the source and publicly visible on at least one page of any printed material (e.g. title page, table of contents, etc.).
©2005 Spark Fun, all rights reserved. Privacy and Security
>> # top # | Q: Spark Fun.com
Labels: new technology, video, videogame news
posted by Woodrow at 5/19/2007 05:08:00 PM
0 comments
0 Comments:
Post a Comment