loading

aka LED Ladder Display Game System.

An Attiny-85 outfitted with hardware and software to play action packed "video" games, on a in-line LED display.

It has a multiplexed 12 LED ladder display, and supports up to 6 button inputs and an optional audio output.

It is packed with 4 games of skill, with multiple difficulty levels and some variations.

[Video]

Step 1: Major Componets

I built my project modularly (two separate assemblies). A main Display sub-assembly; which can be used by itself stand-alone. And a Button input sub-assembly. That way I can use the button or the display assembly again in another project. This also allows for flexible mounting options.

I also brought out the control line to a pin-header for the LED ladder assembly so I could utilize an Arduino Nano (or an Uno), to develop software for it as well as use it in other projects. A Digispark will not work due to the other components on its circuit board.

I chose to use the same pin assignments for the LED ladder as in earlier
instructables to make it easy for those who already have such a hardware implementation to utilize the software in this instructable, even though I did not find the assignments made for the clearest logic in the software.

The two lines between the modules is PB4 and ground. As all that is on the multi-button assembly is resisters and switches so it is not polarity dependent, and reversing the connection matters not.

With the support of more buttons a greater variety of games (or applications) can be implemented. Two of the games in this instructable is best played with two buttons. The four main buttons can be used to directly access an associated game. Soon I will implement a game which depends on the use of all four main buttons.

This project uses up to six buttons. Four main ones BTN 1-4, These buttons can be individually detected even when any two of them are pressed simultaneously. The other two are special buttons, first there is the equivalent of the single button in earlier projects which makes a hard connection between the PB4 input to ground, I call this BTN0, or ESC as this switch can always be detected and will block out detection of any of the others. The other special key is the Function-Key, if pressed when BTN 0-4 are pushed it can be sensed and used to change functionality.

In this skill game sketch I use:

  • FncKey+Btn1 return to menu mode
  • FncKey+Btn2 advance difficulty level (if at highest go back to lowest)
  • FncKey+Btn4 instant Pause (hit any key to un-pause)
  • FncKey + Btn 0 or 3 are undefined.

Step 2: Parts List

Required parts

  • LEDs, red,yellow,green and blue like these
  • PCB boards similar items you may have to buy a larger board, and cut it to desired size.
  • pin dip socket similar items
  • Attiny-85 chip
  • resisters
  • button switches used: 12x12x8mm and 6x6x6mm PCB Momentary Tactile Push Buttons

recommended:

  • buzzer 5v, active type
  • a Popsicle stick
  • 2.54mm pin header strip
  • 30 ga wire and wire-wrap tool http://www.ebay.com/itm/351798901037
    the above link is to wire that is more like 36 ga. I wish I knew of such a deal for real 30 ga. wire

Step 3: Construction Highlights

On the main board assembly I electrically have the same as other earlier LED ladder projects, which you may want to refer for further basic construction directions https://www.instructables.com/id/Attiny-85-Led-Lad...

I however do not use an exterior pull up resister on the analog input A2(PB4), also I use Red,Yellow,Green and Blue LEDs, instead of all one color, which is desirable for some of the games I created for this hardware.

Here is the I/O assignments as expected by the attached software sketches:

Project      MCU   AT-85   Uno/Nano
Names        name  pin#    brd name
---------    ----  ----    ---------
Red  L1-3    PB3    2        D-11
Yel  L4-6    PB0    5        D-8
Green L7-9   PB1    6        D-9
Blue L10-11  PB2    7        D-10
Ain          PB4/A2 3        A-2
Audio        PB5    1        D-3

The one significant difference is that I have two buttons wired to PB4. The first goes directly from PB4 to ground but with no external pull up resister (I call this BTN0). I also have a button switch (which I call BTN1) connected with a 75Kohm in series to ground. This main board can be used without the "Button" assembly board, but with some limited functionality.

The current limiting resisters going to the sets of LED should be chosen based on the brightness of the different color LEDs you use and how bright you want them. I ended up with 91 Ohms for the red set, 75 yellow, 430 green and 150 Ohms for blue. These values may seems low, but remember the leds are multiplexed (generally on much < 100% of the time)

I used 3mm leds and spaced them apart a little bit. I had the legs of the LED straddle a Popsicle stick. This way they all stood up the same amount and above all other components. I am intending, at some point, to mount the unit with just the LEDs protruding through a frame.

I chose to wire-wrap the led interconnections. Without a special printed circuit board this is easier to do than soldering in tight places with lots of interconnections; does not tend to produce shorts and is easier to rewire in the case of a mistake. With all the currents in and around the micro-controller in the milliamps 30 ga wire is plenty sufficient.

Buttons and related resisters:

I devised a unique configuration (sort of a double Y) of resisters and buttons, such that the software could discern individual and dual button presses (theoretically any combination of these four buttons can be identified). I tried several configuration with a multitude of resister values in a spread sheet looking for the best configuration, then simulated them in software having it try all possible resister combinations to find the set (that I am using) which would produce the maximum of minimum difference of analog readings between any & all single and double button presses. I arranged them so that Btn1, Btn4 and Btn1+4 in particularly were distinct.

Refer to Diagram of button network above.

You need to cover up all wiring which inter-connects to PB4 (and possibly switch contacts & resisters) with electrical tape, hot glue or something else which does not at all conduct, as a mere mega-ohm resistance will throw off the ability to determine which switch(es) are pressed; and any such contact you make while holding an assembly would do that.

Later associated Instructables:

4-Button-Games-Using-One-Analog-Input/

Dual-Power-for-Your-Portable-Micro-Controller-Proj/

3D-Printed-Case-for-Inline-LED-Display-Console-and/

Step 4: Further Options and Notes

Optional Audio output

The optional audio output uses PB5. I connected a 5v buzzer, in series with a 150 Ohm resister to limit its otherwise loud annoying output. I recommend you use 50-200 Ohm. One could parallel the buzzer with a cap (2-10uf) to make it less raspy, or use a 10mm driver 32 Ohm speaker broken out of a set of cheapy stereo ear buds, instead of the resister and buzzer. I like it, for game sounds, better as I have it.

By default the Attiny-85 uses PB5 as a reset, effective means the audio would work but it will not have an ill effect on any other operation. When using a Nano or Uno the audio will work (coming out its D3) . To get audio with the Attiny you will have to change the internal pin configuration so the software can use PB5 as an output. There are significant ramification in doing this; please refer to these:

http://forum.arduino.cc/index.php?topic=178971.0

https://www.instructables.com/id/Simple-and-cheap-F...

and https://www.proto-pic.co.uk/attiny-fuse-resetter-...

Generally during game play a mistake or failure will invoke a chirp or short raspberry sound. There is a congratulatory tune played when you complete a level or win, like at ping-pong. I find that having accompanying audio really increases to joy of play.

Alternate game controller type buttons

For my grand kids, who are rough on equipment, I made durable separate buttons, Btn1 and Btn4, on the end of long lead wires. See photo. I mounted the buttons in make-sift grips; with a 75Kohm inline with Btn1, and a ~37Kohm inline with Btn4. In series with Btn4 I actually used a 36K, a 33K or even possibly a 39K could use.

Quality power supply needed

For a power source you can use the USB 5v output of a PC, tablet, wall charger, a power-bank or 3.7 Li battery directly.

I found that when powering the unit from some USB chargers and several USB power-banks that I would notice flicking and occasional miss behavior and even resets. If you experience this find a power source with better regulation, otherwise adding a large (100-1000uf) capacitor across +V to ground may help.

Testing

I have also included a test program to help validate and debug your hardware. The code is a work-in-progress, and is in great need of being cleaned up. I hope to get to that, but mean while It should serve your needs. I have recently only used it with a Nano driving the display and keyboard assemblies. You can use most any button to select items from the menu mode. To exit a demo/test again hit most any button. To exit the button test (#4) hit FncKey+Btn1 or hold down the EscKey (grounding PB4), or recycle power.

Due to differences in MCU internal resistances and resistor tolerances you may need to do some adjustments so that all single and dual button presses are detected correctly. To do this use test-4 (to select this refer to description of menu operation below) of the test program. Note that I didn't use an external pull-up resister as I have further planed uses for the PB4 input which are incompatible with any pull up.

Step 5: Software Overview

The sketch LadderGames.ino implements four games including some alternate versions.

The sketch can be downloaded and ran from a ATtiny-85, Nano, Uno etc. To program it into an Attiny chip see: https://www.instructables.com/id/Program-an-ATtiny... and/or to program your ATtiny-85 chip: https://www.instructables.com/id/How-to-program-th...

Change the internal clock of the ATtiny85 to 8MHz, as the performance is desired for the game play. Refer:

http://forum.arduino.cc/index.php?topic=276606.0

This sketch should be backwards compatible with most earlier ATtiny-85 led ladder projects, without change, but will have some limited functionality.

Menu Operation

On start up there is a health check in the form of a sweep across the LEDs and a set of beeps. Then it goes into main menu mode. Each set of LEDs of one color are lit for a couple of seconds in succession. A game is selected by pressing a button while an associated set is lit, game 1: Red, game 2: Yellow, game 3: Green, game 4: Blue. While in menu mode Btn2, Btn3, Btn4 can be pressed to go directly to games 2,3,4 respectively. Once a game has been selected you will need to indicate the variation you want. For each variation available a set of colored leds will flash. Simply press a button on the one you want. The variations, “versions”, for each game are further described below.

Version one of all four games can be played with a single button. Either one wired between PB4 and ground (Btn-0) like in earlier LED ladder instructables, or with a switch which connects a 75k load to ground (Btn-1). Either of these will do in games when the instructions speak of a non specific button press.

To exit any game you can use FncKey+Btn1, hold EscKey (aka: Btn0) down for 1-2 seconds or cycle the power.

Step 6: Game Play

Game 1: Push-It

This is an adaptation of my 'Push-It' game from one of my earlier instructable

https://www.instructables.com/id/Play-a-Game-with-a...

The goal of the game is to push the blink count and the number of lit LEDs to as many as possible. Push-It starts off with a number of flashes, which will then repeat. If you push the button after the last flash in the series and when an additional one would potentially exist the next LED will light and the flash count will increase by one. But if you 'push' before or after the time period of a would-be additional flash instead the count of flashes in the set will be reduced.

Every time you manage to increase the flash count the level of difficulty is increased as the timing speeds up a little, making it harder and harder to get up to higher flash counts.

The current count number is stored into EEPROM memory for restarting at the same level later.

Game 2: Ping-Pong

Great (albeit the only) two player competitive game herein; where the ball (single blip of light) goes from one side to the other, faster and faster, each time it gets 'hit' back.

I first implemented this single row of lights game across the front panel lights of an aerospace super-mini computer in the 1970s.

To hit the ball back and forth the appropriate paddle must hit (button pressed) it when it is in the end position (last LED). The first side to miss loses, and the lights on the winning wide flash.

There is two variations, one requiring only one button (Btn 0 or 1), which will hit the ball at either end; and a second version, is for two person head to head, which requires two buttons; button 1 on the left side and button 4 or 0 on the other. The use of Button 1 & 4 is preferred, as they will not interfere with each other; each can be hit to return the ball from its end no matter the state of the other button.

The winner of a rally is always the server for the next.

Game 3: Shooting Gallery

Shoot all the targets (lights) to complete a level. In each higher level the action is faster.

There are two versions; one where the site is fixed and the targets move and another where the site moves and the targets are still. In each case a hit knock out a target light; and a miss causes a target to pop up. When a target is in the sight the sight lights up brighter, otherwise it is dim.

In version one the sight starts at the left (bottom) and scans right. In version 2 the sight is fixed in the middle while the target move across right to left. By looking at the code there are ghostly versions 3&4 which could be activated, but you put your own well being at your own risk.

Game 4: JumpMan

The idea is that you're running through a game level where objects come along which you have to jump over, as you progress they come faster. In another game version there are also over-head objects you have to duck under.

In version one there are only objects to jump over. To jump you must press the button when the object gets to the last cell on the left; which brightens when this occurs. To jump 2 or more consecutive objects you have to jump (press) on the first and hold down the button for the rest.

In version 2 over head (flashing) objects are added. Those are jumped by 'jumping during the cell prior to it and release while it is in the end cell. Only one overhead can flash at a time, so once one has passed you may see another (not flashing before) bare down on you. There will never be consecutive overheads but they can be adjacent to one or more jump (boulder type) objects.

In game version 3 you must, get to, use a separate button for the overhead objects (Btn- 2,4 or 0 your choice); jumps then require Btn-1.

Once you have managed past four more object(s) than you failed at, you advance in level; there is an audio and visual congratulations, then a resumption at a higher rate of speed. Getting by a set of consecutive objects counts the same as one individual object.

I advise you to print out the about games' rules of operation and reread them before you play a game you have not recently played. Otherwise, you can frustrate yourself; thinking that the game is not operating properly when it fact it is, but you and the game have different ways and expectations. I, myself, have fallen pry to this more than a couple of times.

Step 7: Update, More Games

I have devised more games that utilizes this hardware. Check them out and have fun:

New Games from 'Whack a Mole' to 'Tug of War'

Dec. 2016. Now, at the end of the above link, there is a unified version of code including all 12 games.

Feb. 17, 2017: Here is the latest game set for this project, now with 16 games (sketch below). This will run on any MCU implementation with 32KBytes of flash program memory. All though any one to 3 or 4 of the 16 games can be put into a ATtiny. I recommend using the Nano 3 arduinos. The latest 4 games added are 'Le Mans' racing, 'Spray' head to head spray painting contest., 'PIG' basketball hoop shooting, 'BiFunc' a binary operation quiz game.

With greater and more diverse playing of these games improvements to their play-abilities, enjoyment for all level players, is possible. I think there is a lot of room for improvement in Le Mans racing via track layout design and game timing.

I have, written up, about 10 more activities/games/functions, some of which I hope to make available around fall 2017.

Also these one line games can be modified for a 2 line 2x16 LCD display, with one line of game objects and another for some text. I have done a little of this, but, as I am backed up with projects as far as I can see, I don't know when or if I'd get a round to it. So if anyone is motivated to adopt and optimize these games for a 2x16 LCD please share with me and others.

Besides the 4 new games here in Menu_16Games.ino, I have enclosed my project and have created related instructables: Inline LED game console Case and powering your portable MCU project

I hope many take the time and . . . ENJOY these games.

Group   game: 1– Red   2- Yellow   3 – Green   4 – Blue
1 red      PushIt      PingPong    ShootEmUp   JumpMan
2 Yel      QuickDraw   Tug_a_War   Chicken     Hot_Hands
3 Grn      Le_Mans     Spray       PIG         BiFunc
4 Blu      SimonSays   Whack_Mole  Sea_Hunt    Flip_d
<p>Hai</p><p>I have made 2 new prints and would like to share with you</p><p>I have another question for Ron M9 you could write a tutorial to program a game with this hardware, I'm not so good at programming and I would love to learn and with some examples that would be great</p><p>Tip: Paste the back of your printouts with tape, because if you accidentally put on iron and the print is in operation, you have problems (short circuit)</p><p>Kind regards</p>
<p>Sembot,<br>Making PCB prints for these circuits is great. Thank you very much.<br>Did you check out the 3D print out I did to form a game console? (see Update above)<br>I am not fully sold on doing a tutorial. I know I don't have time this summer. Maybe later.<br>Note that any one game (I suggest: Tug_a_War or PingPong from Menu_16Games.ino) can be renamed as the function &ldquo;void loop()&rdquo; and delete the other games as well as the then unused sub-routines and global variables. There would then be no menu operation and instead that game would automatically run. The resulting sketch can be used as a guideline for developing a new game. I have already provided a fair amount of comments in the code, with the intention of helping others create new games. In the future I can respond to specific questions.<br>Which of the above 16 games do you like best?<br>Ron</p>
<p>I'm not sure if this is possible or not but this just came to me this morning while drinking my coffee. You made two different line game units, one with 4 games and one with 8 games ( or three with 4 games each if you were to separate the 2 player games into their own unit) and I would like to think that you would choose which game to play the same way, by selecting a color that would be associated with the game title ( red= simon says, etc.)</p><p>You mentioned one of your units (or maybe all of them) can support up to 6 buttons. If you were to switch from color selection for a game to binary input would it be possible to combine all 12 of your games into one unit with room to spare for additional games? (I'm thinking there would have to be some additional programming to switch from color selection to binary selection)</p><p>I'm pretty sure there would have to be some hardware adjustments as well such as installing an sd card reader or something along the lines of that since chip memory is low depending on what you use ( I have atmega328s and if I'm reading the datasheet right it only has 32k of flash and 2k of SRAM, that doesn't sound like alot) and the (optional) addition of some clear LEDs on the ends (that won't be used during game play, just for game selection).</p><p>With these changes the unit could have up to 15 games (without the additional LEDs and only 4 buttons) or 63 games (with the addional LEDs and utilizing all 6 supported buttons)</p><p>I only thought of this because I have two boys and would have to make five separate units (two each of the 2 single player units and one of the 2 person unit) and it would make more sense to me to make only 2 units with all 12 games and 2 player functionality on each so they can play alone or with each other or a friend without having to keep track of 3 separate units. Plus they are learning binary...I'm a sneaky nerd mom.</p><p>Do you think this is feasible or am I just making this more complicated than it needs be? </p>
<p>Sarah, I enjoy your interest in my project and enthusiasm for electronics in general (salvaging LEDs etc.).<br>The binary encoding approach would be impractical with this hardware; partly because momentary buttons are used and not toggle or side switches which hold their state. I plan a two tiered selection (group 1-4 &amp; game 1-4 of that group).<br>an ATtiny-328 (Nano-3) has enough resources for all twelve games and probably enough for 4 more. I will put together the code combining the 12 games and test it this week. I can't hardly imagine coming up with more than 16 games using such a simplistic display. But just the same, it can be a rewarding challenge.<br>You can 'message' me with any questions. Ron</p>
<p>I didn't even think about having to use slide or toggle switches for the binary input. Like I said I had came up with the idea early that morning, thank you for the correction!</p>
<p>Sarah, I have now created a full 16 game version, in the Update section above. It does include a game to challenge the players understanding of binary operations; inspired by you, for your boys. Also included above is an operating manual describing all the games.</p>
<p>OK, I have attached a new software sketch,<br>combining all 12 games, to the instructable:<br><a href="https://www.instructables.com/id/4-Button-Games-Using-One-Analog-Input/" rel="nofollow">https://www.instructables.com/id/4-Button-Games-Using-One-Analog-Input/</a></p><p>I'd like to hear back when the boys get<br>their unit; and later feedback from them as users.</p>
<p>Wow! Thanks! I'm gonna get started on the build this weekend for sure! I was at radio shack the other day and I realized I didn't know what you used as connectors for buttons 1 and 4 for the ping pong game but I'll use female to male dupont wire for now and I just got my double sided perf board in the mail yesterday too! Gotta go plug in the soldering iron, I think ill get started on it now.</p>
<p>I made my external button connectors, with thin speaker wire (stranded) soldered to the middle of a short piece of solid 24ga. wire half stripped, then added shrink tubing for durability. Take a good look at the example pix. These 'male connectors' will then plug into any of the (female) items on the right side in the photo.<br>I use as simple and inexpensive parts as I can manage. I buy most every thing through eBay, buying straight out no bidding. Most of it come from China so I have to plan projects well in advance and stock up on a lot of stuff. In my instructables, you'll see most the parts listed are or have links to those items on eBay.</p>
Sorry about the last comment. will this work on an arduino uno etc?
<p>Yes, I use a Nano (~= Uno, but smaller) for code development testing, as I can change the code quicker and have audio without burning a fuse. Look at the code and you'll see it conditional compiles based on the processor type. Refer to the code for the pin assignments; particularly the audio output.</p>
<p>It is very nice:-)</p>
<p>Nice! These are cool games. I think it would be an eyeopener for many kids, that you can actually make a game with only a single line of pixels, in one color.</p><p>I could also imagine a kind &quot;climber&quot; game, where you control a pixel, and the objects fall on you from above. The &quot;warning&quot; should be that leds will flash shortly before the &quot;obstacle&quot; reaches the player. the player then has to move away from the obstacle.</p><p>Obstacles will be coming faster and faster and/or get bigger...</p>
<p>Thanks. I am hoping that many enjoy the discovery and fun of one of these.</p><p>Your game Idea sounds a little like the JumpMan game turned on end, But with some interesting twists. I like it. I would love to see a greater and greater number of games from a community of makers. This is part of why I put support in the software for so many lighting effects and buttons. I have a couple more games up my sleeve; I'll be implementing and posting, maybe this fall, time permitting.</p>

About This Instructable

2,520views

52favorites

License:

Bio: Professional Software, Hardware, Systems Engineer for more than 40 years. Amateur Radio HAM (KI7NEW)
More by RonM9:2-bit Communicators (RFM69) Dual Power for Your Portable Micro-Controller Project 3D printed case, Inline LED display console + reflection on 3D printing 
Add instructable to: