Arduino Tetris TVout

Published

Introduction: Arduino Tetris TVout

I have reproduced a B&W version of the classical game TETRIS running for PAL composite TV output, with a resolution of 128 x 64 pixel.

A video showing how it looks is available here.

As in all my previous instructables, there is no need for special game shields or further supporting IC, as compared to other versions available on the Net. You only need a bare Arduino Uno and few other components, such as buttons, resistors and a RCA connector (and eventually a speaker).

This game is a "conversion" plus some improvements of my previous color version for VGA monitors, shown here.

The game had different levels where the speed icreases and it shows the score. Sound has been addet too.

Step 1: Schematic and Code

To reproduce this game you need first to download the code, available at the bottom of this page (remember to copy it in a folder with the same name).

Then you need to download the TVout libraries, that has to be saved in the same folder of the standard Arduino libraries.

You can immediatly upload them on an Arduino Uno. If you don't get any other error message, you can start to build your hardware!

You need the following components:

  1. an Arduino/Genuino Uno - original or a clone, but original is better :-)
  2. an RCA female connector
  3. resistors for the video signal: one of 1 kOhm and one of 470 Ohm
  4. resistors for the buttons: one for every button with value from about 1 to 2 kOhm
  5. four buttons plus one facoltative
  6. a PC board or just some wire and pins
  7. facoltative: a speaker

Connect the parts as shown in the upper schematic.The speaker must be connected to pin 11.

You can assemble them as you prefer (eventually on a bread board for the preliminary tests).

As an example, I put the Arduino in a pre-existing box with buttons I got from some scrap. Since it has already 5 square buttons (plus four other small ones I did not use), I decided to implement the following movements for the "tetraminos" pieces: turn clockwise, turn anti-clockwise, shift left, shift right and fast shift down. One of the two turn buttons can be neglected (for instance clockwise). In this case you need to connect the corresponding Arduino analogue pin (A2) to ground!

Another example is with a wood box and four buttons, as shown in the upper picture.

If you have done everything properly, it should be immediately possible to play!
Enjoy!

Share

    Recommendations

    • Make it Move Contest

      Make it Move Contest
    • Oil Contest

      Oil Contest
    • Planter Challenge

      Planter Challenge
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    2 Questions

    Arduino : 1.8.4 (Windows 7), Carte : "Arduino/Genuino Uno"

    C:\Program Files\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\Arduino\hardware -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\ddd\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10804 -build-path C:\Users\ddd\AppData\Local\Temp\arduino_build_961830 -warnings=none -build-cache C:\Users\ddd\AppData\Local\Temp\arduino_cache_278371 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\Arduino\hardware\tools\avr -verbose C:\Users\ddd\AppData\Local\Temp\Tetris_TVout_New\Tetris_TVout_New.ino
    C:\Program Files\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files\Arduino\hardware -tools C:\Program Files\Arduino\tools-builder -tools C:\Program Files\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files\Arduino\libraries -libraries C:\Users\ddd\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10804 -build-path C:\Users\ddd\AppData\Local\Temp\arduino_build_961830 -warnings=none -build-cache C:\Users\ddd\AppData\Local\Temp\arduino_cache_278371 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\Arduino\hardware\tools\avr -verbose C:\Users\ddd\AppData\Local\Temp\Tetris_TVout_New\Tetris_TVout_New.ino
    Using board 'uno' from platform in folder: C:\Program Files\Arduino\hardware\arduino\avr
    Using core 'arduino' from platform in folder: C:\Program Files\Arduino\hardware\arduino\avr
    Detecting libraries used...
    "C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\ddd\AppData\Local\Temp\arduino_build_961830\sketch\Tetris_TVout_New.ino.cpp" -o "nul"
    "C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Users\ddd\Documents\Arduino\libraries\TVout" "C:\Users\ddd\AppData\Local\Temp\arduino_build_961830\sketch\Tetris_TVout_New.ino.cpp" -o "nul"
    "C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Users\ddd\Documents\Arduino\libraries\TVout" "C:\Users\ddd\AppData\Local\Temp\arduino_build_961830\sketch\Tetris_TVout_New.ino.cpp" -o "C:\Users\ddd\AppData\Local\Temp\arduino_build_961830\preproc\ctags_target_for_gcc_minus_e.cpp"
    C:\Users\ddd\AppData\Local\Temp\Tetris_TVout_New\Tetris_TVout_New.ino:12:21: fatal error: fontALL.h: No such file or directory

    #include <fontALL.h>

    ^

    compilation terminated.

    Utilisation de la bibliothèque TVout prise dans le dossier : C:\Users\ddd\Documents\Arduino\libraries\TVout (legacy)
    exit status 1
    Erreur de compilation pour la carte Arduino/Genuino Uno

    Hello, really great game! I've tried it and it worked, but for example when I rotate the L it is getting stucked in the border. Is there any update with fixed collision? Greetings!

    0

    Hi DanielE204, I added the version Tetris_TVout_new.ino. In this version the bug should be fixed. If you can, let me kindly know if t works.

    Regards.

    1 more answer

    Hi Rob, this is such an amazing work you did! Just replaced it with your new version and it works perfect! Big Thanks! Greetings from Germany

    Comments