<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://socialledge.com/sjsu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Proj+user7</id>
		<title>Embedded Systems Learning Academy - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://socialledge.com/sjsu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Proj+user7"/>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php/Special:Contributions/Proj_user7"/>
		<updated>2026-05-06T06:48:41Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66977</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66977"/>
				<updated>2021-12-18T08:08:00Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Game Task boundry diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Super mario.JPG|right|400px|thumb|MARIO GAME]]&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version 'Ace Mario' of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|&lt;br /&gt;
[https://www.linkedin.com/in/shreevats-gadhikar-56b523149/ Shreevats Gadhikar]&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram : ===&lt;br /&gt;
Game logic gets triggered whenever a user selects the switch button on Joystick. The whole game flow is bounded by two essential conditions which are available time span and Lives. The user is supposed to finish the victory path by avoiding all the hurdles in his path.&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|300px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
=== Game Task boundry diagram : ===&lt;br /&gt;
Task creation and managing tasks bandwidth was a crucial part of this project.&lt;br /&gt;
Update display is the core heart of display driver which does refreshing of LED screen matrix at a refresh rate of around 400 Hz.&lt;br /&gt;
Other tasks are of low priority which deals with various functionalities such as managing screen rotation, receiving Bluetooth data.&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch over to the Game background screen&lt;br /&gt;
&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If Mario position collides with the Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from the beginning&lt;br /&gt;
 If traversal pixel coordinate reaches victory coordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is a fantastic resource for planning out levels, background, and designing characters of the game . Images drawn using mtPaint can be converted into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Project Learnings ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Creating various Mario and Background images using MT-paint and Python scripts helped us in achieving better Graphics precision.&lt;br /&gt;
*Creating immersive Background graphics when Mario is traversing through the green bushes .&lt;br /&gt;
*Establishing board to board communication via Bluetooth module and optimizing the response time between the Matrix controller and joystick.&lt;br /&gt;
*Concepts of FreeRTOS , Communication using UART and basic learning helped us .&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== Graphics development ===&lt;br /&gt;
* Creating a motion effect for Mario traversal was a big challenge and the visual effect of  Jump and Walk&lt;br /&gt;
Another trouble was running collision detection when Mario is not moving from his fixed position&lt;br /&gt;
*Came up with a solution of having whole display UI as a single matrix and traversing it as per Jump or forward movement.&lt;br /&gt;
Same position Jump and screen traversal should happen at the same time.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66976</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66976"/>
				<updated>2021-12-18T08:07:51Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Game work Flow Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Super mario.JPG|right|400px|thumb|MARIO GAME]]&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version 'Ace Mario' of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|&lt;br /&gt;
[https://www.linkedin.com/in/shreevats-gadhikar-56b523149/ Shreevats Gadhikar]&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram : ===&lt;br /&gt;
Game logic gets triggered whenever a user selects the switch button on Joystick. The whole game flow is bounded by two essential conditions which are available time span and Lives. The user is supposed to finish the victory path by avoiding all the hurdles in his path.&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|300px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
=== Game Task boundry diagram ===&lt;br /&gt;
Task creation and managing tasks bandwidth was a crucial part of this project.&lt;br /&gt;
Update display is the core heart of display driver which does refreshing of LED screen matrix at a refresh rate of around 400 Hz.&lt;br /&gt;
Other tasks are of low priority which deals with various functionalities such as managing screen rotation, receiving Bluetooth data.&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch over to the Game background screen&lt;br /&gt;
&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If Mario position collides with the Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from the beginning&lt;br /&gt;
 If traversal pixel coordinate reaches victory coordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is a fantastic resource for planning out levels, background, and designing characters of the game . Images drawn using mtPaint can be converted into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Project Learnings ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Creating various Mario and Background images using MT-paint and Python scripts helped us in achieving better Graphics precision.&lt;br /&gt;
*Creating immersive Background graphics when Mario is traversing through the green bushes .&lt;br /&gt;
*Establishing board to board communication via Bluetooth module and optimizing the response time between the Matrix controller and joystick.&lt;br /&gt;
*Concepts of FreeRTOS , Communication using UART and basic learning helped us .&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== Graphics development ===&lt;br /&gt;
* Creating a motion effect for Mario traversal was a big challenge and the visual effect of  Jump and Walk&lt;br /&gt;
Another trouble was running collision detection when Mario is not moving from his fixed position&lt;br /&gt;
*Came up with a solution of having whole display UI as a single matrix and traversing it as per Jump or forward movement.&lt;br /&gt;
Same position Jump and screen traversal should happen at the same time.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66975</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66975"/>
				<updated>2021-12-18T08:07:28Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Game work Flow Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Super mario.JPG|right|400px|thumb|MARIO GAME]]&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version 'Ace Mario' of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|&lt;br /&gt;
[https://www.linkedin.com/in/shreevats-gadhikar-56b523149/ Shreevats Gadhikar]&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Game logic gets triggered whenever a user selects the switch button on Joystick. The whole game flow is bounded by two essential conditions which are available time span and Lives. The user is supposed to finish the victory path by avoiding all the hurdles in his path.&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|300px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
=== Game Task boundry diagram ===&lt;br /&gt;
Task creation and managing tasks bandwidth was a crucial part of this project.&lt;br /&gt;
Update display is the core heart of display driver which does refreshing of LED screen matrix at a refresh rate of around 400 Hz.&lt;br /&gt;
Other tasks are of low priority which deals with various functionalities such as managing screen rotation, receiving Bluetooth data.&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch over to the Game background screen&lt;br /&gt;
&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If Mario position collides with the Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from the beginning&lt;br /&gt;
 If traversal pixel coordinate reaches victory coordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is a fantastic resource for planning out levels, background, and designing characters of the game . Images drawn using mtPaint can be converted into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Project Learnings ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Creating various Mario and Background images using MT-paint and Python scripts helped us in achieving better Graphics precision.&lt;br /&gt;
*Creating immersive Background graphics when Mario is traversing through the green bushes .&lt;br /&gt;
*Establishing board to board communication via Bluetooth module and optimizing the response time between the Matrix controller and joystick.&lt;br /&gt;
*Concepts of FreeRTOS , Communication using UART and basic learning helped us .&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== Graphics development ===&lt;br /&gt;
* Creating a motion effect for Mario traversal was a big challenge and the visual effect of  Jump and Walk&lt;br /&gt;
Another trouble was running collision detection when Mario is not moving from his fixed position&lt;br /&gt;
*Came up with a solution of having whole display UI as a single matrix and traversing it as per Jump or forward movement.&lt;br /&gt;
Same position Jump and screen traversal should happen at the same time.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66965</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66965"/>
				<updated>2021-12-18T08:00:09Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Game Graphics Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version called ==Ace Mario== of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies the victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|&lt;br /&gt;
[https://www.linkedin.com/in/shreevats-gadhikar-56b523149/ Shreevats Gadhikar]&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Game logic gets triggered whenever a user selects the switch button on Joystick. The whole game flow is bounded by two essential conditions which are available time span and Lives. The user is supposed to finish the victory path by avoiding all the hurdles in his path.&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|500px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Task creation and managing tasks bandwidth was a crucial part of this project.&lt;br /&gt;
Update display is the core heart of display driver which does refreshing of LED screen matrix at a refresh rate of around 400 Hz.&lt;br /&gt;
Other tasks are of low priority which deals with various functionalities such as managing screen rotation, receiving Bluetooth data.&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch over to the Game background screen&lt;br /&gt;
&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If Mario position collides with the Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from the beginning&lt;br /&gt;
 If traversal pixel coordinate reaches victory coordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is a fantastic resource for planning out levels, background, and designing characters of the game . Images drawn using mtPaint can be converted into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Project Learnings ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Creating various Mario and Background images using MT-paint and Python scripts helped us in achieving better Graphics precision.&lt;br /&gt;
*Creating immersive Background graphics when Mario is traversing through the green bushes .&lt;br /&gt;
*Establishing board to board communication via Bluetooth module and optimizing the response time between the Matrix controller and joystick.&lt;br /&gt;
*Concepts of FreeRTOS , Communication using UART and basic learning helped us .&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== Graphics development ===&lt;br /&gt;
* Creating a motion effect for Mario traversal was a big challenge and the visual effect of  Jump and Walk&lt;br /&gt;
Another trouble was running collision detection when Mario is not moving from his fixed position&lt;br /&gt;
*Came up with a solution of having whole display UI as a single matrix and traversing it as per Jump or forward movement.&lt;br /&gt;
Same position Jump and screen traversal should happen at the same time.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66964</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66964"/>
				<updated>2021-12-18T07:59:21Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Testing &amp;amp; Technical Challenges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version called ==Ace Mario== of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies the victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|&lt;br /&gt;
[https://www.linkedin.com/in/shreevats-gadhikar-56b523149/ Shreevats Gadhikar]&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Game logic gets triggered whenever a user selects the switch button on Joystick. The whole game flow is bounded by two essential conditions which are available time span and Lives. The user is supposed to finish the victory path by avoiding all the hurdles in his path.&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|500px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Task creation and managing tasks bandwidth was a crucial part of this project.&lt;br /&gt;
Update display is the core heart of display driver which does refreshing of LED screen matrix at a refresh rate of around 400 Hz.&lt;br /&gt;
Other tasks are of low priority which deals with various functionalities such as managing screen rotation, receiving Bluetooth data.&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch over to the Game background screen&lt;br /&gt;
&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If Mario position collides with the Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from the beginning&lt;br /&gt;
 If traversal pixel coordinate reaches victory coordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is fantastic resource for planning out levels ,background and designing characters of game .Images drawn using mtPaint can be convert into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Project Learnings ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Creating various Mario and Background images using MT-paint and Python scripts helped us in achieving better Graphics precision.&lt;br /&gt;
*Creating immersive Background graphics when Mario is traversing through the green bushes .&lt;br /&gt;
*Establishing board to board communication via Bluetooth module and optimizing the response time between the Matrix controller and joystick.&lt;br /&gt;
*Concepts of FreeRTOS , Communication using UART and basic learning helped us .&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== Graphics development ===&lt;br /&gt;
* Creating a motion effect for Mario traversal was a big challenge and the visual effect of  Jump and Walk&lt;br /&gt;
Another trouble was running collision detection when Mario is not moving from his fixed position&lt;br /&gt;
*Came up with a solution of having whole display UI as a single matrix and traversing it as per Jump or forward movement.&lt;br /&gt;
Same position Jump and screen traversal should happen at the same time.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66961</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66961"/>
				<updated>2021-12-18T07:58:18Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Graphics development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version called ==Ace Mario== of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies the victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|&lt;br /&gt;
[https://www.linkedin.com/in/shreevats-gadhikar-56b523149/ Shreevats Gadhikar]&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Game logic gets triggered whenever a user selects the switch button on Joystick. The whole game flow is bounded by two essential conditions which are available time span and Lives. The user is supposed to finish the victory path by avoiding all the hurdles in his path.&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|500px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Task creation and managing tasks bandwidth was a crucial part of this project.&lt;br /&gt;
Update display is the core heart of display driver which does refreshing of LED screen matrix at a refresh rate of around 400 Hz.&lt;br /&gt;
Other tasks are of low priority which deals with various functionalities such as managing screen rotation, receiving Bluetooth data.&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch over to the Game background screen&lt;br /&gt;
&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If Mario position collides with the Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from the beginning&lt;br /&gt;
 If traversal pixel coordinate reaches victory coordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is fantastic resource for planning out levels ,background and designing characters of game .Images drawn using mtPaint can be convert into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== Graphics development ===&lt;br /&gt;
* Creating a motion effect for Mario traversal was a big challenge and the visual effect of  Jump and Walk&lt;br /&gt;
Another trouble was running collision detection when Mario is not moving from his fixed position&lt;br /&gt;
*Came up with a solution of having whole display UI as a single matrix and traversing it as per Jump or forward movement.&lt;br /&gt;
Same position Jump and screen traversal should happen at the same time.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66960</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66960"/>
				<updated>2021-12-18T07:58:00Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Testing &amp;amp; Technical Challenges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version called ==Ace Mario== of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies the victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|&lt;br /&gt;
[https://www.linkedin.com/in/shreevats-gadhikar-56b523149/ Shreevats Gadhikar]&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Game logic gets triggered whenever a user selects the switch button on Joystick. The whole game flow is bounded by two essential conditions which are available time span and Lives. The user is supposed to finish the victory path by avoiding all the hurdles in his path.&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|500px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Task creation and managing tasks bandwidth was a crucial part of this project.&lt;br /&gt;
Update display is the core heart of display driver which does refreshing of LED screen matrix at a refresh rate of around 400 Hz.&lt;br /&gt;
Other tasks are of low priority which deals with various functionalities such as managing screen rotation, receiving Bluetooth data.&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch over to the Game background screen&lt;br /&gt;
&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If Mario position collides with the Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from the beginning&lt;br /&gt;
 If traversal pixel coordinate reaches victory coordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is fantastic resource for planning out levels ,background and designing characters of game .Images drawn using mtPaint can be convert into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== Graphics development ===&lt;br /&gt;
* Creating a motion effect for Mario traversal was a big challenge and the visual effect of  Jump and Walk&lt;br /&gt;
Another trouble was running collision detection when Mario is not moving from his fixed position&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Came up with a solution of having whole display UI as a single matrix and traversing it as per Jump or forward movement.&lt;br /&gt;
Same position Jump and screen traversal should happen at the same time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66959</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66959"/>
				<updated>2021-12-18T07:56:15Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* LED Matrix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version called ==Ace Mario== of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies the victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|&lt;br /&gt;
[https://www.linkedin.com/in/shreevats-gadhikar-56b523149/ Shreevats Gadhikar]&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Game logic gets triggered whenever a user selects the switch button on Joystick. The whole game flow is bounded by two essential conditions which are available time span and Lives. The user is supposed to finish the victory path by avoiding all the hurdles in his path.&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|500px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
=== Game work Flow Diagram ===&lt;br /&gt;
Task creation and managing tasks bandwidth was a crucial part of this project.&lt;br /&gt;
Update display is the core heart of display driver which does refreshing of LED screen matrix at a refresh rate of around 400 Hz.&lt;br /&gt;
Other tasks are of low priority which deals with various functionalities such as managing screen rotation, receiving Bluetooth data.&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch over to the Game background screen&lt;br /&gt;
&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If Mario position collides with the Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from the beginning&lt;br /&gt;
 If traversal pixel coordinate reaches victory coordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is fantastic resource for planning out levels ,background and designing characters of game .Images drawn using mtPaint can be convert into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66957</id>
		<title>F21: ACE MARIO</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F21:_ACE_MARIO&amp;diff=66957"/>
				<updated>2021-12-18T07:45:27Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[File:13.jpg|right|500px|thumb|ACE MARIO GAME]]&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Super Mario is one of the best-selling games of all time, with more than 50 million copies sold worldwide. Our goal will be to produce a similar version called ==Ace Mario== of it where the player controls Mario's movements. Mario has to race through hardships in form of obstacles and reach the mushroom kingdom which signifies the victory.&lt;br /&gt;
&lt;br /&gt;
=== Objectives &amp;amp; Introduction ===&lt;br /&gt;
&lt;br /&gt;
The main objective of this project was to create a Mario video game displayed on an RGB LED matrix. We used two SJ2 boards. One for graphics processing and, the other SJ2 board was used as a gamepad controller, which controller the graphics board and sends data to the LED matrix board.&lt;br /&gt;
Other objectives are as follows:&lt;br /&gt;
&lt;br /&gt;
* Use the FreeRTOS Real-Time operating system on both the SJ2 boards.&lt;br /&gt;
* Interface the 64*64 RGB LED Matrix and MP3 decoder on one of the SJ2 boards.&lt;br /&gt;
* Interface Joystick, vibration sensor, Bluetooth on the other SJ2 board.&lt;br /&gt;
* Establish wireless communication between these two nodes using Bluetooth. &lt;br /&gt;
* Create and display characters on the LED matrix. &lt;br /&gt;
* Create different sound effects at different functions of the game.&lt;br /&gt;
* Create multiple display screens at different stages of the game.&lt;br /&gt;
* Integrate all the modules and develop smooth game logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to Play ACE MARIO'''&lt;br /&gt;
&lt;br /&gt;
The goal of the game is to descend forward in the right direction avoiding obstacles in the form of potholes and piranha plants and reach the Mushroom Kingdom which signifies the victory of the game. &lt;br /&gt;
&lt;br /&gt;
*Using the joystick on the gamepad controller, we can control the movements of our Mario.&lt;br /&gt;
*  a)To start the game press the joystick at the top.&lt;br /&gt;
*  b)Mario can jump when the joystick is pressed in the upward direction and accordingly can ascend forward when pressed towards your right direction. &lt;br /&gt;
*As Mario ascends in the screen, the next background screen keeps appearing and we have to traverse until the game ends or we reach the mushroom kingdom. &lt;br /&gt;
*Avoid all the obstacles while ascending, by jumping over them.&lt;br /&gt;
*The entire game is time-based and lives-based i.e you need to reach the mushroom kingdom within the time span and you will be given 3 lives(heart-shaped).&lt;br /&gt;
*Last few seconds on your time span will be indicated by red battery lines, otherwise it will be green in color and is continuously diminishing the green lines as the game ascend.&lt;br /&gt;
*Failure to avoid obstacles as indicated by the game restart screen reduces your lives one by one. Hence, you will have only 3 chances to stay in the game with the usage of lives. Consequently, once you land on any obstacles and you have no lives left, the game ends.&lt;br /&gt;
*Having understand above, it's time to unleash the Ace Mario game now. Good Luck!&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Team Members &amp;amp; Responsibilities ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt; '''Name''' &amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;background:#588ecc;&amp;quot;|&amp;lt;span style=&amp;quot;color:#FFFFFF&amp;quot;&amp;gt; &amp;lt;font size=3&amp;gt;  '''Roles / Responsibilities'''&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;|  &lt;br /&gt;
[https://www.linkedin.com/in/tapkirvivek/ Vivek Tapkir]&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Collision Detection&lt;br /&gt;
*Game state handling&lt;br /&gt;
*LED Matrix Driver&lt;br /&gt;
*Game animation implementation&lt;br /&gt;
*Software and Hardware Integration&lt;br /&gt;
*Bug fixes and performance improvement&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Shreevats Gadhikar&lt;br /&gt;
|&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Bluetooth and Joystick Driver &lt;br /&gt;
*Hardware Integration&lt;br /&gt;
*PCB Design&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| Daya Modekar&lt;br /&gt;
|&lt;br /&gt;
*MP3 Decoder Driver&lt;br /&gt;
*Game Logic Development&lt;br /&gt;
*Graphics Driver&lt;br /&gt;
*Hardware Integration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schedule ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/15/2021&lt;br /&gt;
|&lt;br /&gt;
* 10/25/2021&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group members.&lt;br /&gt;
* Decide on 2 game ideas and submit Project Proposal assignment&lt;br /&gt;
* Discussion on using wireless or wired controllers,3D printing options,PCB softwares and manufacturer.&lt;br /&gt;
* Finalize parts list&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
* Decide on day/time for weekly meetings&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/25/2021  &lt;br /&gt;
| &lt;br /&gt;
*11/03/2021&lt;br /&gt;
| &lt;br /&gt;
*Choose game based on Preet's Project Proposal feedback&lt;br /&gt;
*Finish schedule rough draft and upload to Wiki report&lt;br /&gt;
*Order project parts&lt;br /&gt;
*Break project up into tasks and assign project tasks to team members&lt;br /&gt;
*Obtain datasheets for all parts and upload to team Google Drive folder&lt;br /&gt;
*Brainstorm gameplay, rules, and level design on paper&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
* 11/04/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/08/2020&lt;br /&gt;
|&lt;br /&gt;
* Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
* Read datasheets and conduct research for driver writing&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Test all parts to ensure proper functionality&lt;br /&gt;
* LED matrix can light a pixel(s) at specified locations.&lt;br /&gt;
* Finalize gameplay, rules, and level design on paper&lt;br /&gt;
* Start Developing graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Begin developing MP3 decoder board driver&lt;br /&gt;
* Begin designing PCB in EasyEDA software&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
*11/09/2021&lt;br /&gt;
|&lt;br /&gt;
*11/15/2021&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Begin developing Bluetooth board driver&lt;br /&gt;
* LED matrix can display our game character and obstacles&lt;br /&gt;
* MP3 decoder can play/pause, jump to next/previous song, and increase/decrease volume&lt;br /&gt;
* Bluetooth modules can send controls data back and forth between gamepad board and master board&lt;br /&gt;
* Controls data can be accessed using &amp;quot;get&amp;quot; and &amp;quot;set&amp;quot; API&lt;br /&gt;
* Gamepad controller can read joystick and accelerometer values and detect switch presses&lt;br /&gt;
* Decide how to handle each collision detection case (character/enemy, obstacles/enemy, etc.)&lt;br /&gt;
* Finish enclosure design in AutoCAD software and start printing&lt;br /&gt;
* Finalize PCB design on paper and design in PCB software&lt;br /&gt;
* LED matrix displays character orientation correctly depending on current movement direction&lt;br /&gt;
* Controller input (joystick or accelerometer) option is implemented on a gamepad controller&lt;br /&gt;
* Finalize PCB design in software and order PCB&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/16/2021 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2021&lt;br /&gt;
|&lt;br /&gt;
*LED matrix menu screens and game over/victory screens are implemented on matrix&lt;br /&gt;
*Volume controls and controller input select in the options menu are implemented&lt;br /&gt;
*Integrate circuitry with 3D printed enclosure&lt;br /&gt;
*PCB arrives, conduct PCB testing to ensure proper connections&lt;br /&gt;
*Solder PCB and integrate with existing project circuitry&lt;br /&gt;
*LED matrix can scroll to next screen when the character reaches the bottom of the current screen&lt;br /&gt;
*Finalize MP3 track selection for each screen and during gameplay&lt;br /&gt;
*Collision detection logic is fully functional and displays correctly on the LED matrix&lt;br /&gt;
* Testing and debugging the game logic&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2021&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2021&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Write gameplay logic code on the master controller. Gameplay logic should update the score and status bar items correctly&lt;br /&gt;
* LED matrix graphics design for all levels is complete&lt;br /&gt;
* MP3 decoder plays correct song/track during gameplay and for each menu/game over screen&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2021&lt;br /&gt;
|&lt;br /&gt;
* Sub-system Integration&lt;br /&gt;
* Finish rough draft of project report&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2021&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2021&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
*12/14/2021&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Finalize project report and submit&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parts List &amp;amp; Cost ==&lt;br /&gt;
=== General Parts ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item #&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Qty&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 64x64 RGB LED Matrix&lt;br /&gt;
| [https://www.adafruit.com/product/3649 Adafruit] &lt;br /&gt;
| 1&lt;br /&gt;
| $54.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| SJ-2 Boards&lt;br /&gt;
| [https://www.amazon.com/Generic-SJTwo-SJ2-SJSU/dp/B08G9LRPZ8/ref=sr_1_4?dchild=1&amp;amp;keywords=sjsu+sj2+board&amp;amp;qid=1603064585&amp;amp;sr=8-4 SJSU] &lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| HC-05 Bluetooth Boards&lt;br /&gt;
| [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=sr_1_4?crid=1MTXACDA8RETK&amp;amp;keywords=hc-05&amp;amp;qid=1638426167&amp;amp;s=electronics&amp;amp;sprefix=HC-%2Celectronics%2C229&amp;amp;sr=1-4 Amazon]&lt;br /&gt;
| 2&lt;br /&gt;
| $20.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3 Decoder/Player Board&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D/ref=pd_sbs_1/140-3882465-6958023?pd_rd_w=zUdnA&amp;amp;pf_rd_p=690958f6-2825-419e-9c16-73ffd4055b65&amp;amp;pf_rd_r=6BQ384Y1GEKJ2HZQY723&amp;amp;pd_rd_r=61e015e0-d89a-47c1-9eaa-9a99f656ae36&amp;amp;pd_rd_wg=TuDjr&amp;amp;pd_rd_i=B0725RHR4D&amp;amp;psc=1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $6.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Joystick&lt;br /&gt;
| [https://www.amazon.com/HiLetgo-Controller-JoyStick-Breakout-Arduino/dp/B00P7QBGD2/ref=sr_1_1?keywords=Hiletgo+joystick&amp;amp;qid=1638426386&amp;amp;sr=8-1 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $4.89&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| Power Supply for LED Matrix (5V 5A)&lt;br /&gt;
| [https://www.amazon.com/ZOZO-Regulated-Switching-Replacement-Electronics/dp/B015PXUHYA/ref=sr_1_6?crid=1EJ10CN64YWS3&amp;amp;keywords=power+adapter&amp;amp;qid=1638426501&amp;amp;sprefix=power+adapt%2Caps%2C254&amp;amp;sr=8-6 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $15.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| JBL Speakers&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| Audio Jack Cable&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| MicroSD Card &amp;amp; Adapter&lt;br /&gt;
| already had&lt;br /&gt;
| 1&lt;br /&gt;
| $0&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| Vibration Sensor&lt;br /&gt;
| [https://www.amazon.com/dp/B07PVC7D5T/ref=cm_sw_r_apan_glt_fabc_P6A00CDDJ84Y6CBBSGG0 Amazon]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.99&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Design &amp;amp; Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Integration Design ===&lt;br /&gt;
&lt;br /&gt;
For our project, we choose EasyEDA online software for designing the PCB. EasyEDA is completely free to use and all the footprints are easily available online. Also, EasyEDA has a feature of auto-routing which is very useful. The most important thing about EasyEDA is its ability to create a PCB from schematics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:LED Board.png|center|800px|thumb|LED Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad board.png|center|800px|thumb|Game Board PCB Schematic]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Schematics.jpg|center|500px|thumb|Game Pad PCB (Front)]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game board schematics.jpg|center|500px|thumb|Game Pad PCB (Back)]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We checked our schematics several times. We also manually checked the footprints for each part before ordering the PCB. We were succeeded in 1st attempt.&lt;br /&gt;
&lt;br /&gt;
=== Fabrication ===&lt;br /&gt;
&lt;br /&gt;
Using the EasyEDA we designed a 2 layer PCB. PCB was sent to fabrication to JLCPCB China which provided PCB within 7 days with MOQ of 5. The dimension of the 1st PCB was 8.5cm * 8 cm while the other was with the dimension of 16cm * 11.5cm. All the components were mounted as close to each other as possible to minimize the PCB dimensions.&lt;br /&gt;
&lt;br /&gt;
PCB Properties:&lt;br /&gt;
Size: 8.5cm * 11.5cm and 16cm * 11.5cm &amp;lt;br/&amp;gt;&lt;br /&gt;
Signal Layers: 2 &amp;lt;br/&amp;gt;&lt;br /&gt;
Componenets: 16 &amp;lt;br/&amp;gt;&lt;br /&gt;
Routing width: 0.254mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Track Width: 1mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Clearance: 0.3mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via diameter: 0.61mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Via Drill Diameter: 0.31mm &amp;lt;br/&amp;gt;&lt;br /&gt;
Vias: 20 &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:LED Board PCB.jpeg|center|500px|thumb|LED Board Final PCB]]&lt;br /&gt;
|&lt;br /&gt;
|[[File:Game-pad controller.jpg|center|500px|thumb|Game pad controller]]&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
&lt;br /&gt;
[[File:Mario Game flow.png|500px|thumb|center|Mario Game FlowChart]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Codeflow.drawio.png|500px|thumb|center|Code flow ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Led matrix pin out.jpg|500px|thumb|center|Pinout for LED Matrix]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithm:'''&lt;br /&gt;
&lt;br /&gt;
 MARIO_Game_state: Initially START_GAME&lt;br /&gt;
 Display Start screen&lt;br /&gt;
 Action: Joystick Button pressed&lt;br /&gt;
 Switch over to Game UI&lt;br /&gt;
 MARIO_Game_state : GAME_START_INITIATED&lt;br /&gt;
 Game Logic Task&lt;br /&gt;
 Available lives = 3&lt;br /&gt;
 Time starting from 0 counting towards 150 seconds&lt;br /&gt;
 Mario on stationery position&lt;br /&gt;
 Switch ove to Game backgroung screen&lt;br /&gt;
 Start counting time within this routine till 150 seconds&lt;br /&gt;
 if timer reached or Available lives ==0&lt;br /&gt;
 : MARIO_Game_state -&amp;gt; GAME_OVER&lt;br /&gt;
 Switch over to Game over Screen UI&lt;br /&gt;
 If (MARIO_Game_state == GAME_START_INITIATED&lt;br /&gt;
 &amp;amp;&amp;amp; Task tick count &amp;lt; 150 seconds&lt;br /&gt;
 &amp;amp;&amp;amp; mario_available_lives !=0)&lt;br /&gt;
 {&lt;br /&gt;
 Action: Joystick forward command received&lt;br /&gt;
 Rotate horizontal graphics matrix by x pixels&lt;br /&gt;
 along with walking animation&lt;br /&gt;
 Action: Joystick Jump command received&lt;br /&gt;
 Rotate horizontal graphics matrix by 2x pixels&lt;br /&gt;
 along with walking animation and music&lt;br /&gt;
 Collision detection&lt;br /&gt;
 If Mario position lies within Pothole&lt;br /&gt;
 || If mario position colides with Piranha plant&lt;br /&gt;
 Mario dying animation and music&lt;br /&gt;
 Available lives decremented by 1&lt;br /&gt;
 Start game from beginning&lt;br /&gt;
 If traversal pixel cordinate reaches victory cordinate&lt;br /&gt;
 MARIO_Game_state = MARIO_VICTORY&lt;br /&gt;
 Switch over to Victory Screen UI and victory music&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
The MP3 player device which is based on a high-quality MP3 audio chip -YX5300 is used in our project to play different soundtracks based on the current state of the game such as jump, victory, game over and Mario run states. Our master controller unit (sjtwo-c board) controls MP3 playback state by sending commands to serial MP3 via UART port&lt;br /&gt;
&lt;br /&gt;
[[File:MP3_module.JPG|300px|thumb|center|Serial MP3 Module]]&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
The MCU controls the device playback by sending serial commands through a TTL level UART control interface (GND, VCC, TX, RX). Sound is output through a headphone jack to headphones or an external amplifier. The board has a playback indicator led that blinks during playback and is steady otherwise. The TF card socket on the PCB reverse is for plugging in the micro SD card with mp3/wav files. The micro SD card should be formatted as fat16 or fat32 and songs must be prefixed with a unique 3 digit index number (for example, 001xxx.mp3, 002xxx.mp3, 003xxx.mp3, etc, where xxx is an arbitrary optional name). The baud rate required for communication is 9600 bps. This decoder also contains an audio jack to connect headphones or speakers.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:Hw_design.JPG|500px|thumb|center|MP3 Hardware Interface]]&lt;br /&gt;
|[[File:Mp3_hw_map.JPG|500px|thumb|center|Hardware Support]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The SJ2 board initializes UART for communicating to the MP3 decoder and allocates memory to load packet information before sending via TX line.Different song tracks were played depending on the game state for example victory song when the players wins, super Mario theme song else where. &lt;br /&gt;
&lt;br /&gt;
In the project, we wait for an event, such as entering the title screen or game to start playing music. &lt;br /&gt;
&lt;br /&gt;
[[File:MP3_flowchart.JPG|center|250px|thumb|MP3 Decoder flowchart]]&lt;br /&gt;
&lt;br /&gt;
Below, are snippets of the code used to set up the commands and send them through UART. Before sending any other command, we must command the decoder to select device 2 (as described in the datasheet). A command we used in our ace Mario project was to play the song at index. The function that sends this command is called mp3_decoder__play_song_at_index(). Within commands, there are two function calls for setting up the packet (set_command_and_data()) and the other for sending the packet over UART (send_command_via_uart()) as shown below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
static void intialize_command_message(mp3_decoder__msg_t *mp3_decoder_message) {&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.start_byte = cmd_start;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.version_byte = version;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.data_length = cmd_length;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.feedback_byte = no_feedback;&lt;br /&gt;
  mp3_decoder_message-&amp;gt;mp3_decoder_command_byte.end_byte = cmd_end;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void set_command_and_data(uint8_t command, uint8_t data_0, uint8_t data_1) {&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.command_byte = command;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte0 = data_0;&lt;br /&gt;
  mp3_command_message.mp3_decoder_command_byte.data_byte1 = data_1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
static void send_command_via_uart(void) {&lt;br /&gt;
  uint8_t i = 0;&lt;br /&gt;
  while (i &amp;lt; 8) {&lt;br /&gt;
    if (uart__polled_put(uart, mp3_command_message.mp3_decoder_command.bytes[i])) {&lt;br /&gt;
      i++;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
static void select_storage_device(void) {&lt;br /&gt;
  static const uint8_t device = 0x02;&lt;br /&gt;
  set_command_and_data(mp3_decoder__select_device, no_data, device);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void mp3_decoder__play_song_at_index(uint8_t index) {&lt;br /&gt;
  set_command_and_data(mp3_decoder__play_at_index, no_data, index);&lt;br /&gt;
  send_command_via_uart();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bluetooth Interface ===&lt;br /&gt;
&lt;br /&gt;
For this project, we used two HC-05 Bluetooth modules. One Bluetooth was configured on the LED matrix controller board while the other was configured on the gamepad controller. The Bluetooth configured on the led matrix controller worked as a slave, only receives commands, while the one configured on the gamepad worked as master, sending controls to the other controller. The master Bluetooth connected to the gamepad controller transmitted the joystick direction. The transmitted direction was in the form of x and y coordinates. The UP and FORWARD direction was calibrated using the x and y coordinates. So along with UP and FORWARD direction, the joystick switch button data was also transmitted using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
We selected the HC-05 Bluetooth module to transmit data over other modules because of their ease to configure, they are extremely reliable and also easy to set up. Both the Bluetooth modules were configured using AT commands. Using AT commands made our job easy to set one Bluetooth as a master while the other as a slave. The best thing about using AT commands is that we can change the configuration as per our needs. The UART baud rate was set to 38400.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth-HC 05.jpg|300px|thumb|center|HC-05 Bluetooth Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
The HC-05 Bluetooth module was connected to both boards using the SJ2 pins. The pins used were P0.0 and P0.1. These Bluetooth modules communicate with each other over the UART interface. The gamepad controller board process the joystick signals to UP and FORWARD and also the button press and then sends them to the Bluetooth module via UART.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bluetooth SJ2.jpg|500px|thumb|center|HC-05 Bluetooth Module to SJ2 Connections]]&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
The following function &amp;quot;receive_from_bluetooth&amp;quot; was used to receive data from the Bluetooth. &lt;br /&gt;
 &lt;br /&gt;
 void receive_from_bluetooth (void *p) {&lt;br /&gt;
  char bluetooth_command_received[50];&lt;br /&gt;
  bluetooth_command_received[0] = '\0';&lt;br /&gt;
  while (1) {&lt;br /&gt;
    char received_data = '\0';&lt;br /&gt;
    if (uart__get(UART__3, &amp;amp;received_data, portMAX_DELAY)) {&lt;br /&gt;
      strncat(bluetooth_command_received, &amp;amp;received_data, 1);&lt;br /&gt;
      if (received_data == '\n') {&lt;br /&gt;
        bluetooth__process_receive_data(bluetooth_command_received);&lt;br /&gt;
        strcpy(bluetooth_command_received, &amp;quot;\0&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The following code snippet was used to process the received data. It simply compares the strings and, if the match is found the direction is set accordingly. &lt;br /&gt;
&lt;br /&gt;
 void bluetooth__process_receive_data(char string[]) {&lt;br /&gt;
  if (strcmp(string, &amp;quot;CENTERED\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(CENTERED);&lt;br /&gt;
    printf(&amp;quot;CENTERED\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;RIGHT\r\n&amp;quot;) == 0){&lt;br /&gt;
    set_joystick_direction(RIGHT);&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  } else if (strcmp(string, &amp;quot;JOYSTICK_ON\r\n&amp;quot;) == 0) {&lt;br /&gt;
    set_joystick_button_pressed(true);&lt;br /&gt;
    printf(&amp;quot;JOYSTICK_BUTTON\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Game pad Controller ===&lt;br /&gt;
&lt;br /&gt;
Gamepad Controller basically consists of only three main components. Firstly the joystick, which is used to get the UP and FORWARD direction, and also the press button. Second is the Bluetooth module which is used to transmit the data via UART to the other board. And lastly, the vibration sensor to produce the vibration. The vibration sensor is used to get the real game feel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Game pad controller.jpeg|400px|thumb|center|Game Pad Controller]]&lt;br /&gt;
&lt;br /&gt;
=== Joystick ===&lt;br /&gt;
&lt;br /&gt;
The joystick was interfaced on the Game-pad controller. We used a joystick to get a UP and FORWARD direction. The joystick was configured using ADC pins of the SJ2 board. The Joystick provides an analog output, therefore they were connected to ADC pins to get the digital values. The values of the X-axis and Y-axis varied from 0 to 4095. The center was 2048 for both X-axis and Y-axis. The UP and FORWARD direction was calculated using these ADC values. The joystick also had a digital switch. This digit switch was used as a press button in our game. These three contents (i.e UP, FORWARD, Button_press) were transmitted to the led board using Bluetooth.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick-module.jpg|300px|thumb|center|Joystick Module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardware design was pretty simple. The two analog output pins i.e X-axis and Y-axis were connected to ADC pins of the SJ2 board. The ADC pins used were P1.30 and P1.31 to get the UP direction and the FORWARD direction. The digital switch was connected to one of the gpio pins on the SJ2 board. This gpio pin was read to detect if the switch was pressed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Joystick schematics.jpg|400px|thumb|center|Joystick Schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
This code snippet below demonstrates how we calculated the direction using the joystick. The joystick provides the analog values, so we used the ADC pins of the SJ2 board to get the digital values. The values range from 0 to 4095. According to these values threshold for UP and FORWARD/RIGHT were set. &lt;br /&gt;
&lt;br /&gt;
 static const int16_t UP_threshold = 500;&lt;br /&gt;
 static const int16_t RIGHT_threshold = 3500;&lt;br /&gt;
 joystick_direction_t joystick_controls__get_joystick_direction(void) {&lt;br /&gt;
  joystick_direction_t joysticks_direction = CENTERED;&lt;br /&gt;
  int joystick_pos_x = adc__get_channel_reading_with_burst_mode(X_axis);&lt;br /&gt;
  int joystick_pos_y = adc__get_channel_reading_with_burst_mode(Y_axis);&lt;br /&gt;
  if (joystick_pos_y &amp;lt; UP_threshold) {&lt;br /&gt;
    joysticks_direction = UP;&lt;br /&gt;
    printf(&amp;quot;UP\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  if (joystick_pos_x &amp;gt; RIGHT_threshold) {&lt;br /&gt;
    joysticks_direction = RIGHT;&lt;br /&gt;
    printf(&amp;quot;RIGHT\n&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  vTaskDelay(500);&lt;br /&gt;
  return joysticks_direction;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Vibration Module ===&lt;br /&gt;
&lt;br /&gt;
A vibration module was used to produce the vibration on the game-pad controller to get the real feel of the game. The vibration module was triggered on the Mario jump state and also when Mario died. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor.jpg|300px|thumb|center|Vibration module]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Hardware Design ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Vibration module consists of just 3 pins. VCC for power, Signal pin to trigger the pin, and GND. The signal pin of the vibration module was connected to one of the gpio pin (P0.29) of the SJ2 board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Vibration sensor schematics.jpg|300px|thumb|center|Vibration module schematics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Software Design ====&lt;br /&gt;
&lt;br /&gt;
A GPIO pin was used to signal the SIG pin of the vibration module.&lt;br /&gt;
&lt;br /&gt;
 gpio_s vibration_module_pin = {1, 29};&lt;br /&gt;
 &lt;br /&gt;
 gpio__set(vibration_module_pin);&lt;br /&gt;
  delay__ms(500);&lt;br /&gt;
  gpio__reset(vibration_module_pin);&lt;br /&gt;
&lt;br /&gt;
=== Game Graphics Implementation ===&lt;br /&gt;
The mtPaint software(open source) is fantastic resource for planning out levels ,background and designing characters of game .Images drawn using mtPaint can be convert into 2d-array representation using a python script or other image processing software. This is going to be much easier than writing entire screens out by hand and also saves time.&lt;br /&gt;
{| style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|[[File:MtPaint.JPG|500px|thumb|center| mtPaint Window...]]&lt;br /&gt;
|[[File:Python_Script.JPG|500px|thumb|center|Python Scripts]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Testing &amp;amp; Technical Challenges ==&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
&lt;br /&gt;
* The datasheet lacks some information and clarity on module initialization and working. Initially, non of the commands appeared to work or have any effect. The issue was resolved after sending the command to select a device, which was not explicitly stated in the datasheet. Once this command is first sent, the MP3 decoder now begins accepting commands.&lt;br /&gt;
*The TF card folder structure for songs was unclear in the first go.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Indeed, it was a great learning experience. It sharpened our driver writing skills as we coded each module we used (LED matrix, MP3 decoder, Bluetooth, etc.).We were able to learn a lot about a real-world projects such as FreeRTOS applications, drivers, PCB design, power management circuits, git source code management, and final integration testing. This project allowed us to understand the importance of writing down requirements, planning a schedule for development, and teamwork. Throughout the entire duration of this project, we encountered numerous challenges such as difficulty getting the LED matrix driver up and running, figuring out how to implement collision detection with so many game objects, hardware integration, and writing and maintaining our complex game logic state machine and much more. Despite the challenges and setbacks we faced, we were able to overcome every single one of them in order to build a finished product that we are all proud of.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
&lt;br /&gt;
*  [https://www.youtube.com/watch?v=zW5vmb5-Tc4 Demo Video Link]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
&lt;br /&gt;
*  [https://gitlab.com/Shreevats/mario-run Project source code]&lt;br /&gt;
&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
&lt;br /&gt;
We'd want to express our gratitude to our professor Preet and all of the ISAs for putting together such a fantastic class and for setting such high standards. This instilled in us the desire to go above and beyond.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
LED Matrix&lt;br /&gt;
&lt;br /&gt;
* [https://www.sparkfun.com/news/2650 Everything You Didn't Want to Know About RGB Matrix Panels]&lt;br /&gt;
* [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/new-wiring AdaFruit LED Matrix Wiring]&lt;br /&gt;
Image Designing&lt;br /&gt;
&lt;br /&gt;
* [http://mtpaint.sourceforge.net/ Mtpaint Source &amp;amp; Documentation]&lt;br /&gt;
&lt;br /&gt;
MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cefaloide/ArduinoSerialMP3Player MP3 Datasheets]&lt;br /&gt;
* [http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf Catalex_MP3_board_datasheet]&lt;br /&gt;
&lt;br /&gt;
HC-05 Bluetooth Modules&lt;br /&gt;
&lt;br /&gt;
* [https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/ HC-05 Bluetooth Configuration &amp;amp; Pairing]&lt;br /&gt;
* [https://www.teachmemicro.com/hc-05-bluetooth-command-list/ HC-05 Bluetooth AT Commands]&lt;br /&gt;
&lt;br /&gt;
PCB Designing&lt;br /&gt;
&lt;br /&gt;
* [https://easyeda.com/ PCB Designing]&lt;br /&gt;
* [https://jlcpcb.com/ PCB fabrication]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63989</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63989"/>
				<updated>2021-02-22T06:21:35Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Bill Of Materials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. The project focuses on integrating SJ2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
The micro-controller is integrated with peripheral drivers, led drivers, MP3 player, button, and joystick controller interface. The application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. A button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 2&lt;br /&gt;
| $100.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PCB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
===LED Matrix Specifications===&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63984</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63984"/>
				<updated>2021-02-17T21:31:16Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* MP3 Decoder */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. The project focuses on integrating SJ2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
The micro-controller is integrated with peripheral drivers, led drivers, MP3 player, button, and joystick controller interface. The application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. A button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PCB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
===LED Matrix Specifications===&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63956</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63956"/>
				<updated>2020-12-18T07:58:06Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. The project focuses on integrating SJ2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
The micro-controller is integrated with peripheral drivers, led drivers, MP3 player, button, and joystick controller interface. The application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. A button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
===LED Matrix Specifications===&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63954</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63954"/>
				<updated>2020-12-18T07:56:40Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Joystick */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
===LED Matrix Specifications===&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63951</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63951"/>
				<updated>2020-12-18T07:56:18Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* LED Matrix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
===LED Matrix Specifications===&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63947</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63947"/>
				<updated>2020-12-18T07:54:34Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Software Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
===LED Matrix Specifications===&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63945</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63945"/>
				<updated>2020-12-18T07:53:48Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* LED Matrix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
===LED Matrix Specifications===&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63942</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63942"/>
				<updated>2020-12-18T07:53:09Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* LED Matrix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63940</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63940"/>
				<updated>2020-12-18T07:52:25Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* LED Matrix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63939</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63939"/>
				<updated>2020-12-18T07:51:39Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Joystick */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63938</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63938"/>
				<updated>2020-12-18T07:51:19Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Hardware Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63937</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63937"/>
				<updated>2020-12-18T07:50:44Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|Team Bubble Shooter|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
4. On-board button&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63936</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63936"/>
				<updated>2020-12-18T07:50:16Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
4. On-board button&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63935</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63935"/>
				<updated>2020-12-18T07:49:25Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
4. On-board button&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63934</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63934"/>
				<updated>2020-12-18T07:49:08Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right Team Bubble Shooter]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
4. On-board button&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63933</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63933"/>
				<updated>2020-12-18T07:48:47Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right] Team Bubble Shooter]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
4. On-board button&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63932</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63932"/>
				<updated>2020-12-18T07:48:20Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
4. On-board button&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 }  &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and Sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63925</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63925"/>
				<updated>2020-12-18T07:44:38Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63923</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63923"/>
				<updated>2020-12-18T07:43:17Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63921</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63921"/>
				<updated>2020-12-18T07:42:23Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]\&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63919</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63919"/>
				<updated>2020-12-18T07:41:13Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]\&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63918</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63918"/>
				<updated>2020-12-18T07:40:54Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]\&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63912</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63912"/>
				<updated>2020-12-18T07:39:32Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his all-round guidance, feedback, and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]\&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63906</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63906"/>
				<updated>2020-12-18T07:36:51Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third-party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED. Once we could control LEDs one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lesson that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard, and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]\&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63905</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63905"/>
				<updated>2020-12-18T07:36:30Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* References Used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]\&lt;br /&gt;
*  [https://www.youtube.com/watch?v=WW-VwLfq2aU&amp;amp;feature=youtu.be Joystick Reference]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63901</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63901"/>
				<updated>2020-12-18T07:35:23Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63899</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63899"/>
				<updated>2020-12-18T07:33:32Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Game Engine */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
The game starts with the Main Menu, which has the number of turns, score, and Level on the top. A credit count and Ball queue are placed at the bottom of the screen. Once the credit button is pressed and credits are accumulated and the game starts by pressing the trigger button. A bubble is ready inside the trigger and the player just needs to adjust the pointer and shoot in the desired direction. Two other bubbles based on the number of colored bubbles present on the top is available in the queue. After the ball is released from the trigger it checks the property of the above objects and functions accordingly. If the released bubble encounters a border wall, then it bounces off in the opposite direction, if it encounters the bubbles then sticks to it if it's a different color, else destroys all the same colored bubbles. And finally, if the ball touches the Wall on the top then it doesn't stick but gets destroyed. The trigger remains empty and the queue still has the old bubbles. Based on the final function of the released bubble, a function scans the number of different colored bubbles in the stack and calculates the color of bubbles that are present in more. The trigger and queue then get updated with new bubbles and the wall comes down a bit further near the danger line.&lt;br /&gt;
&lt;br /&gt;
The above process keeps happening until either all the bubbles are cleared, the wall reaches the danger line, or you cheat your way to the next level. Have fun playing!&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63897</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63897"/>
				<updated>2020-12-18T07:32:09Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Objectives &amp;amp; Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a single-player 2D arcade game using LPC 4078 microcontroller on a 64 X 32 LED matrix display. Project focus on integrating Sj2 microcontroller board with LED Matrix, MP3 Decoder, 2 pushbuttons, and joystick.&lt;br /&gt;
It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63889</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63889"/>
				<updated>2020-12-18T07:26:57Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* LED Matrix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63887</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63887"/>
				<updated>2020-12-18T07:25:26Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* References Used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/rgb-panel-hookup-guide?_ga=2.111533508.177452041.1605078754-2035904423.1601235282 RGB Panel Hookup Guide 1]&lt;br /&gt;
*  [https://www.mouser.com/datasheet/2/737/32x16-32x32-rgb-led-matrix-1396574.pdf RGB Panel Hookup Guide 2]&lt;br /&gt;
*  [http://www.rayslogic.com/propeller/Programming/AdafruitRGB/MBI5026.pdf Shift Register Datasheet]&lt;br /&gt;
*  [https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15/all MP3 Decoder hookup guide]&lt;br /&gt;
*  [https://datasheetspdf.com/pdf-file/640613/VLSI/VS1053B/1 VS1053B datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63882</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63882"/>
				<updated>2020-12-18T07:21:26Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Testing &amp;amp; Technical Challenges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
=== Future Suggestions ===&lt;br /&gt;
&lt;br /&gt;
1. Modify a single pixel with different locations to get a thorough understanding of the led matrix. Check all the possible colors to identify any faulty pixels on the board. Write a generic scalable code to help you in the game. Implement frame methodology to prevent flickering and achieve a smooth transition of pixels.&lt;br /&gt;
&lt;br /&gt;
2. Preferably use UART based MP3 decoder rather than SPI.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63878</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63878"/>
				<updated>2020-12-18T07:18:18Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Feeding the Decoder and Playing Music */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63877</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63877"/>
				<updated>2020-12-18T07:17:07Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63876</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63876"/>
				<updated>2020-12-18T07:16:59Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Bill Of Materials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63874</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63874"/>
				<updated>2020-12-18T07:16:50Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Testing &amp;amp; Technical Challenges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63873</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63873"/>
				<updated>2020-12-18T07:16:49Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Bill Of Materials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| Push Buttons&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07SVSYDNM/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&amp;amp;psc=1 Push Buttons]&lt;br /&gt;
| 1&lt;br /&gt;
| $7.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble. == '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63869</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63869"/>
				<updated>2020-12-18T07:15:54Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Testing &amp;amp; Technical Challenges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble. == '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
As with any other project, even this threw challenges along the way. &lt;br /&gt;
&lt;br /&gt;
=== LED Matrix ===&lt;br /&gt;
1. Understanding the matrix and then getting it to run was difficult as proper documentation or resource for the matrix was not available.&lt;br /&gt;
&lt;br /&gt;
2. OE pin was not active low and it took us some time to figure it out. &lt;br /&gt;
&lt;br /&gt;
3. Bubble, after released by the player, should move in the direction of the pointer and bounce off the border wall.&lt;br /&gt;
&lt;br /&gt;
A graphics library was developed to print Alphanumerics in both horizontal and vertical positions. The driver was designed in a way to simply accept the coordinates of the board, shape, and color of the bubble instead of plotting it manually.&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63866</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63866"/>
				<updated>2020-12-18T07:15:41Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Bill Of Materials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| PAM8403 Amplifier and Speaker&lt;br /&gt;
| [https://www.amazon.com/gp/product/B07CRVRG83/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 Amplifier and Speaker]&lt;br /&gt;
| 1&lt;br /&gt;
| $11.99&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
1. RGB LED Matrix Display driver&lt;br /&gt;
&lt;br /&gt;
a) Setting up the LED Matrix was a bit of a challenge. Started with glowing a single row and column. Getting the initial hold on the exact row and column position was a bit tricky as one can easily get confuse on the starting and ending row and column. Once we got over it we moved on to design game objects separately.&lt;br /&gt;
&lt;br /&gt;
b) Flickering of led matrix was solved by doing the following:&lt;br /&gt;
&lt;br /&gt;
The frequency of refreshing the led matrix was increased to show smooth transition from one frame to another.&lt;br /&gt;
Led matrix is very sensitive to the inputs provided to it. Initially the flickering was thought to be because of the data lines and row selection lines. But later with further diagnoses it was discovered that the power supply line was creating issues. Changing the adapter eliminated the flickering.&lt;br /&gt;
&lt;br /&gt;
2. Designing the MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
a) Earlier we used the ssp2 Driver written by Preet for SPI interfacing to write the data to MP3 Decoder. but somehow we were not able to detect the slave properly because of which we could not communicate with the decoder.&lt;br /&gt;
&lt;br /&gt;
Resolution : We wrote our own simple SPI driver which sends the data to the MP3 Decoder for playing the music in background.&lt;br /&gt;
b) While reading data from the SD Card sometimes we faced few issues like hardware error occured in disk i/o and physical drive cannot work.&lt;br /&gt;
&lt;br /&gt;
Resolution : The default driver was using mount later option for SD Card we changed it to mount immediately and the issue got resolved.&lt;br /&gt;
&lt;br /&gt;
3. Integration Issues&lt;br /&gt;
&lt;br /&gt;
a) Game logic was developed independently&lt;br /&gt;
&lt;br /&gt;
Careful time and consideration had to be taken to ensure that the APIs were able to be stitched together. This actually ended up going smoother than we had anticipated. The Inter-board communication driver was designed to handle almost everything regarding the controllers, providing very abstract and simple APIs. This allowed for relatively smooth integration.&lt;br /&gt;
&lt;br /&gt;
b) After game and controller logic, the main SJ2 did not have enough processing power to adequately driver the music functionality.&lt;br /&gt;
&lt;br /&gt;
A standalone SJ2 board was used for the game soundtrack. This eased the load on our main board which was starting to effect our gameplay&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63864</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63864"/>
				<updated>2020-12-18T07:14:49Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Testing &amp;amp; Technical Challenges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
1. RGB LED Matrix Display driver&lt;br /&gt;
&lt;br /&gt;
a) Setting up the LED Matrix was a bit of a challenge. Started with glowing a single row and column. Getting the initial hold on the exact row and column position was a bit tricky as one can easily get confuse on the starting and ending row and column. Once we got over it we moved on to design game objects separately.&lt;br /&gt;
&lt;br /&gt;
b) Flickering of led matrix was solved by doing the following:&lt;br /&gt;
&lt;br /&gt;
The frequency of refreshing the led matrix was increased to show smooth transition from one frame to another.&lt;br /&gt;
Led matrix is very sensitive to the inputs provided to it. Initially the flickering was thought to be because of the data lines and row selection lines. But later with further diagnoses it was discovered that the power supply line was creating issues. Changing the adapter eliminated the flickering.&lt;br /&gt;
&lt;br /&gt;
2. Designing the MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
a) Earlier we used the ssp2 Driver written by Preet for SPI interfacing to write the data to MP3 Decoder. but somehow we were not able to detect the slave properly because of which we could not communicate with the decoder.&lt;br /&gt;
&lt;br /&gt;
Resolution : We wrote our own simple SPI driver which sends the data to the MP3 Decoder for playing the music in background.&lt;br /&gt;
b) While reading data from the SD Card sometimes we faced few issues like hardware error occured in disk i/o and physical drive cannot work.&lt;br /&gt;
&lt;br /&gt;
Resolution : The default driver was using mount later option for SD Card we changed it to mount immediately and the issue got resolved.&lt;br /&gt;
&lt;br /&gt;
3. Integration Issues&lt;br /&gt;
&lt;br /&gt;
a) Game logic was developed independently&lt;br /&gt;
&lt;br /&gt;
Careful time and consideration had to be taken to ensure that the APIs were able to be stitched together. This actually ended up going smoother than we had anticipated. The Inter-board communication driver was designed to handle almost everything regarding the controllers, providing very abstract and simple APIs. This allowed for relatively smooth integration.&lt;br /&gt;
&lt;br /&gt;
b) After game and controller logic, the main SJ2 did not have enough processing power to adequately driver the music functionality.&lt;br /&gt;
&lt;br /&gt;
A standalone SJ2 board was used for the game soundtrack. This eased the load on our main board which was starting to effect our gameplay&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== MP3 Decoder ===&lt;br /&gt;
1. Communicating with the decoder using SSP was challenging and took multiple rounds of debugging to start playing the tracks. &lt;br /&gt;
&lt;br /&gt;
2. Switching between the songs when levels change also gave some issues. &lt;br /&gt;
&lt;br /&gt;
Inputs from SJ2 were enabled to indicate the level change within the state machine, this way when the level changed the respective pin indicated the song to be played.  &lt;br /&gt;
&lt;br /&gt;
=== Game Design ===&lt;br /&gt;
1. First major challenge was to clear all the same colored bubbles once it was hit by the player bubble.&lt;br /&gt;
&lt;br /&gt;
2. The Second challenge was to figure out an algorithm for the released bubble to either get attached or destroyed when it touches the bubble-block.&lt;br /&gt;
&lt;br /&gt;
3. Designing the functionalities of border walls to bounce the released bubble, the wall to come down and destroy if the player bubble touches it, and aligning with nearby bubbles were few other challenges faced in game design.&lt;br /&gt;
&lt;br /&gt;
A function that scans the bubble-block and then returns the number of different colored bubbles present was implemented to identify and destroy all the same colored bubbles. Bubbles were defined with sticky and player properties and when the player bubble encounters the sticky property, stops moving and either sticks to it or destroys it. Similarly, a wall and bounce property was defined to guide the bubble.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63859</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63859"/>
				<updated>2020-12-18T07:12:42Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Schedule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
1. RGB LED Matrix Display driver&lt;br /&gt;
&lt;br /&gt;
a) Setting up the LED Matrix was a bit of a challenge. Started with glowing a single row and column. Getting the initial hold on the exact row and column position was a bit tricky as one can easily get confuse on the starting and ending row and column. Once we got over it we moved on to design game objects separately.&lt;br /&gt;
&lt;br /&gt;
b) Flickering of led matrix was solved by doing the following:&lt;br /&gt;
&lt;br /&gt;
The frequency of refreshing the led matrix was increased to show smooth transition from one frame to another.&lt;br /&gt;
Led matrix is very sensitive to the inputs provided to it. Initially the flickering was thought to be because of the data lines and row selection lines. But later with further diagnoses it was discovered that the power supply line was creating issues. Changing the adapter eliminated the flickering.&lt;br /&gt;
&lt;br /&gt;
2. Designing the MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
a) Earlier we used the ssp2 Driver written by Preet for SPI interfacing to write the data to MP3 Decoder. but somehow we were not able to detect the slave properly because of which we could not communicate with the decoder.&lt;br /&gt;
&lt;br /&gt;
Resolution : We wrote our own simple SPI driver which sends the data to the MP3 Decoder for playing the music in background.&lt;br /&gt;
b) While reading data from the SD Card sometimes we faced few issues like hardware error occured in disk i/o and physical drive cannot work.&lt;br /&gt;
&lt;br /&gt;
Resolution : The default driver was using mount later option for SD Card we changed it to mount immediately and the issue got resolved.&lt;br /&gt;
&lt;br /&gt;
3. Integration Issues&lt;br /&gt;
&lt;br /&gt;
a) Game logic was developed independently&lt;br /&gt;
&lt;br /&gt;
Careful time and consideration had to be taken to ensure that the APIs were able to be stitched together. This actually ended up going smoother than we had anticipated. The Inter-board communication driver was designed to handle almost everything regarding the controllers, providing very abstract and simple APIs. This allowed for relatively smooth integration.&lt;br /&gt;
&lt;br /&gt;
b) After game and controller logic, the main SJ2 did not have enough processing power to adequately driver the music functionality.&lt;br /&gt;
&lt;br /&gt;
A standalone SJ2 board was used for the game soundtrack. This eased the load on our main board which was starting to effect our gameplay&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63857</id>
		<title>F20: Bubble Shooter</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F20:_Bubble_Shooter&amp;diff=63857"/>
				<updated>2020-12-18T07:12:00Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user7: /* Technical Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
Bubble shooter is an arcade game that has bubbles or balls present on the screen. The bubbles are of different colors and the goal is to clear them by forming a group of bubbles (3 or more) of the same color. Points are earned upon clearing the bubbles and increases with the number of bubbles cleared in a single shot. The player wins upon clearing the screen and loses when the bubbles touch the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Abstract_Bubble_Shooter.png|800px|thumb|center|Block Diagram of Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&lt;br /&gt;
[[File:Project Pic.jpg|thumb|500x500px|right]]&lt;br /&gt;
&lt;br /&gt;
The objective of this project is to develop a simple, single-player 2D game using LPC 4078 microcontroller on an LED matrix display. It focuses on integrating the micro-controller peripheral drivers, led drivers, MP3 player, button and joystick controller interface and the application software in FreeRTOS. The button controller interface consists of the joystick for moving the shooter left and right. The button is used to fire the ball.&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
*  '''''[https://www.linkedin.com/in/akshat-bhutiani-048235119/ Akshat Bhutiani]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/amirajnigam/ Amiraj Nigam]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/anirudh-ashrit/ Anirudh Ashrit]''''' &lt;br /&gt;
*  '''''[https://www.linkedin.com/in/hisaam-hashim/ Hisaam Hashim]'''''&lt;br /&gt;
&lt;br /&gt;
== '''Technical Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Hisaam Hashim, Amiraj Nigam, Anirudh Ashrit, Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* PCB Design&lt;br /&gt;
| Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED and Graphics Display Driver&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Mp3 Decoder Driver&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Integration&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Amiraj Nigam, Anirudh Ashrit, Hisaam Hashim &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Administrative Responsibilities''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Akshat Bhutiani&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewer&lt;br /&gt;
| Hisaam Hashim&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Managers&lt;br /&gt;
| Amiraj Nigam &amp;amp; Anirudh Ashrit&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Amiraj Nigam&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Schedule''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Week#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Start Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| End Date&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Task&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Status&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| &lt;br /&gt;
* 10/12/2020&lt;br /&gt;
* 10/16/2020&lt;br /&gt;
|&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
* 10/18/2020&lt;br /&gt;
|&lt;br /&gt;
* Literature Survey of Previous year Projects&lt;br /&gt;
* Submission of Project Proposal&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| &lt;br /&gt;
*10/18/2020   &lt;br /&gt;
| &lt;br /&gt;
*10/20/2020 &lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Gitlab Repository Created&lt;br /&gt;
*Wiki Schedule page Created&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
|&lt;br /&gt;
*10/20/2020&lt;br /&gt;
|&lt;br /&gt;
*11/01/2020&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet.&lt;br /&gt;
*Finalize the Components and place the order&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
|&lt;br /&gt;
* 11/01/2020&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2020&lt;br /&gt;
|&lt;br /&gt;
* Understand the ball tracing logic&lt;br /&gt;
* Understand the logic for ball queue &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
|&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
*11/09/2020&lt;br /&gt;
|&lt;br /&gt;
*11/10/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
*11/15/2020&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* LED Matrix Driver Development&lt;br /&gt;
* MP3 Decoder Driver Development&lt;br /&gt;
* Joystick driver development and interfacing&lt;br /&gt;
* Game logic development&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
|&lt;br /&gt;
*11/16/2020 &lt;br /&gt;
| &lt;br /&gt;
*11/22/2020&lt;br /&gt;
|&lt;br /&gt;
*Designing of levels in the game&lt;br /&gt;
*Testing trigger motions&lt;br /&gt;
*Testing and debugging the game logic&lt;br /&gt;
*PCB Designing&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| &lt;br /&gt;
* 11/23/2020&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
* 11/29/2020&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic code with LED matrix&lt;br /&gt;
* Integrate game sounds with game logic &lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/30/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/06/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* Integrate subsystem&lt;br /&gt;
* Finalizing the video game &lt;br /&gt;
* Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| &lt;br /&gt;
* 12/07/2020&lt;br /&gt;
| &lt;br /&gt;
* 12/13/2020&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of an integrated system&lt;br /&gt;
* Test pause/play functionality&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 10&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
*12/14/2020&lt;br /&gt;
| &lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
*12/16/2020&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
*Final Demo&lt;br /&gt;
*Update Gitlab repo with final code.&lt;br /&gt;
*Update test video.&lt;br /&gt;
*Update the wiki page.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;In progress&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;in progress&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Bill Of Materials''' ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: 0px; margin-right: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Item#&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Part Model &amp;amp; Vendor&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Cost&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| Microcontroller Boards&lt;br /&gt;
| SJ2 Boards (Purchased from Preet Kang)&lt;br /&gt;
| 1&lt;br /&gt;
| $50.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| LED Matrix Display&lt;br /&gt;
| [https://www.amazon.com/dp/B07D4QF1JQ/ref=cm_sw_r_wa_apa_i_jCHMFbJEVVVQ8?_encoding=UTF8&amp;amp;psc=1 RGB LED Matrix Panel - 32X64]&lt;br /&gt;
| 1&lt;br /&gt;
| $55.00&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| Audio decoder Breakout Board&lt;br /&gt;
| [https://www.sparkfun.com/products/12660 MP3 PLayer Shield]&lt;br /&gt;
| 1&lt;br /&gt;
| $26.95&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| Analog 2-axis Thumb Joystick &lt;br /&gt;
| [https://www.amazon.com/Adafruit-Analog-2-axis-Joystick-Breakout/dp/B00NAY2Q6O Analog 2-axis Joystick]&lt;br /&gt;
| 1&lt;br /&gt;
| $10.36&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| Power Supply&lt;br /&gt;
| [https://www.amazon.com/inShareplus-Voltage-Transformer-100-240V-Connector/dp/B01GCI9G4O/ref=sr_1_1_sspa?dchild=1&amp;amp;keywords=5v%2Bpower%2Bsupply&amp;amp;qid=1604997761&amp;amp;sr=8-1-spons&amp;amp;spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzUk1FVEpQWTFYUFBGJmVuY3J5cHRlZElkPUEwOTQ2MjkzMVE3UTZIMTdTVlpGNyZlbmNyeXB0ZWRBZElkPUEwNjkwMzM5MkZPNUtPOEJVNDJMWiZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU&amp;amp;th=1 5V/3A Power Supply]&lt;br /&gt;
| 1&lt;br /&gt;
| $8.99&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''PCB Design''' ==&lt;br /&gt;
The board is designed to connect modules in the game directly. Autodesk's Eagle software is used to design the Schematics and Board layout. The board has 2 layers(Top and Bottom). JLCPCB is the manufacturer of the PCB board. Connections from SJ2 Board are provided to the PCB, which are internally connected to MP3 Decoder, Joystick, Buttons, and LED Matrix pins. These are connected directly to the peripherals using a harness. Additional power and ground pins are also provided on the board.&lt;br /&gt;
*  [https://www.youtube.com/watch?v=1AXwjZoyNno AutoDesk Eagle Software Tutorial]&lt;br /&gt;
&lt;br /&gt;
[[File:PCB_Schematic_BS.png|500x600px|thumb|left|Schematic Design of PCB]]&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Board_Overview.png|500x600px|thumb|center|Design Overview of the PCB]]&lt;br /&gt;
|[[File:PCB_front.png|500x600px|thumb|right|PCB Board Layout]]&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Front.jpg|500x600px|thumb|left|PCB Front Face]]&lt;br /&gt;
|[[File:PCB_Bubble_Shooter_Back.jpg|500x600px|thumb|center|PCB Back Face]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Joystick'''==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
An ADA512 2-axis Analog Joystick and Button is used for controlling the movement of the launcher and shooting the ball. The data from the joystick is read using the ADC pins of the SJTwo board. The button switch is detected using a digital pin on the board.&lt;br /&gt;
&lt;br /&gt;
Features of the joystick:&lt;br /&gt;
&lt;br /&gt;
1. Usable with any voltage up to 5V&lt;br /&gt;
&lt;br /&gt;
2. Analog outputs&lt;br /&gt;
&lt;br /&gt;
3. 1 mA draw when used with 5V&lt;br /&gt;
&lt;br /&gt;
4. On-board button&lt;br /&gt;
&lt;br /&gt;
5. High sensitivity&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:Break out board.jpg|500x280px |thumb|left|Breakout board layout]] &lt;br /&gt;
|[[File:.Soldered and working.jpg|500x280px |thumb|center|Soldered joystick]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Software Design &amp;amp; Implementation===&lt;br /&gt;
The ADA512 joystick's device driver works on the principle that the ADC pins will be able to read the x and y values. The joystick consists of 2 inbuilt potentiometers that provide output (x and y directions) according to the way the joystick is moved.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| X values &amp;amp; Mapping&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Y values &amp;amp; Mapping&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2297 (center)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 2295 (center)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 43 (left)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 45 (up)&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4095 (right)&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | 4090 (down)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Steps to read joystick data:''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Turn on the ADC Peripheral&lt;br /&gt;
&lt;br /&gt;
2. Make the ADC pin operational by setting the appropriate pin functionality using the IOCON registers.&lt;br /&gt;
&lt;br /&gt;
3. Set the appropriate ADC clock (12.4 MHz is the maximum clock supported by the ADC).&lt;br /&gt;
&lt;br /&gt;
4. Set the ADC pin functionality as input.&lt;br /&gt;
&lt;br /&gt;
5. Select the number of channels to read.&lt;br /&gt;
&lt;br /&gt;
6. Select burst mode for immediate conversion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void adc__initialize_alien(void)&lt;br /&gt;
 {&lt;br /&gt;
 Turn ON ADC peripheral;&lt;br /&gt;
 make ADC operational;&lt;br /&gt;
 set ADC clock;&lt;br /&gt;
 Set Pin functions;&lt;br /&gt;
 select ADC channels;&lt;br /&gt;
 start burst mode;&lt;br /&gt;
 } &lt;br /&gt;
   &lt;br /&gt;
 data get_data(adc_channel_e x_port, adc_channel_e y_port, gpio_s button_press) {&lt;br /&gt;
 data s;&lt;br /&gt;
 s.x_data = adc__get_adc_value(x_port);&lt;br /&gt;
 s.y_data = adc__get_adc_value(y_port);&lt;br /&gt;
 if (gpio__get(button_press)) {&lt;br /&gt;
 s.switch_pressed = true;&lt;br /&gt;
 } else {&lt;br /&gt;
 s.switch_pressed = false;&lt;br /&gt;
 }&lt;br /&gt;
 return s;&lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''MP3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
The MP3 shield communicates with the sister SJ2 board through SPI communication protocol with the SPI0 pins of the SJ2 board as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Function&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin Connection&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Description&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| MP3-DREQ&lt;br /&gt;
| Decoder Data Request&lt;br /&gt;
| Pin 0.1&lt;br /&gt;
| MP3 decoder signals to master to ready to receive next 32 bytes of data&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| MP3-CS&lt;br /&gt;
| VS1053B Chip Select&lt;br /&gt;
| Pin 0.22&lt;br /&gt;
| Chip select pin for MP3 decoder to be activated while sending control signals&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| MP3-DCS&lt;br /&gt;
| VS1053B Data CS&lt;br /&gt;
| Pin 0.0&lt;br /&gt;
| Data Chip Select Pin for the MP3 decoder to be activated while sending audio data signals.&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| MP3-RST&lt;br /&gt;
| VS1053 Reset&lt;br /&gt;
| Pin 0.10&lt;br /&gt;
| Reset pin for the MP3 Decoder&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 5&lt;br /&gt;
| MOSI&lt;br /&gt;
| Master Output Slave Input&lt;br /&gt;
| Pin 0.18&lt;br /&gt;
| Master send data to Slave over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 6&lt;br /&gt;
| MISO&lt;br /&gt;
| SPI Bus (Master Input Slave Output)&lt;br /&gt;
| Pin 0.17&lt;br /&gt;
| Slave send data to master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 7&lt;br /&gt;
| SCK&lt;br /&gt;
| SPI Clock&lt;br /&gt;
| Pin 0.15&lt;br /&gt;
| Clock generated by the master over SPI bus&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| +5V&lt;br /&gt;
| +5V&lt;br /&gt;
| PCB Vout&lt;br /&gt;
| 5 Volt Input from PVB&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 9&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND&lt;br /&gt;
| GND connected to PCB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Hardware Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Layout.png|800x1200px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Software Design===&lt;br /&gt;
&lt;br /&gt;
[[File:MP3 Flow Chart(1).png|700x800px|thumb|center|MP3 Layout]]&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
To initialize the MP3 decoder, we have first initialized the SSP0 and the SJ2 pins connected to the MP3 decoder with proper input/output function configurations. We then configure the decoder registers by selecting the MP3 chip select pin and writing data over SPI. These include the mode (default), clock frequency multiplier (3x), volume (max), and audio (44100 Hz stereo data). We then flush the mp3 decoder, sending it 2500 0 bytes.&lt;br /&gt;
Reading the MP3 File from an SD Card[edit]&lt;br /&gt;
We create a low priority task (read_song_from_sd_card) to read from the SD Card. Read_song_from_sd_card task first opens the mp3 file on the sd card and determines the size. Afterward, it reads in 512 bytes at a time to a global array (whenever the music playing task has finished playing the previous 16 bytes) and sets a global variable (sdready) to true. It will continue to do this until the file has been completely read, and then start over from the beginning.&lt;br /&gt;
&lt;br /&gt;
===Feeding the Decoder and Playing Music===&lt;br /&gt;
We create another low priority task (play_song_task) to play music. If the MP3 DREQ pin is currently set, it delays. Otherwise, whenever sdready is true, it selects the Data chip select line and sends 32 bytes over the SPI bus. It then deselects data chip select and redoes this 16 times (sending the 512 bytes that have been read). After it has sent all 512 bytes, it sets sdready to false so the read_song_from_sd_card task knows to read in the next 512 bytes. It continues to repeat this process for as long as mp3sdcard reads in data to the array.&lt;br /&gt;
&lt;br /&gt;
//Task to read song from sd card&lt;br /&gt;
 void read_level_1_bgm_from_sdcard(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  unsigned int ptr_to_bytes_read = 0;&lt;br /&gt;
  while (1) {&lt;br /&gt;
    const char filename_path[] = &amp;quot;level1.mp3&amp;quot;;&lt;br /&gt;
    FIL song;&lt;br /&gt;
    // Open or creates a file&lt;br /&gt;
    FRESULT check = f_open(&amp;amp;song, filename_path, (FA_READ | FA_OPEN_ALWAYS));&lt;br /&gt;
    if (FR_OK == check) {&lt;br /&gt;
      f_lseek(&amp;amp;song, f_size(&amp;amp;song));&lt;br /&gt;
      current_position_in_mp3_file = f_tell(&amp;amp;song);&lt;br /&gt;
      current_position_in_mp3_file /= 32;&lt;br /&gt;
      f_lseek(&amp;amp;song, 0);&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
      while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
        if (song_position == 16 &amp;amp; sdready == false || sdready == false) {&lt;br /&gt;
          f_read(&amp;amp;song, &amp;amp;data_buffer, BYTES_TO_READ, &amp;amp;ptr_to_bytes_read);&lt;br /&gt;
          mp3_file_size += 16;&lt;br /&gt;
          song_position = 0;&lt;br /&gt;
          sdready = true;&lt;br /&gt;
        }&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
      }                            &lt;br /&gt;
      printf(&amp;quot;Song finished! \n&amp;quot;);&lt;br /&gt;
      f_close(&amp;amp;song);              &lt;br /&gt;
      song_position = 0;&lt;br /&gt;
      mp3_file_size = 0;&lt;br /&gt;
      vTaskDelay(500);&lt;br /&gt;
    }&lt;br /&gt;
    else {&lt;br /&gt;
      printf(&amp;quot;Failed to read SD card \n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    vTaskDelay(1);&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Task to play song&lt;br /&gt;
 void play_song_task(void *p) {&lt;br /&gt;
  vTaskSuspend(NULL);&lt;br /&gt;
  while (mp3_file_size &amp;lt; current_position_in_mp3_file + 32) {&lt;br /&gt;
    while ((song_position &amp;lt; 16) &amp;amp;&amp;amp; (sdready == true) &amp;amp;&amp;amp; (mp3_sel == 0)) {&lt;br /&gt;
      while (!(LPC_GPIO0-&amp;gt;PIN &amp;amp; (MP3_DREQ))) {&lt;br /&gt;
        vTaskDelay(1);&lt;br /&gt;
        ;&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;CLR = (MP3_DCS);&lt;br /&gt;
      for (int a = 0; a &amp;lt; 32; a++) {&lt;br /&gt;
        spi0_ExchangeByte(data_buffer[a + (song_position * 32)]);&lt;br /&gt;
      }&lt;br /&gt;
      // sdready = false;&lt;br /&gt;
      song_position++;&lt;br /&gt;
      LPC_GPIO0-&amp;gt;SET = (MP3_DCS);&lt;br /&gt;
      if (song_position == 16) {&lt;br /&gt;
        mp3_sel = 0;&lt;br /&gt;
        sdready = false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
===Binary Semaphore===&lt;br /&gt;
We have low priority created check_which_song_recieved_from_main_sj2_board_semaphore_give which will act as a producer task which will select which mp3 background music or sound fx need to be played and it will give the semaphore of the selected music file to the high priority consumer task called play_song_task which will suspend all other song handlers and play the selected song.&lt;br /&gt;
&lt;br /&gt;
===Communication between Main and sister SJ2 board===&lt;br /&gt;
We have initialized 3 GPIO pins on the main(P0.15, P0.18, P0.1) and sister board(P2.0, P2.2,  P2.5) and we have a total of 8 songs list, to which the respective GPIO pins will be high or low based on the song selection. The GPIO pins on the mainboard will be the output pins and the GPIO pins on the sister board will be the input pins. Henceforth, the sister board will receive input from the mainboard for the song selection and a binary semaphore will play the song.&lt;br /&gt;
&lt;br /&gt;
== '''LED Matrix''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
We use a 32x64 LED matrix consisting of 2048 LEDs arranged in 32 rows and 64 columns each, with each led having separate Red, Green, and Blue LED chips assembled together as a single unit. This 32x64 LED matrix is comprised of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like the coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column. A layout of pins and connections can be seen below:&lt;br /&gt;
&lt;br /&gt;
[[File:LED_Bubble_Shooter_Pin_Layout.png|800x300px |thumb|left|LED Matrix and SJ2 Connections]]&lt;br /&gt;
[[File:LED_Ribbon.png|800x300px |thumb|right|LED Matrix Ribbon Connector]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| LED Matrix Pins&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Connection to SJTwo board&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B0&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| R1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 4.28&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.6&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| G1&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.8&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| A&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.23&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| B&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.29&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| C&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.1&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| D&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 2.4&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| CLK&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 0.26&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| STB&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.31&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| OE&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Pin 1.20&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R0, G0, B0) and 3 for the bottom half(R1, G1, B1). The three drivers for R, G, and B share an SCLK, Latch, and OE signal. The top half pixels of the matrix controlled by R0, G0, B0 are rows 0-15, and the second half controlled by R1, G1, B1 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of the corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.&lt;br /&gt;
&lt;br /&gt;
'''LED Matrix Specifications:'''&lt;br /&gt;
&lt;br /&gt;
5V regulated power input, 4A max (all LEDs on)&lt;br /&gt;
&lt;br /&gt;
2.1 mm x 2.1 mm LED size&lt;br /&gt;
&lt;br /&gt;
1/16 Scan Rate&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:LED Matrix Schematic.png|800x300px |thumb|left|LED Matrix Interfacing]]&lt;br /&gt;
|[[File:LED Bubble Shooter.png|800x300px |thumb|center|Start Screen of the game]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Game''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The game has 3 levels apart from the main menu, Credit scene, and Game-over screen. Just like any other arcade game, the game only starts when you earn credits and it is earned by pressing a button. The game begins with the press of another button. A block of bubbles starts falling down with every turn and finishes if it touches the danger line below. Bubbles, when hit with similar color, get destroyed and the game advances to the next level when all the bubbles on the screen are cleared. There's also a hack to traverse through levels, just press the credit score button and it will do the job for you. But hey, that's a cheat code, so you're a cheater!&lt;br /&gt;
&lt;br /&gt;
'''RGB Color Combo'''&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Red&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Blue&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Green&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| Color&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| White&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Blue&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Green&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Cyan&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| Red&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| Magenta&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| Yellow&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;black&amp;quot;&amp;gt; '''Implementation''' &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. Initialize the LED matrix by configuring necessary pin directions.&lt;br /&gt;
&lt;br /&gt;
2. Disable Output Enable (OE) GPIO before feeding matrix data.&lt;br /&gt;
&lt;br /&gt;
3. Select the required row by setting bits on A, B, C, D GPIO pins.&lt;br /&gt;
&lt;br /&gt;
4. Loop through the pixels (columns) in the selected row and set the pixel color on R, G, B GPIO pins.&lt;br /&gt;
&lt;br /&gt;
5. Set zero on R, G, B GPIO pins to mask that particular pixel.&lt;br /&gt;
&lt;br /&gt;
6. Set and Reset the clock for pushing the R, G, B bits for each column.&lt;br /&gt;
&lt;br /&gt;
7. Issue latch to mark the row's completion and reset the latch before going to the next row.&lt;br /&gt;
&lt;br /&gt;
8. Follow steps 2 to 7 for other rows.&lt;br /&gt;
&lt;br /&gt;
 for (uint8_t row = 0; row &amp;lt; (MAX_ROW); row++) {&lt;br /&gt;
      disableOE();&lt;br /&gt;
      set_row(row);&lt;br /&gt;
      for (uint8_t col = 0; col &amp;lt; MAX_COL; col++) {&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
        set_color_bottom(game_matrix[row + (MAX_ROW / 2)][col]);&lt;br /&gt;
        set_color_top(game_matrix[row][col]);&lt;br /&gt;
        LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; CLK);&lt;br /&gt;
      }&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN |= (1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      LPC_GPIO0-&amp;gt;PIN &amp;amp;= ~(1 &amp;lt;&amp;lt; LAT);&lt;br /&gt;
      enableOE();&lt;br /&gt;
      vTaskDelay(1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Graphics Driver ===&lt;br /&gt;
We have managed to program the graphics in a relatively simple way by looking at the ADAFruit gfx library that comes ready to use with Arduino. Our graphics driver can implement graphics and animations such as letters, numbers, ball appearance and ball disappearance etc.&lt;br /&gt;
&lt;br /&gt;
 void place_launcher(LedMatrixDisplay led_display, pixel_color rgb, gfx__cursor start_cursor, bool &lt;br /&gt;
 choose_back_frame) {&lt;br /&gt;
  &lt;br /&gt;
 game_event object_property = BACKGROUND_OBJECT;&lt;br /&gt;
 rgb.event = object_property;&lt;br /&gt;
&lt;br /&gt;
 draw_line(led_display, rgb, ROTATION_90, start_cursor, 9, choose_back_frame);&lt;br /&gt;
&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 0, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 1, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 2, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 3, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 4, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 5, start_cursor.y + 5, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 6, start_cursor.y + 4, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 7, start_cursor.y + 3, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 1, choose_back_frame);&lt;br /&gt;
 modify_pixel(led_display, rgb, start_cursor.x + 8, start_cursor.y + 2, choose_back_frame);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
[[File:level.jpg|500x300px |thumb|left|Game Level 1]]&lt;br /&gt;
|[[File:gameover.png|500x300px |thumb|right|Game Over Screen]]&lt;br /&gt;
|[[File:graphics.jpg|400x200px |thumb|center|Graphics display]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Game Engine''' ==&lt;br /&gt;
[[File:game logic.jpeg|1000x1000px|thumb|center|Game Design]]&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
1. RGB LED Matrix Display driver&lt;br /&gt;
&lt;br /&gt;
a) Setting up the LED Matrix was a bit of a challenge. Started with glowing a single row and column. Getting the initial hold on the exact row and column position was a bit tricky as one can easily get confuse on the starting and ending row and column. Once we got over it we moved on to design game objects separately.&lt;br /&gt;
&lt;br /&gt;
b) Flickering of led matrix was solved by doing the following:&lt;br /&gt;
&lt;br /&gt;
The frequency of refreshing the led matrix was increased to show smooth transition from one frame to another.&lt;br /&gt;
Led matrix is very sensitive to the inputs provided to it. Initially the flickering was thought to be because of the data lines and row selection lines. But later with further diagnoses it was discovered that the power supply line was creating issues. Changing the adapter eliminated the flickering.&lt;br /&gt;
&lt;br /&gt;
2. Designing the MP3 Decoder&lt;br /&gt;
&lt;br /&gt;
a) Earlier we used the ssp2 Driver written by Preet for SPI interfacing to write the data to MP3 Decoder. but somehow we were not able to detect the slave properly because of which we could not communicate with the decoder.&lt;br /&gt;
&lt;br /&gt;
Resolution : We wrote our own simple SPI driver which sends the data to the MP3 Decoder for playing the music in background.&lt;br /&gt;
b) While reading data from the SD Card sometimes we faced few issues like hardware error occured in disk i/o and physical drive cannot work.&lt;br /&gt;
&lt;br /&gt;
Resolution : The default driver was using mount later option for SD Card we changed it to mount immediately and the issue got resolved.&lt;br /&gt;
&lt;br /&gt;
3. Integration Issues&lt;br /&gt;
&lt;br /&gt;
a) Game logic was developed independently&lt;br /&gt;
&lt;br /&gt;
Careful time and consideration had to be taken to ensure that the APIs were able to be stitched together. This actually ended up going smoother than we had anticipated. The Inter-board communication driver was designed to handle almost everything regarding the controllers, providing very abstract and simple APIs. This allowed for relatively smooth integration.&lt;br /&gt;
&lt;br /&gt;
b) After game and controller logic, the main SJ2 did not have enough processing power to adequately driver the music functionality.&lt;br /&gt;
&lt;br /&gt;
A standalone SJ2 board was used for the game soundtrack. This eased the load on our main board which was starting to effect our gameplay&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This project was a fun and strenuous application of our engineering and project management skills.&lt;br /&gt;
&lt;br /&gt;
After completing the driver labs during CMPE 244, we felt confident that we could develop a driver, for the Adafruit LED matrix, without using any third party libraries. We researched the hardware operations of the LED matrix and how to drive the RGB LED's. Once we could control LED's one at a time, the project evolved from an engineering problem into more of a creative exercise.&lt;br /&gt;
&lt;br /&gt;
Overall I think the biggest lessons that we learned is project management based. We spent a lot of time choosing between various game designs and it forced us to start our final iteration later than we would have liked. However, we bonded together and worked hard and managed to get the game working.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
*[https://www.youtube.com/watch?v=Ahn2QugTaZU&amp;amp;feature=youtu.be Project Demo]&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
* [https://gitlab.com/akshatbhutiani/bubble-shooter Project Source Code]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
We would like to sincerely thank Professor Preetpal Kang for his allround guidance, feedback and support. His classroom lectures were significant in imparting knowledge on embedded systems. Further, we would like to thank the ISA team for their advice.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*  [https://www.adafruit.com/product/512 ADA512 data sheet]&lt;br /&gt;
*  [https://www.sparkfun.com/products/14718 Sparkfun LED Matrix datasheet]&lt;/div&gt;</summary>
		<author><name>Proj user7</name></author>	</entry>

	</feed>