Introduction: Logic Gate Game

This Digital Logic Gate Game was my final submission for the STEM Projects / EET-066 class I took at Lake Land College (LLC | Mattoon, IL) in the Spring of 2022; I called it "Name! That! Gate!"

Industrial Computer Programming was the primary focus of my Applied Engineering (AAS.MECH) studies at LLC and, in the last semester working towards that for my STEM Projects class, I wanted to create something that focused on Digital Logic (heavily emphasized in AAS.MECH at LLC) and also included as much of everything else I learned along the way: electrical circuitry & wiring, schematic drafting, microcontroller programming, and 3D modeling & printing.

"Name! That! Gate!" is built around the Raspberry Pi / RasPi Pico microcontroller and, as also stated in the included "userManual_nameThatGate" .pdf file which goes into further detail, it's a Logic Gate Game that tests player knowledge of Digital Logic Gates themselves. The objective is to determine what Digital Logic Gate is being used to create the state of an Output (Y) given the condition of the Inputs (A), (B), and/or (C) which are able to be toggled. There are x10 Digital Logic Gates to choose from - 2-Input: AND, NAND, NOR, OR, XOR, XNOR; 3-Input: AND, NAND, OR, NOR - and the representative Logic Levels are indicated by LEDs with either Red (low, off, 0) or Green (high, on, 1) lights. The Logic Gate Game goes through x10 stages where a random Logic Gate is loaded for each level, no same Logic Gate is encountered twice during a game cycle from Stage 1 - 10, Inputs ALWAYS start low at each stage, and you can either make a Logic Gate selection with the corresponding button or toggle an Input to see what effect it might have on the Output before you make your choice. Once a Logic Gate is selected, that stage ends and you move to the next. You start with 140pts possible at the beginning (Stage 1) but each input toggle costs 1pt and you're either rewarded all possible / remaining stage points (14pts p/ stage) if you select the correct Logic Gate or you lose all possible stage points if you make an incorrect Logic Gate selection. After all 10 stages, the Logic Gate Game ends & you're "graded" by your remaining points - oh, and there's fun "flavor text" per each grade bracket that's representative of respective LLC instructors who are a huge part of my success. :)

This STEM Project of mine was the product of my cumulative course studies at LLC and, as originally intended, was donated back to the Technology Division after completion; so, there's much about this Digital Logic Gate Game & Instructables project as a whole that assumes the knowledge regarding Logic Gates, and everything else contained, possessed by a user & potential builder is at least at the novice or intermediate level. I say this because I know I could have approached creating it differently to cater to beginning levels & documented things better primarily for a step-by-step build, but neither were a part of the initial goal and I was also very busy with other courses & significant life events at the time.

***Helpful Notes***

  1. Code:
  2. Python (Micropython specifically)
  3. Used "Thonny" Python IDE to write, edit, & upload code to RasPi Pico
  4. https://thonny.org/
  5. File type
  6. Supplied here as .txt files for simplicity; you should be able to "open with" / copy & paste into "Thonny" or any other Python IDE but MUST be saved as a .py file onto the RasPi Pico to work
  7. main
  8. W/ Comments: "main_wC"
  9. There's an ABSURD amount of comments due to me wanting to supply too much info VS. not enough to reference because this is the very code I saved to my project itself as a "just in case" if it's ever needed to be reviewed by students / staff at LLC
  10. W/o Comments: "main_noC"
  11. This was edited to remove the comments WITHOUT testing the functionality after; if you use this and it doesn't work right then I likely removed something important by accident & you may consider just using the version w/ comments, comparing the two side-by-side and fixing, etc.
  12. Either MUST be saved simply as "main.py" onto the RasPi Pico to work
  13. lcd_api | pico_i2c_lcd
  14. Both of these code files came from the "tom'sHARDWARE" website how-to article by Les Pounder titled "How to Use an I2C Display With Raspberry Pi Pico"
  15. https://www.tomshardware.com/how-to/lcd-display-raspberry-pi-pico
  16. MUST be saved as "lcd_api.py" & "pico_i2c_lcd.py" onto the RasPi Pico to work (unless editing the referenced names w/n all code files)
  17. Efficiency
  18. I personally wrote the "main" code and I'll be the first to tell you that by no means is it perfect or advanced level. I haven't had the most in-depth training for Python and a lot of what you see here was a slow process to finally get working; once it did I was simply just happy to have something functional that did what I set out for it to do and left it at that because time, or rather the lack thereof, became a factor.
  19. 3D Print:
  20. These are relatively large prints & overall object once assembled
  21. Descending order:
  22. "middle" - Main (red) structure containing RaspPi Pico, wiring, etc.
  23. "base" - Bottom (black) structure containing 9V battery
  24. "mount" - Covered top (red) structure used for mounting buttons & LEDs as well as the LCD display
  25. "cover" - Top cover (black) structure used for securing the LCD display & emblems / letters for function reference
  26. "plate" - Bottom cover (black) structure used for securing the 9V battery w/n the "base"
  27. The "middle" has (four) small Hex Nut indentations at the bottom b/c the end of the standoffs attached to the RasPi Pico had their respective nuts placed onto them then glued in place; there's also a pocket on one of the walls meant to house a specific "LLC branded" USB Flash Drive meant to stay housed there (secured w/ a rubber band) that I saved files on
  28. The (four) mounting holes on the main circuit board of LCD Display had to be incrementally drilled out to fit the respective posts modeled on the "mount"
  29. Push-Buttons were secured to the "mount" by putting through respective holes & using their included Nuts to keep in place as were designed; LEDs were just glued
  30. Matching holes were modeled in the mating portions of the "base" & "middle" for the wires of the 9V battery connector to be ran through
  31. The relief hole in the "base" meant to house & secure the Power Switch had to be (rather forcefully) modified post-print b/c I modeled it too small
  32. The "plate" was secured to the "base" w/ (two) 6 x 1/2" Wood Screws
  33. Once all assembled, everything is "sandwiched" together w/ (four) 1/4" x 5" Hex Bolts, Washers, & Nuts
  34. The Nuts are held in place by complimentary holes in the "base" but if I did this over again I would have modeled these to a tighter spec. / devised a different solution because it didn't take long for the Nuts to start "slipping" w/n their holes after assembling & disassembling a few times

I hope everything contained here will provide every reader & builder with enough to enjoy this Logic Gate Game project as much as I did; I'll try to keep tabs on this Instructables project often in order to make any popularly requested / needed changes.

Thank you for your time & interest!

Supplies

  1. x1 Raspberry Pi Pico
  2. https://www.raspberrypi.com/products/raspberry-pi-pico/
  3. x1 Large 3D Printer (such as the Monoprice MP10 300x300mm used at LLC)
  4. https://www.monoprice.com/product?p_id=34437
  5. x1 Soldering Iron (similar to the Weller one I used at LLC)
  6. https://www.amazon.com/SOLDER-STATION-40W-120V-ST3/dp/B000AS28UC/ref=sr_1_1?keywords=Soldering%2BIron&qid=1672175600&refinements=p_89%3AWeller&rnid=2528832011&s=hi&sr=1-1&th=1
  7. x1 Superglue
  8. https://www.amazon.com/Anticlog-Adhesive-superglue-Cyanoacrylate-Plastics/dp/B0BCL2KT5Y/ref=sr_1_9?keywords=superglue&qid=1672177801&sr=8-9&th=1
  9. x1 Gaffer Tape
  10. https://www.amazon.com/Bates-Gaffers-Gaffing-Gaffer-Electrical/dp/B08LZPHHR1/ref=sr_1_6?keywords=gaffer+tape&qid=1672178042&sr=8-6
  11. x1 Protoboard - 7x9cm
  12. https://www.amazon.com/LampVPath-Prototype-Breadboard-Universal-Printed/dp/B07Y3NYX9C/ref=sr_1_10?crid=1O4Q78M012WM8&keywords=protoboard%2B7x9&qid=1672175844&sprefix=protoboard%2B7x9%2Caps%2C137&sr=8-10&th=1
  13. x4 Standoffs & Nuts - Nylon
  14. https://www.amazon.com/LitOrange-Standoff-Threaded-Motherboard-Assortment/dp/B07TP2YYQB/ref=sr_1_3?crid=3BW4N3UHOQPF&keywords=standoffs%2Bnylon&qid=1672175927&sprefix=standoffs%2Bnylo%2Caps%2C276&sr=8-3&th=1
  15. x4 Pin Headers (female) - 1x10
  16. https://www.amazon.com/Glarks-Straight-Connector-Assortment-Prototype/dp/B076GZXW3Z/ref=sr_1_3?keywords=pin+headers+female&qid=1672176000&sprefix=pin+headers%2Caps%2C157&sr=8-3
  17. x44 Pin Connector Jumper Wires (male) - 1x1 (referred to these as "Pin Connectors" in Manual)
  18. https://www.amazon.com/Breadboard-20-More-Red-Black-Jumpers-120-Pack-Hellotronics/dp/B08QFQCVKN/ref=sr_1_6?keywords=breadboard%2Bjumper%2Bwires&qid=1672177549&s=electronics&sprefix=breadboard%2Bjumper%2Celectronics%2C147&sr=1-6&th=1
  19. x1 Power Supply - 9 -> 5V
  20. https://www.amazon.com/CorpCo-Breadboard-Supply-Arduino-Solderless/dp/B00ZO9YB1G/ref=sr_1_4?crid=3KGPBQN2ZXYU0&keywords=power+supply+ywrobot&qid=1672176165&sprefix=powersupply+ywrobot%2Caps%2C175&sr=8-4
  21. x1 Connector (male) - Barrel Plug (Power Supply)
  22. https://www.amazon.com/Pigtail-Female-Connectors-Security-Adapter/dp/B07C7VSRBG/ref=sr_1_7?crid=1S09VU2Q5UCBU&keywords=barrel+plug+connector&qid=1672176435&sprefix=barrel+plug+connector%2Caps%2C147&sr=8-7
  23. x1 Battery - 9V
  24. https://www.amazon.com/AmazonBasics-Volt-Everyday-Alkaline-Battery/dp/B081FGCRQQ/ref=sr_1_4?crid=27NCA8IOJUKBN&keywords=battery+9v&qid=1672176238&sprefix=battery+9v%2Caps%2C156&sr=8-4
  25. x1 Connector - 9V (Battery)
  26. https://www.amazon.com/LAMPVPATH-Battery-Connector-Plastic-Housing/dp/B07D6RNJVR/ref=sr_1_3?keywords=9v+battery+connector&qid=1672176314&sprefix=9v+battery+connect%2Caps%2C149&sr=8-3
  27. x1 Power Switch (rectangular)
  28. https://www.amazon.com/Twidec-Pre-soldered-Wires%EF%BC%88Quality-Assurance-Years%EF%BC%89KCD1-3-101-X/dp/B07SPY9H7Y/ref=sr_1_33?crid=7P44F040FMSG&keywords=power+switch&qid=1672176537&sprefix=power+switch%2Caps%2C156&sr=8-33
  29. x1 Display - I2C Serial Interface HD44780 LCD
  30. https://www.amazon.com/HiLetgo-HD44780-I2C1602-Interface-Backlight/dp/B07W5KC65S/ref=sr_1_3?crid=16FGLNXW7X5N8&keywords=i2c+HD44780&qid=1672176700&sprefix=i2c+hd44780%2Caps%2C143&sr=8-3
  31. x4 LEDs - Common Cathode Multicolor RGB
  32. https://www.amazon.com/Tricolor-Multicolor-Lighting-Electronics-Components/dp/B01C19ENDM/ref=sr_1_3?crid=36CD1JMHLF8JA&keywords=Common+Cathode+Multicolor+RGB&qid=1672176823&sprefix=common+cathode+multicolor+rgb%2Caps%2C134&sr=8-3
  33. x4 Resistors - 220 Ohm
  34. https://www.amazon.com/Projects-100EP514220R-220-Resistors-Pack/dp/B0185FGNWK/ref=sr_1_3?keywords=resistor+220+ohm&qid=1672177010&sprefix=resistor+220%2Caps%2C169&sr=8-3
  35. x14 Push Buttons - Normally Open
  36. https://www.amazon.com/Twidec-Normal-Momentary-Pre-soldered-PBS-110-XBK/dp/B07RTZVZ6L/ref=sr_1_3?crid=C24YL4C4U3VE&keywords=push%2Bbutton&qid=1672177052&sprefix=push%2Bbutton%2Caps%2C169&sr=8-3&th=1
  37. x4 "Bumpers" (Scotch)
  38. https://www.amazon.com/Scotch-Bumpers-Pack-Clear-SP950-NA/dp/B01N922DLO/ref=sr_1_2?crid=29H35ZE2KQUPI&keywords=scotch%2Bbumpers&qid=1672178419&refinements=p_89%3AScotch&rnid=2528832011&s=hi&sprefix=scotch%2Bbumpers%2Caps%2C112&sr=1-2&th=1
  39. x4 Hex Bolts, Nuts, & Washers - 1/4" x 5"
  40. x2 Wood Screws - 6 x 1/2"
  41. Miscellaneous - 3D print filament, solder, wiring, etc.

Step 1: 3D Print

Start 3D Printing

  • These are large, time-consuming prints and, as anyone who's already somewhat experienced in 3D Printing will know, they don't always go according to plan

Step 2: Solder

Solder all the electrical components together were needed

  • Reference the (above) Introduction, pictures, & supplied schematics

Step 3: Assemble

Once 3D Prints have finished & all electrical components are soldered, put it all together

  • This is where the superglue, bolts, & screws come into action

Step 4: Spite Creator

Like I said in the introduction, this project could have been documented differently specifically for a step-by-step guide but it was a class project of mine I put together rather quickly just to keep my head afloat in the class, and others, to graduate upon completion. My apologies if frustrating :(

Step 5: Play "Name! That! Gate!"

Enjoy your very own Digital Logic Gate Game!