Introduction: 40+ Games on a Mini STEM LED Game Platform

I developed 40+ games, challenges and miscellaneous activities for the “mini STEM platform”, as an aid in advancing STEM education (which was introduced here: https://www.instructables.com/Mini-STEM-LED-Game-Platform/ ).

Beyond the sheer challenge and enjoyment of playing these games and applets, the intended purpose is mainly for the coding of these to be used for inspiration and as a basis for instruction of makers, student scientists and programmers.

These games provide a wealth of coding techniques, problem solving, mathematics and algorithms utilized in games and activities which young programmers may find more interesting than pure code examples. Yet most of these are fairly simple, limited and stand alone, while quickly, once realized, providing interactive fun, along with feedback and validation of students’ efforts.

The source code has plenty of comments containing descriptions of what the code is doing as well as alternate example coding fragments.

Note: I adapted and improved, but did not originate the Arduino implementation of "Simon Says". You can find that else where in Instructables. As for all of the rest, I often took inspiration from all over, but I designed and developed the implementations that I am providing here for your use.

[2024 Update] Even more games and updated sketches that support RP2040 MCUs can be found in this project: https://www.instructables.com/PCB-3D-Case-for-STEM-Game-Platform/

Supplies

  • A “mini STEM platform”, as depicted in the photo above and defined here: https://www.instructables.com/Mini-STEM-LED-Game-Platform/[ 2023 Update: Now you can order a PCB board and a 3D printed enclosure from the likes of PCBWay.com (very reasonable $) given Gerber & .stl files you can obtain via this document along with detailed information refer: my public docs.google.com/document...]
  • The herein provided source code files ‘Mega_Games.ino’ & 'Mini_STEM_Platform.h'
  • A computer with the Arduino IDE installed
  • The operation manuals (find below). If you're in it for the Fun of it, you're all set !
  • Student(s), given your interest is the education of others.

Step 1: Educator Guidance

Student programmers should not be exposed fully straight away to the complete software source. Playing a game is acceptable before they try their hand at coding it up. Over exposure may cause a student to feel incapable of ever producing similar or as plentiful. I myself conceived, designed and developed many of these games over decades while working professionally as a software engineer. During my retirement I have spent time over the last couple of years putting them together and polishing them up. Culminating in this release. So please pace your instruction of students, such that they are succeeding and have fun as they go.

As these games were originally implemented at different times (and in different environments) they use un-common, to each other, techniques and support routines. So expect to find some global irregularities and redundant functionality.

Several of the games I ported from an earlier 12 LED project; adapted them to be independent of the number of LEDS and made further improvements on them.

One game at a time can be used as an example to center instruction around or as a production goal of a coding workshop. 

And of course the games can simply be downloaded and used for entertainment, straight away.

Step 2: Using a Game As an Educational Project

Given a game's intended function and behavior a beginner programmer can generally come up with a basic working model, which they can improve on with some coaching and/or examples from its full implementation within this set of source code. Students should be provided with the full hardware support include file (Mini_STEM_Platform.h), along with a starting framework (setup(), loop() …)

The average size of these games is over 100 lines of code. You can strip one down, removing commented out statements (often prints), extra versions and options as well as non mainstream functionality (eg: changing speed, switching player turns or reporting scores). Even some of the feedback audio/visual could be removed. All of this should get the heart of a game down to <50 (maybe even <30) lines of code, making it easy to digest and build on later. 

For an example of how you might do this sort of thing with the ‘Fortune Teller’ code, refer to the stripped down version and subsequent directions in Steps 16 &17 of this Instructable:

https://www.instructables.com/STEM-Game-Platform-Lesson-Plan/

Step 3: Downloading and Running the Mega Games on a STEM Game Platform Device

Download the attached sketch ‘Mega_Games.ino’ plus ‘Mini_STEM_Platform.h’ and place them in an appropriate folder. Using the Arduino IDE, compile and download to your mini STEM unit.

If you are not sure how an Arduino sketch is setup and works see: https://www.arduino.cc/en/Guide/ArduinoNano#toc2

The games, challenges and other activities are organized into groups of no more than 8 per. A top level menu allows you to choose a group, following which you can choose a game.

The Mega Games sketch consists of over 7000 lines of code.

The Arduino Nano used in the mini STEM game platform cannot contain all 40+ games at once. So you must comment out all but 2 or 3 groups, and instead enable dummy entries in a ‘Group’ array for those groups. Already done in the provided source file (enabling groups 1,3&4).

Here is an excerpt of the code with a populated group #1 and a dummy group #2

// 1 ------ Early In-line display Games (Oldies & Goodies)
{NA, PushIt, ShootingGallery, JumpMan_8, Skee_ball, Sea_Hunt_8, PIG, BiFunc, Flip_d},
//{TBD, TBD}, // TBD in cell 1-8 indicate no more valid entries

// 2 ------ Two Person Challenges
//{NA, pingPong, QuickDraw, Tug_a_War, Chicken, Hot_Hands, Spray, Joust, UpDownSide},
{TBD, TBD},

// 3 ------ Spirited FUN
{NA, Whack_Mole, SimonSays, Speed_Scan, Telekinesis, PKE_Meter, Affinity_Meter, Forture_Teller, TBD},
//{TBD, TBD},



The Group array has 9 active code lines, for Groups 0-8. You should maintain that arrangement, where there is one line for each group, be it populated or a dummy.

The compiler will discard code (games) which are not referenced, reducing the storage requirements. If the compiler errors, saying you are over 100% storage use, then you have too many groups enabled.

The top menu will have an LED lit (selectable item) for all up to the highest number group populated, and there is a flashing cursor. Button 2&3 move the cursor. Button 1 is used to select. During execution if you select an empty group you will simply get a buzz and have to reselect. The second tier menu is the game selection menu and will have a lit LED for each ’game’ in the selected group. Refer to the manual for further operational details.

It is imperative you read the operator’s manual: “Mega_STEM_Games_Man.odt”. This is necessary for each game in order to know what to expect, understand the goal, and how to play. I have also included a brief summary of the manual for printing and referring to after you have read all the details in the full manual a couple of times. Furthermore there is a 1 page crib sheet version for when you only need to know under which group and number a given game resides, and minimal use info.


Personal use notes:

From time to time you can change out the games you have in your mini game platform. I have three separate devices with the groups divided among them, and labeled accordingly.

In the future, I intend to utilize a Pro-Micro RP2040 in a mini STEM platform variation, which will be able to host all 40+ games at once, due to its very large code storage.

I would love hearing about others making improvements on any of these games. And please contribute any new game or activity implementations for the mini STEM LED Game platform.

Step 4: The Provided Games and Other Activities

Here is an overview of what’s included in the 40+ Games, Challenges and other Activities.

Group 1 ------ Early Inline Games (Oldies & Goodies)

Push-It Push button at the end of a series of flashes to add 1 more. again & again.

Shooting Gallery Shoot moving targets to complete a level. In higher levels the action is faster.

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 overhead objects you have to duck under.

Skee_ball  Roll your balls into one of three target "hoops", worth (1) (3) (2) pts, for your highest score. Sorry you’ll have to provide the tickets.

Sea Hunt There is an unseen submarine moving through the depths. It's initial location and direction is random. Hunt it down using sonar and destroy it with a depth charge hit.

PIG There are three different shots to be made (in order); the 3 pointer, a free throw shot and a lay-up. See how many you can make before accumulating three misses.

BiFunc    Predict a hidden mystery value given the results a Bi-Functions (AND, OR, XOR or ADDition) performed on it and another (user provided) known operand.

Flip'd You are trying to make all LEDs dark, by selecting groups of lit LEDS to flip or giving up one of your already dark LEDs. You play against another player or an AI. (kind of a 1D “Reversi”)


Group 2 ------ Two Person Challenges:

Ping-Pong Hit the ball back and forth at each other, while it travels at ever greater speeds.

Quick Draw 'Ready'/red, 'Set'/yellow, and a 'Draw!'/green: The first to hit their button wins.

Tug of War In the middle appears a 'bow' on a rope. It moves towards the player with the most hits. Once the bow reaches one end that's the winner.

Chicken Blips of light (their chariots) move towards the other. The winner is the one who releases their button Last, just before the two blips would crash into each other.

Hot Hands Two players press down their buttons together, one side tries to release then press their button twice before the other side can release his button. Akin to back of hand slapping.

Spray One player spray paints the LEDs On while the other is trying to paint them Off. They take turns with a limited supply of paint. Until one manages to have their paint color pervade all.

Joust Two Knights (Led blips) cross the display going in opposite directions. When the two come face to face they can try to knock each other off, in which case the first to do so wins a point. The first player to accumulate 3 points is acknowledged as the Winner.

Upside-Downside Land a ball in the indicated "target" spot to flip it Up(on) for player 1 or Down (0ff) for player2. The Player who manages to get all UP or Down, their way, Wins.


Group 3 ------ Spirited Fun

Whack a Mole For 30 seconds different 'moles' pop up 1,2 or 3 at a time. You must 'whack' them, one at a time. When done your score will be reflected on the display, one led for each 10 moles that were whacked.

Simon Says It plays like most any other 'Simon Says' game. Once the play gets to 4 or more a congratulations is sounded with each success.

Speed_Scan Hit a button when either the 5th or 6th LED is lit, to speed things up to a winning max. Don't miss. This is more challenging, engaging and ultimately more rewarding than one would expects.

Telekinesis LED indicator wanders via environmental sampling. Challenge yourself or others who believe they can or have telekinetic or predictive powers. Extra: a press toggles the next cell's steady state; whereas you can attempt to toggle them to an all on state.

PKE_Meter - psycho-kinetic scope Detecting Psychokinetic/ParaNormal/AbNormal Energy. In version option 1 the output of readings is Linear (you can re-calibrate the scale to environment at any time);  version 2 is Logarithmic 

Affinity_Meter Overall Temperament is reflected by the settled on LED at the end of a test period. Testee must be in contact with ADC_a & Ground. Bright/happy to the left – Sour/dull to the right. 

Fortune Teller You propose a question; You press a button; Ponder Your Request … let go. Answers: via 4 sets of colors Red: No, Yel: Maybe, Blue: Try again and Grn: Yes.

Use Btn2 for 1-6 (LED) Dice display, and Btn3 for a 1-8 Wheel of Fortune.


Group 4 ------ Show off your Skills

PlayThatTune A series of keyboard notes are played for you, which you are to play back.

React_Now Measures up how long it takes you to react to a sound & light trigger.

SeeIt_CatchIt When an LED lights, hit an associated button trying to get all 4 color LEDs lit, without having “un-lit” one. The # of attempts is scored. Then try the reverse without a fault. 

Balance Simulates a tilt-incline of randomly varying magnitude. You must compensate for that force in order to keep the ‘ball’ from rolling off either end.

Shuffleboard Land a puck on 8 "target" spots. If already occupied, both get knocked off the board. There is an additional board preceded by a long approach.

Memory There are 4 pairs of items (each a particular sound and illumination effect), Find where the matching item is for each. The total number of attempts is reported.

Note there are 3 version options: Illumination+Audio, Illumination Only, Audio Only.

Code Breaker Discover a 4 digit entry sequence code. After each attempt you’re given the number of correct buttons used and the # of correctly sequenced/positioned. Aka ‘MasterMind’.


Group 5 ------ Demos, Challenges, Activities and Applets

Support_Demo Demonstrates display and audio support functionality provided by: Mini_STEM_Platform.h as well as special for the included games. To make use of these effects for your own application refer to the code.

Illumination Challenge Setup each LED as 'dim', 'lit', 'bright', 'arc', 'glow' or off, to Recreate a given target pattern, with minimal referring to that desired pattern.

Random Art ~1D Game of Life, changing pattern of pixels (cells), With multiple rules for life cycle mutations. And automatic periodic alterations in the rules for reduced pattern replication. 

tuneLightOrgan Tool to form and try out future musical sequences as well as game sounds.

Sound Effects Collection of 18 various well known Riffs, Sirens and Sound Effects.

Timer Flashes Seconds; beeps every 10 secs and reflects Minutes. Plus stopwatch functionality.

Metronome Emulates a metronome. Mode selection: 1/4, 2/4, 3/4 or 4/4 time. Set the beat to anywhere in the range of 20-240 BPM.

readVoltages Reports voltage for a battery (or USB-Vcc volts), or one of two analog inputs to one decimal place 0.1 volts (via the LED display + audio)


Group 6 ------ Morse Code Practice & Exercises

MC Free Form   Free-form Morse code practice. It will adjust to your keying speed as you go.

A2Z_Morse_Exercise   This tests your ability to key in A thru Z in order. Refer to a Morse Code chart as needed. Characters, properly spaced, may be echoed. The number correct is scored.

Morse_AB_Exercise   Random characters are given and the user is expected to enter the code for the letter following it in the alphabet. The exercise is 12 characters long. Top score: 12 for 12.

MC_Relay_exercise  You write down the letters of a made up 'word' (3 characters) as you hear them. Then try to key them in (as if to relay or re-transmit). You can be re-prompt if desired. You are given the number you got correct after each set of 4 ‘words’, or 12 characters.

MC_Receive_Practice   Practice listening to and making out MC characters at your own pace. Once you feel you duplicated one ‘word’ you go on to the next. You can enable receiving several words at a time.

Tx Line test Practice Transmitting. Key in complete lines as seen on a serial Monitor screen. Each time you complete a line with no errors ~10 characters are added to the test lines. Your words/min. speed is reported after each line.


Extra Group "0" ------ Diagnostics Tools & Utilities

AButton - LED exercise & Reporting. Good for testing multi-button combinations.

An Exercise to test Color operations functionalities, vital to some games, and evaluate drive resistor values for use per LED color.

A Glow-BeepTest used to test Experimental sparkling 'arc' and cyclic 'glow' lighting+sound effects.

Step 5: Adjusting LED Brightness

If your mini STEM platform uses an LED module like the ones I pictured above, what you see is what you get for LED brightness and balance. However if, like our “I made it” user, you built your own with discrete LEDs and resistors, you can and likely need to optimize the resistor selection.

The game software uses LED brightness as key operational cues, therefore it is highly recommended to adjust the brightness and inter-LED color balance if you can.

With the Mega_Games sketch loaded, bring up “Support_Demo” (selection 5-1). Use button 1,2 & 3 to go from all LEDs dim to Lit to Bright. Select resistors for each color such that it is easy to tell ‘dim’ from ‘Lit’ from ‘Bright’, and at each brightness level all the colors look, as much as possible, equally illuminated. 

I find that when even a little over driven it is not sufficiently obvious telling ‘dim’ from ‘lit’ and/or ‘lit’ from ‘bright’. I recommend starting with 1k +/- 500 ohms for Red and adjust all the rest to it. There are no right values as the specific generation of LEDs used makes a huge difference. I guess this can be seen as a vote for using all one color LED.

Proper LED level adjustments, will significantly enhance the play-ability of the games and apps.

Anything Goes Contest 2021

Participated in the
Anything Goes Contest 2021