Introduction: Mini STEM LED Game Platform
This is an easy build of an Arduino driven LED bar display with four buttons and piezo audio out; which can easily be assembled by kids and beginners.
It is intended to be part of and a platform for STEM instruction. For those only needing sample code or wanting immediate utility, I have provided software downloads for a hardware/software interface support library (providing multiply LED brightness and sound levels) along with high level code for a half dozen games and activities.
This is a simple mini STEM (Science Technology Engineering and Math) project platform, which can be used as the basis for an educational STEM/maker class in elementary, summer camp or middle school. Let's not forget about home tutoring and those self taught. No soldering, hot iron or glue gun is needed.
In addition, it is very inexpensive, lending itself to use in a large class room setting.
I have also created a software development instructional, set of lessons, which utilizes this hardware platform. Given here: STEM-Game-Platform Lesson Plan Additionally (as of July 2020), used for the Morse Code Trainer.
Many may find that this platform is perfectly suited for a project they envisioned but have bulked at having to do all the wiring or write the low level hardware I/O support for it.
This build is also just a lot of fun for kids. As they love being able to make things themselves, as well as playing the accompanying LED games and mini apps. This micro-controller STEM/Game platform can be put together in less than an hour (given the header pins are already soldered on)
Unlike the more complex Arduino 12 LED-bar display gaming device, which it is somewhat akin to: instructables.com/id/Single-Line-LED-Display-Games. It is worth noting though, that games from it can be adapted for this platform. I did so for the “pingPong” game, included in the STEM_Platform_Games.ino sketch that is part of this project.
What allows for the construction of this to be especially easy is that of having worked out where the button and LED display modules could be directly lined up with pins of the Nano micro-controller module and still be operated as desired. The subsequent handling of the common button ground and the common LED +Voltage were very key.
Step 1: Parts and Supplies
Obtain the needed parts and supplies listed below.
- Nano V3.0 ATmega328P Micro-Controller
- 4 Keys Button Keypad Module for Arduino
- 8 LED Bar Marquee Display Module with 4 colors for Arduino
- 9mm dia. Piezoelectric Passive Buzzer Sounder
- 170pin mini solderless breadboard
All of these components can be found on eBay for very reasonable cost. Just use the text I have given in your eBay search. Although the delivery time will likely be 4-8 weeks.
Note that some of the button modules have the header pins pre-soldered on the wrong side of the PCB for direct use in this project.
Sundry pieces . . .
- A few inches of 22-24 ga. Solid jumper wire
- Small sheet of 1/16-1/8 inch thick balsa wood, craft ply-wood or construction board.
- Possibly solder and soldering supplies (for mounting header pins if needed)
- For programming: access to a micro-USB cable and computer.
- For mobile use: a small power-bank.
Step 2: Assembly
If you manage to get all of the first three main components with their header pins already soldered on, this project is otherwise done without any soldering. If some header pins are not already on and the intended maker is quite young or a student the soldering should be done for them in advance. Be sure that the headers are all on the desirable side of each module; on the bottom opposite of the components.
As and if needed, refer to: instructables.com/id/Solder-Arduino-Header-Pins-Easily
Notice that we are not going to use a box enclosure, for this project.
To create a more mechanically sound and sturdy final assembly, we split the prototype pin board and mounting on a substrate, underlying support layer (thin stiff sheet). This also gives us better access to more pins for potential later experimentation.
Cut the solderless breadboard in half.
Mount the Nano micro-controller module into the two pin-boards so it bridges them; starting two pins from the top. Leave revealed, as many pins as possible. See photo. Place this, micro controller + solderless breadboard, over a sheet of the chosen support material, outline it, then cut out this delineated section. Expose the sticky backs of the two sections of breadboard and press the whole assembly squarely on the 'wooden' piece.
On the breadboard with the Arduino Nano already inserted …
- Plug in a 1.75” wire connecting pin D13 to the top row of pins on the left side
- Plug in a 3.25” wire connecting the 5V pin to pin D10 (preferably a red wire)
- Insert the button module, with a pad beneath it (see photos for placement)
- Insert the LED bar display module
- Insert the piezoelectric sounder, noting that the + side goes in the top row & the other in the second
Noting the placement and alignment of components, in the photos above.
The button module interconnects to pins A1-A5 of the Nano micro-controller.
The Led bar pins interconnect to pins D2-D10 of the Nano micro-controller.
The piezo sounder (+ side) is connected to D13 via a wire and the other pin to D12.
Here is some detail information for greater understanding:
The Red wire, in the photos, provides +V to the common anodes at D10 (which will be set to Input mode, so as not to conflict).
The Blue wire is simply to route the Audio out at D13 over to the Piezo “speaker”.
No further wiring is used as the ground (-v) of the piezo and that of the button module are provided by the code driving the associated pins Low (at D12 & D15).
BTW: I added a small piece of electric tape over the power-on LED, as I found it distracting to the activity of the main LEDs. And when I am where &/or around others who are bothered by noise I place a piece of tape over the piezoelectric audio device.
Step 3: Testing
Here is an include 'library' file, Mini_STEM_Platform.h, containing a set of standard functions and public variables which provide support (rudimentary API) for the button inputs, LED display and audio outputs. This enables an easy development of Games and mini Apps.
Also there is HW_test.ino provided to facilitate HardWare wiring verification and functional testing of the mini STEM-Game platform.
Testing your Construction
Download the attached sketch HW_test.ino plus Mini_STEM_Platform.h. Using the Arduino IDE, compile and download to your unit.
For more information on this process see: https://www.arduino.cc/en/Guide/ArduinoNano#toc2
To verify that all the component placements and interconnects are correct, run the sketch software observing and doing as follows:
- As it initializes, you should see the LEDS scan left to right in a Dim manner, followed by moderately being lit, then brightly, then off.
- Three sounds will be given … “Boop … Beep … buZZ”
- Test each of the buttons; there should be a chirp on press and release. For each, while pressed, two corresponding LEDs will light. The first 2 LEDs light for button-1 and the following two for button-2 and so on. Multiple simultaneous button presses should simply combine their effects, without interference.
- If no buttons are pressed for more than 10 seconds a “Hello, don't forget about me” beep will sound.
- A log of the button states can be seen in the serial monitor window.
If all behaves as described your unit is assembled and functioning properly. Congratulations.
That's it. You're done and ready to put your device to use.
Step 4: Sample Application Software
STEM_Platform_Games.ino has been included as sample use of the platform and includes six example mini apps. It also utilizes an updated include library file as used above, so a copy of it must be located in the same sketch folder.
The included video gives a brief demo of this sample application software.
Overview of the Sample Software
Menu: Btn1: select Btn2: < move cursor Left Btn3: > Right
Demonstrates the provided LED display and audio support functions.
To make use of these effects for your own application refer to the code.
The goal is to hit a button when a moving blip is at either the 5th or 6th LED.
The speed increases and your progress is indicated as you go.
Measure your Reaction time, by attempting to hit a button when the first LED lights up. The first LED is for 0-100 milli-secs, additional LEDs lit for every 20 msecs more it takes.
You must attempt to hit the associated button when an LED lights up, within limited given amount of time. If successful the LED will toggle On or Off.
Fun individual challenge & great two-player competitive game; where the ball (single blip of light) goes from one side to the other, faster and faster, each time it gets 'hit' back.
Ask question, get divined response (Red: NO YEL: Maybe Grn: YES Blue: Try again)
Use btn2 for 1-6 ~ like dice, useful for determining one's fortune or options in games.
Full operational details are given in the attached manual: Platform_activity_manual.odt
This software is simply intended to stimulate your creative juices, and to go on and create your own applications and games. If you're not sure about how to effectively program for this device go through this set of software development training lessons (which is based on this device platform):
link to STEM Game platform Lesson Plan
Please share any games or interesting functionality you create utilizing this platform.
Last minute Note:
Some of the files have had an extra extension (of .txt) added to their file names, due to site upload errors "internal server error"; at the time this instructable was being created.
On Tinkercad you can play around with a simulated implementation. mini-STEP-platform Simulation
Step 5: Schematic and Simulation
For those who are interested, I have included a schematic and a link to a Tinkercad simulation.
Note that I had to use a different resister value in the simulation in order to get sufficient LED brightness.
Step 6: Alternate Construction Ideas
(update Jan 2020)
#1 Without cutting the breadboard in half
This can be done, but there won't be room enough to directly plug both of the leads of the piezo device in. You can see in photo #1 I have one lead hanging off the side, where I have a wire against it held by tension. This does let me slide the wire from underneath the lead to disable the sound. Other disadvantages are that LED and the key-button modules stick out more. This is especially an issue for the key module as it can rock back and forth under use, which may or may not become a problem with electrical connectivity.
#2 With an Enclosure and internal battery
I did one build with a small enclosure. The big issue was having access to the buttons, as well as good view of the LEDs. Putting holes through the case for buttons and lights would not work well with the modules. To not use the modules would be counter to the spirit of this project. So I cut slits in the top of the case to have the modules sit on the top with their pins going into the case. I also rotated each module 180 degrees to not stick out. Inside I reversed the wiring order for the module pins for short direct wiring. Currently the hardware support library file has commented out wiring assignment that will work for this configuration. I also packed in a LiPo battery, charging module and an On/Off switch. See the power wiring recommended in this Instructable: Dual-Power-for-Your-Portable-Micro-Controller-Proj
Disadvantages are that it is no longer 'fast and easy' to build, that of having many wires, and needing to use a soldering iron. Not in line with the main goals of this Instructable.
Step 7: Adding a Battery for Mobility
(update Feb. 2020)
I wanted to add battery operation without losing its simple compact nature. Well, where there's a will there's a way. Although, to do this does involve a little soldering.
I decided to fashion an implementation for mobile battery operation of this platform along with a charging component, that is minimal and consistent with not having an exoskeleton (aka: no container case) albeit a little hack-y. I used two diodes, a resister, and a slide switch that tuck away between the Arduino Nano board and the substrate wooden sheet base support. And I put a (3x40x40mm) battery, double sticky taped on the underside of the whole assembly. Wiring to the '5V' and 'GND' pins on the end of the Nano, as I did, is easier than going to the pins on the side (see second photo). Be careful not to let glue get inside the switch when gluing it in place.
The design relies on a Li-ion 3.7v battery (with a maximum of 4.2v). Refer to the schematic in the photo. When the switch is ON, the battery will supply voltage through a reverse voltage blocking diode (1N5817) having a very low 0.2 volt drop. Over a 3.2 – 4.2v usable range of the battery, 3.0 – 4.0 volts will be provided to the Arduino Nano.
When the Nano has power coming in the micro USB connector, it will supply 0.6v less than whats coming in to the '5V' pin. So given 5.0v in, the '5V' pin will be 4.4 volts. Given the battery is low, this in turn will supply a 3.8v (after the 0.6 volt drop of the 1N4001) for charging the battery. The battery can charge regardless of the on/off switch position. There is also a 2 ohm (I used 2.2) current limiting resister, which is only really there to reduce the stress on components during an initial spike in current occurring for a second or so when first starting to charge an exhausted battery. Typically this may only charge the battery to about half full. But there is still plenty capacity to provide hours of game play; and the battery's lifetime will be well extended over what it would have been if you charged to 100%.
NOTICE: USB adapters nominally supply 5.0v, at maximum they are allowed to be as high as 5.25v. I have many which are from 4.9v to 5.25v. I have one bad one from parts unknown with a 5.7 volt output. With a USB supply voltage that high the battery could get overcharged. This could cause failure of electronic components as well as the battery. The battery should actually not fail as it should have internal over-voltage (charge cutoff) circuitry; as do the ones I am using and provided a link to. None the less, Do Not use an out of spec USB adapter. You can test them with a USB voltage tester. I recommend up to 8 hours for charging, and not to leave it attached to USB power for more that 12 hours. I did test, with an already more than ½ full battery, charging for 12 hours with a 5.3v supply, and the battery went up to 4.15v (below the 4.2v max). Then I kept going for 4 more hours and saw no change in the battery voltage.
While I await the delivery of 3x40x40 mm batteries, I am using a '303040', slightly smaller, one. The larger one will fit perfectly on the bottom side of this device. Once I have it there I plan to finish things off by covering the sides and bottom with a strip of white duct tape.