<?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+user11</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+user11"/>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php/Special:Contributions/Proj_user11"/>
		<updated>2026-05-06T06:48:31Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73015</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73015"/>
				<updated>2025-04-18T00:40:02Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Project Video */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Sneha Odugoudar,&lt;br /&gt;
Chaitanya Battula   &lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://www.youtube.com/shorts/M-55DsjzMPM&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/sneha.odugoudar/balance-blitz&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73014</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73014"/>
				<updated>2025-04-18T00:39:44Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Project Source Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Sneha Odugoudar,&lt;br /&gt;
Chaitanya Battula   &lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/sneha.odugoudar/balance-blitz&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73013</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73013"/>
				<updated>2025-03-13T04:44:04Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Hardware Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Sneha Odugoudar,&lt;br /&gt;
Chaitanya Battula   &lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73012</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73012"/>
				<updated>2025-03-13T04:43:38Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Hardware Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Sneha Odugoudar,&lt;br /&gt;
Chaitanya Battula   &lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Strat_Screen.png&amp;diff=73011</id>
		<title>File:Strat Screen.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Strat_Screen.png&amp;diff=73011"/>
				<updated>2025-03-13T04:43:14Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: Proj user11 uploaded a new version of File:Strat Screen.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73010</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73010"/>
				<updated>2025-03-13T04:34:19Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Technical Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Sneha Odugoudar,&lt;br /&gt;
Chaitanya Battula   &lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Realtime_OS_on_Embedded_Systems&amp;diff=73009</id>
		<title>Realtime OS on Embedded Systems</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Realtime_OS_on_Embedded_Systems&amp;diff=73009"/>
				<updated>2025-03-13T04:26:07Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /*  Fall 2024 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Program History ==&lt;br /&gt;
My contribution in Embedded System courses started with CmpE146.  This course teaches students on how to write UART, SPI, and I2C Drivers and interface their drivers to peripherals.  There are about 8 weekly labs in which students not only write drivers, but also learn the core of Real-time Operating Systems including threading (tasks), and inter-task communication using Queues and Semaphores.  FreeRTOS is the operating system used with C/C++ Compiler based on GNU.&lt;br /&gt;
&lt;br /&gt;
When the course was started by Dr. Ozemek @ SJSU (sometime before 2005), not many resources were out there.  Still, with helpful guidance from Dr. Ozemek, interesting projects were created.  This is when I started to help out in Embedded System Courses, and by collecting and sharing knowledge, we've raised the bar at SJSU!  &lt;br /&gt;
&lt;br /&gt;
There have been many great projects at SJSU, but since no one knew about them, the hard work went to a waste for anyone but the creator.  But now we've got the infrastructure to share the projects, which turn out as great references for future students.  Here is my project that started around 2007, and turned into Bachelor's Senior Design Project: &amp;lt;br/&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=QEadXdRl3ws&amp;amp;feature=plcp YouTube Video of Self-Navigating Car]&lt;br /&gt;
&lt;br /&gt;
As of 2013, I have broadened my contribution to other embedded system courses like CmpE240, CmpE243 and CmpE244.&lt;br /&gt;
&lt;br /&gt;
== Lab Assignments ==&lt;br /&gt;
This article contains laboratory assignments and resources.  The assignments are under construction as we move towards SJ-One development board.&lt;br /&gt;
*  [[Embedded System Tutorial Tasks | Lesson 0: Multiple Tasks]]&lt;br /&gt;
*  [[Embedded System Tutorial GPIO | Lesson 1 : GPIO]]&lt;br /&gt;
*  [[Embedded System Tutorial UART | Lesson 2 : UART]]&lt;br /&gt;
*  [[Embedded System Tutorial SPI  | Lesson 3 : SPI]]&lt;br /&gt;
*  [[Embedded System I2C Tutorial  | Lesson 4 : I2C]]&lt;br /&gt;
*  [[Embedded System Tutorial Interrupts | Lesson 5 : Interrupts]]&lt;br /&gt;
*  [[Embedded System Tutorial FreeRTOS | Lesson 6 : FreeRTOS Tasks]]&lt;br /&gt;
*  [[Embedded System Tutorial File I/O | Lesson 7 : FreeRTOS Application Programming]]&lt;br /&gt;
&lt;br /&gt;
==== Class Project ====&lt;br /&gt;
* [[MP3 Player]]&lt;br /&gt;
&lt;br /&gt;
==Other reference articles==&lt;br /&gt;
*  [[Bitmasking Tutorial]] (+ GPIO Example)&lt;br /&gt;
*  [[ LPC17xx Memory Map &amp;amp; Interrupts]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Senior Design Projects ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Semester Projects ==&lt;br /&gt;
Every semester, students are given about 7-10 weeks to complete their projects.  During this short time-span, students form groups, order parts, and begin working on their projects.  The work performed during the semester is documented at this Wiki.&lt;br /&gt;
&lt;br /&gt;
Here is the list of Preet's documented projects:&amp;lt;BR/&amp;gt;&lt;br /&gt;
*  [[Preet's Relay Controller Project]]&lt;br /&gt;
*  [[Nordic Low Powered Mesh Network stack]]&lt;br /&gt;
*  [http://www.youtube.com/watch?v=QEadXdRl3ws&amp;amp;feature=plcp Senior Design Project (MS-CmpE) Video]&lt;br /&gt;
&lt;br /&gt;
Here is another resource for good project references :&lt;br /&gt;
[http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/ Cornell EE476 Projects]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2024 | Fall 2024]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F24: Dodge Cars]]&lt;br /&gt;
*  [[F24: Rival Rush]]&lt;br /&gt;
*  [[F24: Space 6]]&lt;br /&gt;
*  [[F24: Bounce Tales]]&lt;br /&gt;
*  [[F24: Tilt Maze]]&lt;br /&gt;
*  [[F24: Jardinains]]&lt;br /&gt;
*  [[F24: Survival Dodge]]&lt;br /&gt;
*  [[F24: Brick Breaker]]&lt;br /&gt;
*  [[F24: Space Fire]]&lt;br /&gt;
*  [[F24: Brick Breaker]]&lt;br /&gt;
*  [[F24: Ball Balancing Game]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2022 | Fall 2022]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F22: DDRTOS]]&lt;br /&gt;
*  [[F22: xGameCreate]]&lt;br /&gt;
*  [[F22: Embedded Gamers]]&lt;br /&gt;
*  [[F22: Bob Burgers]]&lt;br /&gt;
*  [[F22: Space Warriors]]&lt;br /&gt;
*  [[F22: Thunder Flash]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2021 | Fall 2021]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F21: ACE MARIO]]&lt;br /&gt;
*  [[F21: Skeh-lleybones]]&lt;br /&gt;
*  [[F21: Sons of Ultron]]&lt;br /&gt;
*  [[F21: Juvenile Jumpers]]&lt;br /&gt;
*  [[F21: Treasure Dive]]&lt;br /&gt;
*  [[F21: FollowMe]]&lt;br /&gt;
*  [[F21: Flame Over]]&lt;br /&gt;
*  [[F21: Space Rage]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2020 | Fall 2020]] ===&lt;br /&gt;
*  [[F20: Jubeat]]&lt;br /&gt;
*  [[F20: Flappy]]&lt;br /&gt;
*  [[F20: Space Invaders]]&lt;br /&gt;
*  [[F20: Treasure Diver]]&lt;br /&gt;
*  [[F20: Tom &amp;amp; Jerry]]&lt;br /&gt;
*  [[F20: Hungry Snake]]&lt;br /&gt;
*  [[F20: Son of a Gun]]&lt;br /&gt;
*  [[F20: Corona Run]]&lt;br /&gt;
*  [[F20: Maddening Marbles]]&lt;br /&gt;
*  [[F20: Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2019 | Fall 2019]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F19: Smacman]]&lt;br /&gt;
*  [[F19: Tetris]]&lt;br /&gt;
*  [[F19: Space Impact]]&lt;br /&gt;
*  [[F19: Road Max Fury]]&lt;br /&gt;
*  [[F19: T-Rex Run!]]&lt;br /&gt;
*  [[F19: Infinity Mirror]]&lt;br /&gt;
*  [[F19: Tower Defense in Space]]&lt;br /&gt;
*  [[F19: Alien Wars]]&lt;br /&gt;
*  [[F19: Pocket tank]]&lt;br /&gt;
*  [[F19: M&amp;amp;B (Morph &amp;amp; Blend)]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2018 | Fall 2018]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F18: Flappy Bird]]&lt;br /&gt;
*  [[F18: Catch me if you can]]&lt;br /&gt;
*  [[F18: Zero Zero UFO]]&lt;br /&gt;
*  [[F18: Goals of Glory]]&lt;br /&gt;
*  [[F18: Spartan Warrior]]&lt;br /&gt;
*  [[F18: Wireless sensor network]]&lt;br /&gt;
*  [[F18: baem geim]]&lt;br /&gt;
*  [[F18: Hit the Balloon]]&lt;br /&gt;
*  [[F18: 2048]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2018 | Spring 2018]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[S18: Team Nemesis(SJSU Cam)]]&lt;br /&gt;
*  [[S18: Death Race]]&lt;br /&gt;
*  [[S18: Hand gesture controlled multiplayer game]]&lt;br /&gt;
*  [[S18: Smart Rock Paper Scissors]]&lt;br /&gt;
*  [[S18: Spybot]]&lt;br /&gt;
*  [[S18: Audio Spectrum Analyzer with Graphics Display]]&lt;br /&gt;
*  [[S18: XY-Plotter]]&lt;br /&gt;
*  [[S18: RGB LED Sound Behavior on a Skateboard]]&lt;br /&gt;
*  [[S18: Spark - MP3 Music Player with Audio Spectrum]]&lt;br /&gt;
*  [[S18: Traffic Menace Video Game]]&lt;br /&gt;
*  [[S18: M.E.O.W]]&lt;br /&gt;
*  [[S18: Rahee]]&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2017 | Spring 2017]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[S17: Wake up Barista]]&lt;br /&gt;
*  [[S17: Propeller Clock]]&lt;br /&gt;
*  [[S17: Sky Knight]]&lt;br /&gt;
*  [[S17: MyAutoHealth]]&lt;br /&gt;
*  [[S17: Logan]]&lt;br /&gt;
*  [[S17: ElectricBoard]]&lt;br /&gt;
*  [[S17: CamBot]]&lt;br /&gt;
*  [[S17: Sphero Droid]]&lt;br /&gt;
*  [[S17: Smart Planter]]&lt;br /&gt;
*  [[S17: Boom-Z Equalizer]]&lt;br /&gt;
*  [[S17: Interactive Snake and ladder ]]&lt;br /&gt;
*  [[S17: Smart Health Gear]]&lt;br /&gt;
*  [[S17: Halo]]&lt;br /&gt;
*  [[S17: Squad]]&lt;br /&gt;
*  [[S17: Smart security system]]&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2016 | Fall 2016]] ===&lt;br /&gt;
&lt;br /&gt;
CMPE146:&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=F16:_Seismograph F16: Seismograph]&lt;br /&gt;
* [[F16: Piano Glove]]&lt;br /&gt;
* [[F16: Object Detector]]&lt;br /&gt;
* [[F16: Autonomous Nautical System]]&lt;br /&gt;
* [[F16: Autonomous Fire Extinguishing Vehicle]]&lt;br /&gt;
* [[F16: Autonomous Runaway Alarm Car]]&lt;br /&gt;
* [[F16: E-Bike]]&lt;br /&gt;
* [[F16: NotifyBox]]&lt;br /&gt;
* [[F16: Wireless Tilt Controlled Camera Arm]]&lt;br /&gt;
* [[F16: OBD2 Reader]]&lt;br /&gt;
* [[F16: Micro Watch Monitoring System]]&lt;br /&gt;
* [[F16: Door Alarm System]]&lt;br /&gt;
* [[http://www.socialledge.com/sjsu/index.php?title=F16:_I2Coffee F16: UART Coffee]]&lt;br /&gt;
* [[F16: SJone to FPGA wireless integration]]&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2016 | Spring 2016]] ===&lt;br /&gt;
*  [[S16: Fantastic Four]]&lt;br /&gt;
*  [[S16: Simpsons]]&lt;br /&gt;
*  [[S16: Mars 1]]&lt;br /&gt;
*  [[S16: OpenSJ Bluz]]&lt;br /&gt;
*  [[S16: Motion Copy Bot]]&lt;br /&gt;
*  [[S16: Biker Assist]]&lt;br /&gt;
*  [[S16: Helios]]&lt;br /&gt;
*  [[S16: Sound Buddy]]&lt;br /&gt;
*  [[S16: Warriors]]&lt;br /&gt;
*  [[S16: Expendables]]&lt;br /&gt;
*  [[S16: Ahava]]&lt;br /&gt;
*  [[S16: Number 1]]&lt;br /&gt;
*  [[S16: SkyNet]]&lt;br /&gt;
*  [[S16: SmartDoorLock]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cmpe 146:&lt;br /&gt;
*  [[S16: Camera Gimbal]]&lt;br /&gt;
*  [[S16: Laser Harp]]&lt;br /&gt;
*  &amp;lt;strike&amp;gt;[[S16: Laser Cutter Motor Controller]]&amp;lt;/strike&amp;gt;&lt;br /&gt;
*  [[S16: Sprinkler]]&lt;br /&gt;
*  [[S16: The Jatrick Car]]&lt;br /&gt;
*  [[S16: Dan]]&lt;br /&gt;
*  [[S16: Robolamp]]&lt;br /&gt;
*  [[S16: Pinball]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2015 | Fall 2015]] ===&lt;br /&gt;
&lt;br /&gt;
CmpE146:&lt;br /&gt;
* [[F15: Autonomous Mobile]]&lt;br /&gt;
* [[F15: Car Report]]&lt;br /&gt;
* [[F15: Electronic Piano]]&lt;br /&gt;
* [[F15: Doorknock over Bluetooth]]&lt;br /&gt;
* [[F15: Smart Car]]&lt;br /&gt;
* [[F15: Plant Control]]&lt;br /&gt;
* [[F15: Laser Security System]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE244 Spring 2015 | Spring 2015]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[S15: Quadcopter - It flies]]&lt;br /&gt;
* [[S15: Remote Learner]]&lt;br /&gt;
* [[S15: Protocol Interface: I2C - CAN Bridge]]&lt;br /&gt;
* [[S15: Vision RC Car]]&lt;br /&gt;
* [[S15: SJeight Octocopter]]&lt;br /&gt;
* [[S15: Swarm Robots]]&lt;br /&gt;
* [[S15: Smart Sparta Parking System]]&lt;br /&gt;
* [[S15: Touch Navigator]]&lt;br /&gt;
* [[S15: Wizard's Chess System]]&lt;br /&gt;
* [[S15: Bug Rider]]&lt;br /&gt;
* [[S15: Real Time Brake Assist (RTBA)]]&lt;br /&gt;
* [[S15: Wireless Mesh Network]]&lt;br /&gt;
* [[S15: Wireless Power Transfer System]]&lt;br /&gt;
* [[S15: Drone]]&lt;br /&gt;
* [[S15: Tree Node using Google Protocol Buffers]]&lt;br /&gt;
* [[S15: Multi-media Car]]&lt;br /&gt;
* [[S15: Hand Gesture Recognition using IR Sensors]]&lt;br /&gt;
* [[S15: CAN controlled RGB LED cubes]]&lt;br /&gt;
* [[S15: Rubik's Cube Solver]]&lt;br /&gt;
* [[S15: RFID Security Box]]&lt;br /&gt;
* [[S15: Automated Meeting Room Reservation]]&lt;br /&gt;
* [[S15: Patient Buddy System (PBS)]]&lt;br /&gt;
&lt;br /&gt;
CmpE146:&lt;br /&gt;
* [[S15: Hovercopter]]&lt;br /&gt;
* [[S15: Triclops: Smart RC Car]]&lt;br /&gt;
* [[S15: Connect Four - Robotic Player]]&lt;br /&gt;
* [[S15: Self-Balancing Robot]]&lt;br /&gt;
* [[S15: MP3 Player with Graphic Equalizer Display]]&lt;br /&gt;
* [[S15: Motion-Controlled RC Car]]&lt;br /&gt;
* [[S15: MENL (Monster Encounter Night Light) ]]&lt;br /&gt;
* [[S15: Tilt Motion Controlled LED Alarm Clock]]&lt;br /&gt;
* [[S15: Alarm Based Coffee Maker]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE244 Spring 2014 | Spring 2014]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*  Senior Project: [[Project Advising: Remote Security System]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[S14: Quadcopter]]&lt;br /&gt;
* [[S14: Smart Weather Clock]]&lt;br /&gt;
* [[S14: Divine WINd]]&lt;br /&gt;
* [[S14: Data Acquisition using CAN bus]]&lt;br /&gt;
* [[S14: E-Ink Display for Shopping Tags]]&lt;br /&gt;
* [[S14: Spectrum Analyzer for Audio Frequency Signals]]&lt;br /&gt;
* [[S14: CAN Firmware Uploader]]&lt;br /&gt;
* [[S14: Asset Management and Location System]]&lt;br /&gt;
* [[S14: Location  Tracker]]&lt;br /&gt;
* [[S14:  Androbot]]&lt;br /&gt;
* [[S14: Virtual Dog]]&lt;br /&gt;
* [[S14: Android based Automation]]&lt;br /&gt;
* [[S14: FaceTime Robo]]&lt;br /&gt;
* [[S14: Wireless Control Car]]&lt;br /&gt;
* [[S14: Power Efficient Security Door System for Light-rail using CAN Bus]]&lt;br /&gt;
* [[S14: Android based home monitoring system]]&lt;br /&gt;
* [[S14: Need For Speed]]&lt;br /&gt;
&lt;br /&gt;
CmpE146&lt;br /&gt;
* [[S14: Hyperintelligent NFC Locker of the Future]]&lt;br /&gt;
* [[S14: Smart Planter]]&lt;br /&gt;
* [[S14: Modular Security System]]&lt;br /&gt;
* [[S14: Autonomous Control System]]&lt;br /&gt;
* [[S14: Anti-Crash Car]]&lt;br /&gt;
* [[S14: Tricopter]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE240 Fall 2013 | Fall 2013]] ===&lt;br /&gt;
&lt;br /&gt;
* [[F13: POV Display]]&lt;br /&gt;
* [[F13: Line Following Robot]]&lt;br /&gt;
* [[F13: LED Display]]&lt;br /&gt;
* [[F13: Bulb Ramper]]&lt;br /&gt;
* [[F13: Garage Parking Assistant]]&lt;br /&gt;
* [[F13: Quadcopter]]&lt;br /&gt;
* [[F13: BarkMaster2000]]&lt;br /&gt;
* [[F13: Remote Control Car]]&lt;br /&gt;
* [[F13: Obstacle Avoidance Robot]]&lt;br /&gt;
* [[F13: Vehicle On Board Diagnostics]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Spring 2013 | Spring 2013]] ===&lt;br /&gt;
&lt;br /&gt;
* [[S13: 2D Plotter]]&lt;br /&gt;
* [[S13: Smart Cube]]&lt;br /&gt;
* [[S13: Garage Parking Aid]]&lt;br /&gt;
* [[S13: Smart Security]]&lt;br /&gt;
* [[S13: Door Alarm System]]&lt;br /&gt;
* [[S13: Solar Panel Tracker]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Fall 2012|Fall 2012]] ===&lt;br /&gt;
&lt;br /&gt;
* [[F12: Evil Watchdog]]&lt;br /&gt;
* [[F12: Smart Bulb]]&lt;br /&gt;
* [[F12: All Your Base are Belong to You]]&lt;br /&gt;
* [[F12: Android Controlled MP3]]&lt;br /&gt;
* [[F12: Unified Wireless Health Monitoring System]]&lt;br /&gt;
* [[F12: OBD-II Android Monitor]]&lt;br /&gt;
* [[F12: Self-Driving GPS Following Car]]&lt;br /&gt;
* [[F12: Android Door Lock]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Spring 2012|Spring 2012]] ===&lt;br /&gt;
*  [[S12: FreeRTOS based QuadCopter]]&lt;br /&gt;
*  [[S12: Web-based MP3 Player]]&lt;br /&gt;
*  [[S12: Self Drive Car]]&lt;br /&gt;
*  [[S12: VAndroid]]&lt;br /&gt;
*  [[S12: Traffic Light Sensing Vehicle]]&lt;br /&gt;
*  [[S12: Sound Reader]]&lt;br /&gt;
*  [[S12: Remote Controlled MP3 Player]]&lt;br /&gt;
*  [[S12: Android Controlled Robot]]&lt;br /&gt;
*  [[S12: Eyes-Free GPS]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Handy References ==&lt;br /&gt;
*  [[Sample Project Report]]&lt;br /&gt;
*  [[Project Proposal Guidelines]]&lt;br /&gt;
*  [[CmpE146 Lab. Resources]]&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Realtime_OS_on_Embedded_Systems&amp;diff=73008</id>
		<title>Realtime OS on Embedded Systems</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Realtime_OS_on_Embedded_Systems&amp;diff=73008"/>
				<updated>2025-03-13T04:23:01Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /*  Fall 2024 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Program History ==&lt;br /&gt;
My contribution in Embedded System courses started with CmpE146.  This course teaches students on how to write UART, SPI, and I2C Drivers and interface their drivers to peripherals.  There are about 8 weekly labs in which students not only write drivers, but also learn the core of Real-time Operating Systems including threading (tasks), and inter-task communication using Queues and Semaphores.  FreeRTOS is the operating system used with C/C++ Compiler based on GNU.&lt;br /&gt;
&lt;br /&gt;
When the course was started by Dr. Ozemek @ SJSU (sometime before 2005), not many resources were out there.  Still, with helpful guidance from Dr. Ozemek, interesting projects were created.  This is when I started to help out in Embedded System Courses, and by collecting and sharing knowledge, we've raised the bar at SJSU!  &lt;br /&gt;
&lt;br /&gt;
There have been many great projects at SJSU, but since no one knew about them, the hard work went to a waste for anyone but the creator.  But now we've got the infrastructure to share the projects, which turn out as great references for future students.  Here is my project that started around 2007, and turned into Bachelor's Senior Design Project: &amp;lt;br/&amp;gt;&lt;br /&gt;
[http://www.youtube.com/watch?v=QEadXdRl3ws&amp;amp;feature=plcp YouTube Video of Self-Navigating Car]&lt;br /&gt;
&lt;br /&gt;
As of 2013, I have broadened my contribution to other embedded system courses like CmpE240, CmpE243 and CmpE244.&lt;br /&gt;
&lt;br /&gt;
== Lab Assignments ==&lt;br /&gt;
This article contains laboratory assignments and resources.  The assignments are under construction as we move towards SJ-One development board.&lt;br /&gt;
*  [[Embedded System Tutorial Tasks | Lesson 0: Multiple Tasks]]&lt;br /&gt;
*  [[Embedded System Tutorial GPIO | Lesson 1 : GPIO]]&lt;br /&gt;
*  [[Embedded System Tutorial UART | Lesson 2 : UART]]&lt;br /&gt;
*  [[Embedded System Tutorial SPI  | Lesson 3 : SPI]]&lt;br /&gt;
*  [[Embedded System I2C Tutorial  | Lesson 4 : I2C]]&lt;br /&gt;
*  [[Embedded System Tutorial Interrupts | Lesson 5 : Interrupts]]&lt;br /&gt;
*  [[Embedded System Tutorial FreeRTOS | Lesson 6 : FreeRTOS Tasks]]&lt;br /&gt;
*  [[Embedded System Tutorial File I/O | Lesson 7 : FreeRTOS Application Programming]]&lt;br /&gt;
&lt;br /&gt;
==== Class Project ====&lt;br /&gt;
* [[MP3 Player]]&lt;br /&gt;
&lt;br /&gt;
==Other reference articles==&lt;br /&gt;
*  [[Bitmasking Tutorial]] (+ GPIO Example)&lt;br /&gt;
*  [[ LPC17xx Memory Map &amp;amp; Interrupts]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Senior Design Projects ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
== Semester Projects ==&lt;br /&gt;
Every semester, students are given about 7-10 weeks to complete their projects.  During this short time-span, students form groups, order parts, and begin working on their projects.  The work performed during the semester is documented at this Wiki.&lt;br /&gt;
&lt;br /&gt;
Here is the list of Preet's documented projects:&amp;lt;BR/&amp;gt;&lt;br /&gt;
*  [[Preet's Relay Controller Project]]&lt;br /&gt;
*  [[Nordic Low Powered Mesh Network stack]]&lt;br /&gt;
*  [http://www.youtube.com/watch?v=QEadXdRl3ws&amp;amp;feature=plcp Senior Design Project (MS-CmpE) Video]&lt;br /&gt;
&lt;br /&gt;
Here is another resource for good project references :&lt;br /&gt;
[http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/ Cornell EE476 Projects]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2024 | Fall 2024]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F24: Dodge Cars]]&lt;br /&gt;
*  [[F24: Rival Rush]]&lt;br /&gt;
*  [[F24: Space 6]]&lt;br /&gt;
*  [[F24: Bounce Tales]]&lt;br /&gt;
*  [[F24: Tilt Maze]]&lt;br /&gt;
*  [[F24: Jardinains]]&lt;br /&gt;
*  [[F24: Survival Dodge]]&lt;br /&gt;
*  [[F24: Brick Breaker]]&lt;br /&gt;
*  [[F24: Space Fire]]&lt;br /&gt;
*  [[F24: Brick Breaker]]&lt;br /&gt;
*  [[F24: Balance Blitz]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2022 | Fall 2022]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F22: DDRTOS]]&lt;br /&gt;
*  [[F22: xGameCreate]]&lt;br /&gt;
*  [[F22: Embedded Gamers]]&lt;br /&gt;
*  [[F22: Bob Burgers]]&lt;br /&gt;
*  [[F22: Space Warriors]]&lt;br /&gt;
*  [[F22: Thunder Flash]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2021 | Fall 2021]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F21: ACE MARIO]]&lt;br /&gt;
*  [[F21: Skeh-lleybones]]&lt;br /&gt;
*  [[F21: Sons of Ultron]]&lt;br /&gt;
*  [[F21: Juvenile Jumpers]]&lt;br /&gt;
*  [[F21: Treasure Dive]]&lt;br /&gt;
*  [[F21: FollowMe]]&lt;br /&gt;
*  [[F21: Flame Over]]&lt;br /&gt;
*  [[F21: Space Rage]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2020 | Fall 2020]] ===&lt;br /&gt;
*  [[F20: Jubeat]]&lt;br /&gt;
*  [[F20: Flappy]]&lt;br /&gt;
*  [[F20: Space Invaders]]&lt;br /&gt;
*  [[F20: Treasure Diver]]&lt;br /&gt;
*  [[F20: Tom &amp;amp; Jerry]]&lt;br /&gt;
*  [[F20: Hungry Snake]]&lt;br /&gt;
*  [[F20: Son of a Gun]]&lt;br /&gt;
*  [[F20: Corona Run]]&lt;br /&gt;
*  [[F20: Maddening Marbles]]&lt;br /&gt;
*  [[F20: Bubble Shooter]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2019 | Fall 2019]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F19: Smacman]]&lt;br /&gt;
*  [[F19: Tetris]]&lt;br /&gt;
*  [[F19: Space Impact]]&lt;br /&gt;
*  [[F19: Road Max Fury]]&lt;br /&gt;
*  [[F19: T-Rex Run!]]&lt;br /&gt;
*  [[F19: Infinity Mirror]]&lt;br /&gt;
*  [[F19: Tower Defense in Space]]&lt;br /&gt;
*  [[F19: Alien Wars]]&lt;br /&gt;
*  [[F19: Pocket tank]]&lt;br /&gt;
*  [[F19: M&amp;amp;B (Morph &amp;amp; Blend)]]&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2018 | Fall 2018]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[F18: Flappy Bird]]&lt;br /&gt;
*  [[F18: Catch me if you can]]&lt;br /&gt;
*  [[F18: Zero Zero UFO]]&lt;br /&gt;
*  [[F18: Goals of Glory]]&lt;br /&gt;
*  [[F18: Spartan Warrior]]&lt;br /&gt;
*  [[F18: Wireless sensor network]]&lt;br /&gt;
*  [[F18: baem geim]]&lt;br /&gt;
*  [[F18: Hit the Balloon]]&lt;br /&gt;
*  [[F18: 2048]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2018 | Spring 2018]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[S18: Team Nemesis(SJSU Cam)]]&lt;br /&gt;
*  [[S18: Death Race]]&lt;br /&gt;
*  [[S18: Hand gesture controlled multiplayer game]]&lt;br /&gt;
*  [[S18: Smart Rock Paper Scissors]]&lt;br /&gt;
*  [[S18: Spybot]]&lt;br /&gt;
*  [[S18: Audio Spectrum Analyzer with Graphics Display]]&lt;br /&gt;
*  [[S18: XY-Plotter]]&lt;br /&gt;
*  [[S18: RGB LED Sound Behavior on a Skateboard]]&lt;br /&gt;
*  [[S18: Spark - MP3 Music Player with Audio Spectrum]]&lt;br /&gt;
*  [[S18: Traffic Menace Video Game]]&lt;br /&gt;
*  [[S18: M.E.O.W]]&lt;br /&gt;
*  [[S18: Rahee]]&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2017 | Spring 2017]] ===&lt;br /&gt;
&lt;br /&gt;
*  [[S17: Wake up Barista]]&lt;br /&gt;
*  [[S17: Propeller Clock]]&lt;br /&gt;
*  [[S17: Sky Knight]]&lt;br /&gt;
*  [[S17: MyAutoHealth]]&lt;br /&gt;
*  [[S17: Logan]]&lt;br /&gt;
*  [[S17: ElectricBoard]]&lt;br /&gt;
*  [[S17: CamBot]]&lt;br /&gt;
*  [[S17: Sphero Droid]]&lt;br /&gt;
*  [[S17: Smart Planter]]&lt;br /&gt;
*  [[S17: Boom-Z Equalizer]]&lt;br /&gt;
*  [[S17: Interactive Snake and ladder ]]&lt;br /&gt;
*  [[S17: Smart Health Gear]]&lt;br /&gt;
*  [[S17: Halo]]&lt;br /&gt;
*  [[S17: Squad]]&lt;br /&gt;
*  [[S17: Smart security system]]&lt;br /&gt;
&amp;lt;BR/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2016 | Fall 2016]] ===&lt;br /&gt;
&lt;br /&gt;
CMPE146:&lt;br /&gt;
* [http://www.socialledge.com/sjsu/index.php?title=F16:_Seismograph F16: Seismograph]&lt;br /&gt;
* [[F16: Piano Glove]]&lt;br /&gt;
* [[F16: Object Detector]]&lt;br /&gt;
* [[F16: Autonomous Nautical System]]&lt;br /&gt;
* [[F16: Autonomous Fire Extinguishing Vehicle]]&lt;br /&gt;
* [[F16: Autonomous Runaway Alarm Car]]&lt;br /&gt;
* [[F16: E-Bike]]&lt;br /&gt;
* [[F16: NotifyBox]]&lt;br /&gt;
* [[F16: Wireless Tilt Controlled Camera Arm]]&lt;br /&gt;
* [[F16: OBD2 Reader]]&lt;br /&gt;
* [[F16: Micro Watch Monitoring System]]&lt;br /&gt;
* [[F16: Door Alarm System]]&lt;br /&gt;
* [[http://www.socialledge.com/sjsu/index.php?title=F16:_I2Coffee F16: UART Coffee]]&lt;br /&gt;
* [[F16: SJone to FPGA wireless integration]]&lt;br /&gt;
&lt;br /&gt;
=== [[Spring 2016 | Spring 2016]] ===&lt;br /&gt;
*  [[S16: Fantastic Four]]&lt;br /&gt;
*  [[S16: Simpsons]]&lt;br /&gt;
*  [[S16: Mars 1]]&lt;br /&gt;
*  [[S16: OpenSJ Bluz]]&lt;br /&gt;
*  [[S16: Motion Copy Bot]]&lt;br /&gt;
*  [[S16: Biker Assist]]&lt;br /&gt;
*  [[S16: Helios]]&lt;br /&gt;
*  [[S16: Sound Buddy]]&lt;br /&gt;
*  [[S16: Warriors]]&lt;br /&gt;
*  [[S16: Expendables]]&lt;br /&gt;
*  [[S16: Ahava]]&lt;br /&gt;
*  [[S16: Number 1]]&lt;br /&gt;
*  [[S16: SkyNet]]&lt;br /&gt;
*  [[S16: SmartDoorLock]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cmpe 146:&lt;br /&gt;
*  [[S16: Camera Gimbal]]&lt;br /&gt;
*  [[S16: Laser Harp]]&lt;br /&gt;
*  &amp;lt;strike&amp;gt;[[S16: Laser Cutter Motor Controller]]&amp;lt;/strike&amp;gt;&lt;br /&gt;
*  [[S16: Sprinkler]]&lt;br /&gt;
*  [[S16: The Jatrick Car]]&lt;br /&gt;
*  [[S16: Dan]]&lt;br /&gt;
*  [[S16: Robolamp]]&lt;br /&gt;
*  [[S16: Pinball]]&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[Fall 2015 | Fall 2015]] ===&lt;br /&gt;
&lt;br /&gt;
CmpE146:&lt;br /&gt;
* [[F15: Autonomous Mobile]]&lt;br /&gt;
* [[F15: Car Report]]&lt;br /&gt;
* [[F15: Electronic Piano]]&lt;br /&gt;
* [[F15: Doorknock over Bluetooth]]&lt;br /&gt;
* [[F15: Smart Car]]&lt;br /&gt;
* [[F15: Plant Control]]&lt;br /&gt;
* [[F15: Laser Security System]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;HR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE244 Spring 2015 | Spring 2015]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[S15: Quadcopter - It flies]]&lt;br /&gt;
* [[S15: Remote Learner]]&lt;br /&gt;
* [[S15: Protocol Interface: I2C - CAN Bridge]]&lt;br /&gt;
* [[S15: Vision RC Car]]&lt;br /&gt;
* [[S15: SJeight Octocopter]]&lt;br /&gt;
* [[S15: Swarm Robots]]&lt;br /&gt;
* [[S15: Smart Sparta Parking System]]&lt;br /&gt;
* [[S15: Touch Navigator]]&lt;br /&gt;
* [[S15: Wizard's Chess System]]&lt;br /&gt;
* [[S15: Bug Rider]]&lt;br /&gt;
* [[S15: Real Time Brake Assist (RTBA)]]&lt;br /&gt;
* [[S15: Wireless Mesh Network]]&lt;br /&gt;
* [[S15: Wireless Power Transfer System]]&lt;br /&gt;
* [[S15: Drone]]&lt;br /&gt;
* [[S15: Tree Node using Google Protocol Buffers]]&lt;br /&gt;
* [[S15: Multi-media Car]]&lt;br /&gt;
* [[S15: Hand Gesture Recognition using IR Sensors]]&lt;br /&gt;
* [[S15: CAN controlled RGB LED cubes]]&lt;br /&gt;
* [[S15: Rubik's Cube Solver]]&lt;br /&gt;
* [[S15: RFID Security Box]]&lt;br /&gt;
* [[S15: Automated Meeting Room Reservation]]&lt;br /&gt;
* [[S15: Patient Buddy System (PBS)]]&lt;br /&gt;
&lt;br /&gt;
CmpE146:&lt;br /&gt;
* [[S15: Hovercopter]]&lt;br /&gt;
* [[S15: Triclops: Smart RC Car]]&lt;br /&gt;
* [[S15: Connect Four - Robotic Player]]&lt;br /&gt;
* [[S15: Self-Balancing Robot]]&lt;br /&gt;
* [[S15: MP3 Player with Graphic Equalizer Display]]&lt;br /&gt;
* [[S15: Motion-Controlled RC Car]]&lt;br /&gt;
* [[S15: MENL (Monster Encounter Night Light) ]]&lt;br /&gt;
* [[S15: Tilt Motion Controlled LED Alarm Clock]]&lt;br /&gt;
* [[S15: Alarm Based Coffee Maker]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE244 Spring 2014 | Spring 2014]] ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*  Senior Project: [[Project Advising: Remote Security System]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[S14: Quadcopter]]&lt;br /&gt;
* [[S14: Smart Weather Clock]]&lt;br /&gt;
* [[S14: Divine WINd]]&lt;br /&gt;
* [[S14: Data Acquisition using CAN bus]]&lt;br /&gt;
* [[S14: E-Ink Display for Shopping Tags]]&lt;br /&gt;
* [[S14: Spectrum Analyzer for Audio Frequency Signals]]&lt;br /&gt;
* [[S14: CAN Firmware Uploader]]&lt;br /&gt;
* [[S14: Asset Management and Location System]]&lt;br /&gt;
* [[S14: Location  Tracker]]&lt;br /&gt;
* [[S14:  Androbot]]&lt;br /&gt;
* [[S14: Virtual Dog]]&lt;br /&gt;
* [[S14: Android based Automation]]&lt;br /&gt;
* [[S14: FaceTime Robo]]&lt;br /&gt;
* [[S14: Wireless Control Car]]&lt;br /&gt;
* [[S14: Power Efficient Security Door System for Light-rail using CAN Bus]]&lt;br /&gt;
* [[S14: Android based home monitoring system]]&lt;br /&gt;
* [[S14: Need For Speed]]&lt;br /&gt;
&lt;br /&gt;
CmpE146&lt;br /&gt;
* [[S14: Hyperintelligent NFC Locker of the Future]]&lt;br /&gt;
* [[S14: Smart Planter]]&lt;br /&gt;
* [[S14: Modular Security System]]&lt;br /&gt;
* [[S14: Autonomous Control System]]&lt;br /&gt;
* [[S14: Anti-Crash Car]]&lt;br /&gt;
* [[S14: Tricopter]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE240 Fall 2013 | Fall 2013]] ===&lt;br /&gt;
&lt;br /&gt;
* [[F13: POV Display]]&lt;br /&gt;
* [[F13: Line Following Robot]]&lt;br /&gt;
* [[F13: LED Display]]&lt;br /&gt;
* [[F13: Bulb Ramper]]&lt;br /&gt;
* [[F13: Garage Parking Assistant]]&lt;br /&gt;
* [[F13: Quadcopter]]&lt;br /&gt;
* [[F13: BarkMaster2000]]&lt;br /&gt;
* [[F13: Remote Control Car]]&lt;br /&gt;
* [[F13: Obstacle Avoidance Robot]]&lt;br /&gt;
* [[F13: Vehicle On Board Diagnostics]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Spring 2013 | Spring 2013]] ===&lt;br /&gt;
&lt;br /&gt;
* [[S13: 2D Plotter]]&lt;br /&gt;
* [[S13: Smart Cube]]&lt;br /&gt;
* [[S13: Garage Parking Aid]]&lt;br /&gt;
* [[S13: Smart Security]]&lt;br /&gt;
* [[S13: Door Alarm System]]&lt;br /&gt;
* [[S13: Solar Panel Tracker]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Fall 2012|Fall 2012]] ===&lt;br /&gt;
&lt;br /&gt;
* [[F12: Evil Watchdog]]&lt;br /&gt;
* [[F12: Smart Bulb]]&lt;br /&gt;
* [[F12: All Your Base are Belong to You]]&lt;br /&gt;
* [[F12: Android Controlled MP3]]&lt;br /&gt;
* [[F12: Unified Wireless Health Monitoring System]]&lt;br /&gt;
* [[F12: OBD-II Android Monitor]]&lt;br /&gt;
* [[F12: Self-Driving GPS Following Car]]&lt;br /&gt;
* [[F12: Android Door Lock]]&lt;br /&gt;
&lt;br /&gt;
=== [[CmpE146 Spring 2012|Spring 2012]] ===&lt;br /&gt;
*  [[S12: FreeRTOS based QuadCopter]]&lt;br /&gt;
*  [[S12: Web-based MP3 Player]]&lt;br /&gt;
*  [[S12: Self Drive Car]]&lt;br /&gt;
*  [[S12: VAndroid]]&lt;br /&gt;
*  [[S12: Traffic Light Sensing Vehicle]]&lt;br /&gt;
*  [[S12: Sound Reader]]&lt;br /&gt;
*  [[S12: Remote Controlled MP3 Player]]&lt;br /&gt;
*  [[S12: Android Controlled Robot]]&lt;br /&gt;
*  [[S12: Eyes-Free GPS]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Handy References ==&lt;br /&gt;
*  [[Sample Project Report]]&lt;br /&gt;
*  [[Project Proposal Guidelines]]&lt;br /&gt;
*  [[CmpE146 Lab. Resources]]&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73007</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73007"/>
				<updated>2025-01-21T23:02:32Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Technical Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Sneha Odugoudar,&lt;br /&gt;
Chaitanya Battula   &lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73006</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73006"/>
				<updated>2025-01-21T23:02:22Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Technical Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
 Sneha Odugoudar,&lt;br /&gt;
Chaitanya Battula   &lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73005</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=73005"/>
				<updated>2025-01-21T23:02:11Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Technical Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji, Sneha Odugoudar,&lt;br /&gt;
Chaitanya Battula   &lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72902</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72902"/>
				<updated>2024-12-22T01:15:23Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Ball Balancing Game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''LED Pages''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72901</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72901"/>
				<updated>2024-12-22T01:10:23Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Balance Blitz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Balancing the ball]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|left|Game Setup overview]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72900</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72900"/>
				<updated>2024-12-22T01:09:30Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Balance Blitz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|center|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72899</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72899"/>
				<updated>2024-12-22T01:09:01Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Balance Blitz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|right|Balancing the ball|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|center|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72898</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72898"/>
				<updated>2024-12-22T01:08:27Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Balance Blitz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|right | Balancing the ball|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|center | Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72897</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72897"/>
				<updated>2024-12-22T01:07:43Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Balance Blitz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|450px|thumb|left | Balancing the ball|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72896</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72896"/>
				<updated>2024-12-22T01:06:07Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Balance Blitz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|500px|thumb|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72895</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72895"/>
				<updated>2024-12-22T01:05:21Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Balance Blitz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Balancing the ball on the table.png|500px|thumb|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Balancing_the_ball_on_the_table.png&amp;diff=72894</id>
		<title>File:Balancing the ball on the table.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Balancing_the_ball_on_the_table.png&amp;diff=72894"/>
				<updated>2024-12-22T01:03:28Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72893</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72893"/>
				<updated>2024-12-22T00:02:30Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Technical Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Documentation &lt;br /&gt;
| Sneha Odugoudar&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72892</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72892"/>
				<updated>2024-12-22T00:01:21Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Balance Blitz */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|Overview of setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72891</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72891"/>
				<updated>2024-12-22T00:01:02Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Ball Balancing Game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Balance Blitz''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Game Setup]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|Overview of the setup|]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72890</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72890"/>
				<updated>2024-12-21T23:59:55Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Ball Balancing Game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72889</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72889"/>
				<updated>2024-12-21T23:59:35Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Ball Balancing Game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72888</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72888"/>
				<updated>2024-12-21T23:59:12Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Ball Balancing Game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Game_setup.jpg|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Mechanical Design.png |500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Game_setup.jpg&amp;diff=72887</id>
		<title>File:Game setup.jpg</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Game_setup.jpg&amp;diff=72887"/>
				<updated>2024-12-21T23:58:29Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Mechanical_Design.png&amp;diff=72886</id>
		<title>File:Mechanical Design.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Mechanical_Design.png&amp;diff=72886"/>
				<updated>2024-12-21T23:57:33Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: Proj user11 uploaded a new version of File:Mechanical Design.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72885</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72885"/>
				<updated>2024-12-21T23:54:53Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Ball Balancing Game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72884</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72884"/>
				<updated>2024-12-21T23:53:38Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Ball Balancing Game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Counter_to_get_ready.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Counter_to_get_ready.png&amp;diff=72883</id>
		<title>File:Counter to get ready.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Counter_to_get_ready.png&amp;diff=72883"/>
				<updated>2024-12-21T23:53:24Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72882</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72882"/>
				<updated>2024-12-21T23:46:42Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Ball Balancing Game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Strat Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:Score Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Mechanical_Design.png&amp;diff=72881</id>
		<title>File:Mechanical Design.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Mechanical_Design.png&amp;diff=72881"/>
				<updated>2024-12-21T23:42:56Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Score_Screen.png&amp;diff=72880</id>
		<title>File:Score Screen.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Score_Screen.png&amp;diff=72880"/>
				<updated>2024-12-21T23:42:00Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=File:Strat_Screen.png&amp;diff=72879</id>
		<title>File:Strat Screen.png</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=File:Strat_Screen.png&amp;diff=72879"/>
				<updated>2024-12-21T23:37:21Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72878</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72878"/>
				<updated>2024-12-20T08:43:17Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: /* Administrative Responsibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_7&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_23&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_8&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_17&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72715</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72715"/>
				<updated>2024-12-19T19:08:11Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Resitive Table Driver&lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72704</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72704"/>
				<updated>2024-12-19T02:43:57Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Steel Balls (5 pack)&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72703</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72703"/>
				<updated>2024-12-19T02:42:13Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
* Resistive Pad Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Module and Dc female  power jack&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Servo Motors&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72702</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72702"/>
				<updated>2024-12-19T02:38:09Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 71.70&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
*&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72701</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72701"/>
				<updated>2024-12-19T02:36:51Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic strings and charecters.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix - displaying the position of the coordinates of ball on resistive table.&lt;br /&gt;
* Physically integrate resistive pad and joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task ).&lt;br /&gt;
* Physically integrate resistive pad , joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/18/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Stablizing the LED Matrix&lt;br /&gt;
* Fix bugs stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72700</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72700"/>
				<updated>2024-12-19T02:32:17Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
* Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
* 11/03/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Completed servo driver, design proposal for table/platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad.&lt;br /&gt;
* LED Matrix: Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
* 11/10/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Progress towards assembly of platform.&lt;br /&gt;
* Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver.&lt;br /&gt;
* LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/11/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/17/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Continue assembly of platform.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control. Displaying basic timer counting down.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/18/2024&lt;br /&gt;
|&lt;br /&gt;
* 11/24/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Assembly complete.&lt;br /&gt;
* LED Matrix: Progress in LED Matrix control.&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/25/2024 &lt;br /&gt;
| &lt;br /&gt;
* 12/01/2024&lt;br /&gt;
|&lt;br /&gt;
* Physical Platform and Servo Control: Testing and final adjustments.&lt;br /&gt;
* LED Matrix: Display a visualization of the table and a ball on the table. (Ball position to later come from touch pad task queue).&lt;br /&gt;
* Physically integrate touch pad/joystick to table.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 12/02/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/08/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/09/2024&lt;br /&gt;
| &lt;br /&gt;
* 12/15/2024&lt;br /&gt;
|&lt;br /&gt;
* Full integration of project (build complete).&lt;br /&gt;
* Testing and verification.&lt;br /&gt;
* Fix bugs/stabilize physical build if necessary.&lt;br /&gt;
* Present Project.&lt;br /&gt;
|&lt;br /&gt;
* &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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72699</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72699"/>
				<updated>2024-12-19T02:29:31Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
*Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
*111/03/2024&lt;br /&gt;
|&lt;br /&gt;
*Completed servo driver, design proposal for table/platform. Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad. &lt;br /&gt;
*Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
*11/04/2024	&lt;br /&gt;
|&lt;br /&gt;
*11/10/2024&lt;br /&gt;
|&lt;br /&gt;
*Physical Platform and Servo Control: Progress towards assembly of platform. &lt;br /&gt;
*Joystick Driver &amp;amp; Touch Pad Driver: Completed touchpad driver. &lt;br /&gt;
*LED Matrix: LED Matrix basics working.&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 10/31/2022&lt;br /&gt;
|&lt;br /&gt;
* 11/05/2022&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Research how to create objects pattern for display from PNG&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/07/2022&lt;br /&gt;
|&lt;br /&gt;
*11/12/2022&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Display objects on screen &lt;br /&gt;
* Develop ADC driver for joystick interfacing control dynamic movement of player spaceship&lt;br /&gt;
* Create screen scenes in 32x64 matrices&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/14/2022 &lt;br /&gt;
| &lt;br /&gt;
*11/19/2022&lt;br /&gt;
|&lt;br /&gt;
* Integration of circuit boards and microcontroller&lt;br /&gt;
* Develop enemy spaceships game algorithm&lt;br /&gt;
* Control dynamic movement of player spaceship.&lt;br /&gt;
* Create MP3 Driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/21/2022&lt;br /&gt;
| &lt;br /&gt;
* 11/26/2022&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic flow from start to end&lt;br /&gt;
* Develop missile collision and player life algorithm&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;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/28/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/03/2022&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/05/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/10/2022&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of 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/11/2022&lt;br /&gt;
| &lt;br /&gt;
*12/11/2022&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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72698</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72698"/>
				<updated>2024-12-19T02:27:28Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/21/2024	&lt;br /&gt;
|&lt;br /&gt;
* 10/27/2024&lt;br /&gt;
|&lt;br /&gt;
* Complete Research and order all parts. &lt;br /&gt;
*Create overall system design documents and divide project tasks.&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/28/2024	&lt;br /&gt;
| &lt;br /&gt;
*111/03/2024&lt;br /&gt;
|&lt;br /&gt;
*Completed servo driver, design proposal for table/platform. Joystick Driver &amp;amp; Touch Pad Driver: Completed Joystick Driver and understanding of how to get started with a touchpad. &lt;br /&gt;
*Present to team quick rundown of how the LED matrix works. How is it programmed? How to control LEDs?&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/17/2022&lt;br /&gt;
|&lt;br /&gt;
*10/22/2022&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 10/31/2022&lt;br /&gt;
|&lt;br /&gt;
* 11/05/2022&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Research how to create objects pattern for display from PNG&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/07/2022&lt;br /&gt;
|&lt;br /&gt;
*11/12/2022&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Display objects on screen &lt;br /&gt;
* Develop ADC driver for joystick interfacing control dynamic movement of player spaceship&lt;br /&gt;
* Create screen scenes in 32x64 matrices&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/14/2022 &lt;br /&gt;
| &lt;br /&gt;
*11/19/2022&lt;br /&gt;
|&lt;br /&gt;
* Integration of circuit boards and microcontroller&lt;br /&gt;
* Develop enemy spaceships game algorithm&lt;br /&gt;
* Control dynamic movement of player spaceship.&lt;br /&gt;
* Create MP3 Driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/21/2022&lt;br /&gt;
| &lt;br /&gt;
* 11/26/2022&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic flow from start to end&lt;br /&gt;
* Develop missile collision and player life algorithm&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;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/28/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/03/2022&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/05/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/10/2022&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of 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/11/2022&lt;br /&gt;
| &lt;br /&gt;
*12/11/2022&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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72697</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72697"/>
				<updated>2024-12-19T02:21:02Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&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/03/2022&lt;br /&gt;
|&lt;br /&gt;
* 10/8/2022&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group member&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/10/2022   &lt;br /&gt;
| &lt;br /&gt;
*10/15/2022 &lt;br /&gt;
|&lt;br /&gt;
*Order necessary parts&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/17/2022&lt;br /&gt;
|&lt;br /&gt;
*10/22/2022&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 10/31/2022&lt;br /&gt;
|&lt;br /&gt;
* 11/05/2022&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Research how to create objects pattern for display from PNG&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/07/2022&lt;br /&gt;
|&lt;br /&gt;
*11/12/2022&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Display objects on screen &lt;br /&gt;
* Develop ADC driver for joystick interfacing control dynamic movement of player spaceship&lt;br /&gt;
* Create screen scenes in 32x64 matrices&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/14/2022 &lt;br /&gt;
| &lt;br /&gt;
*11/19/2022&lt;br /&gt;
|&lt;br /&gt;
* Integration of circuit boards and microcontroller&lt;br /&gt;
* Develop enemy spaceships game algorithm&lt;br /&gt;
* Control dynamic movement of player spaceship.&lt;br /&gt;
* Create MP3 Driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/21/2022&lt;br /&gt;
| &lt;br /&gt;
* 11/26/2022&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic flow from start to end&lt;br /&gt;
* Develop missile collision and player life algorithm&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;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/28/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/03/2022&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/05/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/10/2022&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of 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/11/2022&lt;br /&gt;
| &lt;br /&gt;
*12/11/2022&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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72696</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72696"/>
				<updated>2024-12-19T02:19:05Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,      &lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Ritu Patil&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Ritu Patil&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/03/2022&lt;br /&gt;
|&lt;br /&gt;
* 10/8/2022&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group member&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/10/2022   &lt;br /&gt;
| &lt;br /&gt;
*10/15/2022 &lt;br /&gt;
|&lt;br /&gt;
*Order necessary parts&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/17/2022&lt;br /&gt;
|&lt;br /&gt;
*10/22/2022&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 10/31/2022&lt;br /&gt;
|&lt;br /&gt;
* 11/05/2022&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Research how to create objects pattern for display from PNG&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/07/2022&lt;br /&gt;
|&lt;br /&gt;
*11/12/2022&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Display objects on screen &lt;br /&gt;
* Develop ADC driver for joystick interfacing control dynamic movement of player spaceship&lt;br /&gt;
* Create screen scenes in 32x64 matrices&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/14/2022 &lt;br /&gt;
| &lt;br /&gt;
*11/19/2022&lt;br /&gt;
|&lt;br /&gt;
* Integration of circuit boards and microcontroller&lt;br /&gt;
* Develop enemy spaceships game algorithm&lt;br /&gt;
* Control dynamic movement of player spaceship.&lt;br /&gt;
* Create MP3 Driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/21/2022&lt;br /&gt;
| &lt;br /&gt;
* 11/26/2022&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic flow from start to end&lt;br /&gt;
* Develop missile collision and player life algorithm&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;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/28/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/03/2022&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/05/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/10/2022&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of 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/11/2022&lt;br /&gt;
| &lt;br /&gt;
*12/11/2022&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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72695</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72695"/>
				<updated>2024-12-19T02:18:30Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji,&lt;br /&gt;
Chaitanya Battula,&lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Sneha Odugoudar&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Servo Motor and resistive Table &lt;br /&gt;
| Chaitanya Battula&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Faaris Khilji&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Ritu Patil&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Ritu Patil&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/03/2022&lt;br /&gt;
|&lt;br /&gt;
* 10/8/2022&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group member&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/10/2022   &lt;br /&gt;
| &lt;br /&gt;
*10/15/2022 &lt;br /&gt;
|&lt;br /&gt;
*Order necessary parts&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/17/2022&lt;br /&gt;
|&lt;br /&gt;
*10/22/2022&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 10/31/2022&lt;br /&gt;
|&lt;br /&gt;
* 11/05/2022&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Research how to create objects pattern for display from PNG&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/07/2022&lt;br /&gt;
|&lt;br /&gt;
*11/12/2022&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Display objects on screen &lt;br /&gt;
* Develop ADC driver for joystick interfacing control dynamic movement of player spaceship&lt;br /&gt;
* Create screen scenes in 32x64 matrices&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/14/2022 &lt;br /&gt;
| &lt;br /&gt;
*11/19/2022&lt;br /&gt;
|&lt;br /&gt;
* Integration of circuit boards and microcontroller&lt;br /&gt;
* Develop enemy spaceships game algorithm&lt;br /&gt;
* Control dynamic movement of player spaceship.&lt;br /&gt;
* Create MP3 Driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/21/2022&lt;br /&gt;
| &lt;br /&gt;
* 11/26/2022&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic flow from start to end&lt;br /&gt;
* Develop missile collision and player life algorithm&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;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/28/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/03/2022&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/05/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/10/2022&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of 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/11/2022&lt;br /&gt;
| &lt;br /&gt;
*12/11/2022&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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72694</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72694"/>
				<updated>2024-12-19T02:15:51Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Faaris Khilji&lt;br /&gt;
Chaitanya Battula&lt;br /&gt;
Sneha Odugoudar&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bluetooth&lt;br /&gt;
| Ritu Patil&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Enclosure&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Bruce Jiang &amp;amp; Phil Bloxom&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Ritu Patil&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Ritu Patil&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/03/2022&lt;br /&gt;
|&lt;br /&gt;
* 10/8/2022&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group member&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/10/2022   &lt;br /&gt;
| &lt;br /&gt;
*10/15/2022 &lt;br /&gt;
|&lt;br /&gt;
*Order necessary parts&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/17/2022&lt;br /&gt;
|&lt;br /&gt;
*10/22/2022&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 10/31/2022&lt;br /&gt;
|&lt;br /&gt;
* 11/05/2022&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Research how to create objects pattern for display from PNG&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/07/2022&lt;br /&gt;
|&lt;br /&gt;
*11/12/2022&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Display objects on screen &lt;br /&gt;
* Develop ADC driver for joystick interfacing control dynamic movement of player spaceship&lt;br /&gt;
* Create screen scenes in 32x64 matrices&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/14/2022 &lt;br /&gt;
| &lt;br /&gt;
*11/19/2022&lt;br /&gt;
|&lt;br /&gt;
* Integration of circuit boards and microcontroller&lt;br /&gt;
* Develop enemy spaceships game algorithm&lt;br /&gt;
* Control dynamic movement of player spaceship.&lt;br /&gt;
* Create MP3 Driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/21/2022&lt;br /&gt;
| &lt;br /&gt;
* 11/26/2022&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic flow from start to end&lt;br /&gt;
* Develop missile collision and player life algorithm&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;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/28/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/03/2022&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/05/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/10/2022&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of 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/11/2022&lt;br /&gt;
| &lt;br /&gt;
*12/11/2022&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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72693</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72693"/>
				<updated>2024-12-19T02:14:32Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
The project aims to create an interactive game where players balance a physical ball on a table by manipulating its tilt with a joystick. The setup involves servo motors that adjust the table's angle in response to joystick movements, striving to prevent the ball from rolling off the edges. The game's interface features an LED matrix display that visualizes the ball's real-time position and provides dynamic feedback through score tracking, a game timer, and animations for various game states such as winning or losing.&lt;br /&gt;
&lt;br /&gt;
Key components include a joystick module, servo motors, and an LED matrix display, alongside a ball, tilt platform, power supply, and a resistive touch screen for enhanced interaction. The system is powered by an SJ2 microcontroller, which coordinates the input from the joystick and the output to the servo motors, ensuring responsive and precise control. This setup challenges players with increasing levels of difficulty, marked by heightened joystick sensitivity.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bluetooth&lt;br /&gt;
| Ritu Patil&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Enclosure&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Bruce Jiang &amp;amp; Phil Bloxom&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Ritu Patil&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Ritu Patil&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/03/2022&lt;br /&gt;
|&lt;br /&gt;
* 10/8/2022&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group member&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/10/2022   &lt;br /&gt;
| &lt;br /&gt;
*10/15/2022 &lt;br /&gt;
|&lt;br /&gt;
*Order necessary parts&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/17/2022&lt;br /&gt;
|&lt;br /&gt;
*10/22/2022&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 10/31/2022&lt;br /&gt;
|&lt;br /&gt;
* 11/05/2022&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Research how to create objects pattern for display from PNG&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/07/2022&lt;br /&gt;
|&lt;br /&gt;
*11/12/2022&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Display objects on screen &lt;br /&gt;
* Develop ADC driver for joystick interfacing control dynamic movement of player spaceship&lt;br /&gt;
* Create screen scenes in 32x64 matrices&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/14/2022 &lt;br /&gt;
| &lt;br /&gt;
*11/19/2022&lt;br /&gt;
|&lt;br /&gt;
* Integration of circuit boards and microcontroller&lt;br /&gt;
* Develop enemy spaceships game algorithm&lt;br /&gt;
* Control dynamic movement of player spaceship.&lt;br /&gt;
* Create MP3 Driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/21/2022&lt;br /&gt;
| &lt;br /&gt;
* 11/26/2022&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic flow from start to end&lt;br /&gt;
* Develop missile collision and player life algorithm&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;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/28/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/03/2022&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/05/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/10/2022&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of 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/11/2022&lt;br /&gt;
| &lt;br /&gt;
*12/11/2022&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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72631</id>
		<title>F24: Ball Balancing Game</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=F24:_Ball_Balancing_Game&amp;diff=72631"/>
				<updated>2024-12-14T21:10:03Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Ball Balancing Game''' ==&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Begin-Screen.png|500px|thumb|left|Start Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-Game-Play.png|500px|thumb|center|Game Play]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22-EG-End-Screen.png|500px|thumb|right|End Screen]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Abstract''' ==&lt;br /&gt;
A horizontal type of space invader game. Players can control the spaceship on the screen composed of an LED matrix in a rectangular shape. The spaceship can shoot horizontally from left to right in order to destroy its enemies. The entire map will flow in the opposite direction of where the spaceship is flying. The speed of the map flow and the number of enemies will increase at higher difficulty levels. The spaceship takes damage from colliding with enemies&lt;br /&gt;
themselves or their bullets. The game will end when the health of the controlled spaceship is depleted.&lt;br /&gt;
&lt;br /&gt;
== '''Objectives &amp;amp; Introduction''' ==&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;
! colspan=&amp;quot;5&amp;quot;| Technical Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Game Logic Development&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* LED Display Driver&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Joystick Controller Driver&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* MP3 Decoder&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bluetooth&lt;br /&gt;
| Ritu Patil&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Enclosure&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Hardware Integration &lt;br /&gt;
| Bruce Jiang &amp;amp; Phil Bloxom&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;
! colspan=&amp;quot;5&amp;quot;| Administrative Roles  &lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; |  &lt;br /&gt;
* Team Leader&lt;br /&gt;
| Ritu Patil&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Git Repository Managers&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Code Reviewers&lt;br /&gt;
| Phil Bloxom&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Wiki Report Manager&lt;br /&gt;
| Bruce Jiang&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot; | &lt;br /&gt;
* Bill of Materials Manager&lt;br /&gt;
| Ritu Patil&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/03/2022&lt;br /&gt;
|&lt;br /&gt;
* 10/8/2022&lt;br /&gt;
|&lt;br /&gt;
* Read previous projects, gather information and discuss among the group member&lt;br /&gt;
* Create GitLab repository for project&lt;br /&gt;
| &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/10/2022   &lt;br /&gt;
| &lt;br /&gt;
*10/15/2022 &lt;br /&gt;
|&lt;br /&gt;
*Order necessary parts&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/17/2022&lt;br /&gt;
|&lt;br /&gt;
*10/22/2022&lt;br /&gt;
|&lt;br /&gt;
*Read and familiarize with LED Matrix Datasheet&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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;
* 10/31/2022&lt;br /&gt;
|&lt;br /&gt;
* 11/05/2022&lt;br /&gt;
|&lt;br /&gt;
* Develop graphics driver for LED matrix and implement initial game objects&lt;br /&gt;
* Research how to create objects pattern for display from PNG&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/07/2022&lt;br /&gt;
|&lt;br /&gt;
*11/12/2022&lt;br /&gt;
|&lt;br /&gt;
* Finalize wiki schedule&lt;br /&gt;
* Display objects on screen &lt;br /&gt;
* Develop ADC driver for joystick interfacing control dynamic movement of player spaceship&lt;br /&gt;
* Create screen scenes in 32x64 matrices&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/14/2022 &lt;br /&gt;
| &lt;br /&gt;
*11/19/2022&lt;br /&gt;
|&lt;br /&gt;
* Integration of circuit boards and microcontroller&lt;br /&gt;
* Develop enemy spaceships game algorithm&lt;br /&gt;
* Control dynamic movement of player spaceship.&lt;br /&gt;
* Create MP3 Driver&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Completed&amp;lt;/span&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;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/21/2022&lt;br /&gt;
| &lt;br /&gt;
* 11/26/2022&lt;br /&gt;
|&lt;br /&gt;
* Integrate game logic flow from start to end&lt;br /&gt;
* Develop missile collision and player life algorithm&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;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 8&lt;br /&gt;
| &lt;br /&gt;
* 11/28/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/03/2022&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/05/2022&lt;br /&gt;
| &lt;br /&gt;
* 12/10/2022&lt;br /&gt;
|&lt;br /&gt;
* Address bugs during testing of 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/11/2022&lt;br /&gt;
| &lt;br /&gt;
*12/11/2022&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;
== '''Bill of Materials (General Parts)''' ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Name&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Part Model &amp;amp; Source&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Quantity&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Cost Per Unit (USD)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Micro-Controller SJ2 Board&lt;br /&gt;
| &lt;br /&gt;
* SJ2 Board (Purchased from Preet Kang)&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
|&lt;br /&gt;
* 50.00&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* RGB LED Matrix&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/2279?gclid=CjwKCAiA9qKbBhAzEiwAS4yeDYSKVkDu50XPdtCaJTeRJYj02YJb-ABAjVX1WBGGtEr2jHvQRfvufhoCA-QQAvD_BwE 64x32 RGB LED Matrix Panel]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 44.95&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Power Supply&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B01N2K48HR/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1 Universal AC/DC Adapter 3V ~ 12V]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 15.98&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* IDC Socket Male&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/gp/product/B08NB8S42K/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;amp;psc=1 IDC Socket Male]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* HC-05 Bluetooth&lt;br /&gt;
| &lt;br /&gt;
* [https://www.amazon.com/DSD-TECH-HC-05-Pass-through-Communication/dp/B01G9KSAF6/ref=mp_s_a_1_3?adgrpid=57552031393&amp;amp;dplnkId=fa65647f-fc92-41f1-a50c-4ac9bfec67f3&amp;amp;gclid=Cj0KCQiAmaibBhCAARIsAKUlaKSJHxYgLW7SP5wMd94uqHWtJ7IlGGyw2zsTxZFHoU3KT5dqm0vMzJcaAjntEALw_wcB&amp;amp;hvadid=609115864507&amp;amp;hvdev=m&amp;amp;hvlocphy=9032166&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=14587583350658056883&amp;amp;hvtargid=kwd-298511473808&amp;amp;hydadcr=20105_13388467&amp;amp;keywords=hc+05+bluetooth+module&amp;amp;nodl=1&amp;amp;qid=1667939624&amp;amp;sr=8-3 HC-05 Bluetooth]&lt;br /&gt;
| &lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* 10&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* Analog Joystick&lt;br /&gt;
| &lt;br /&gt;
* [https://www.adafruit.com/product/512 Analog 2 Axis x-y Thumb Joystick]&lt;br /&gt;
| &lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Overall Design''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
&lt;br /&gt;
[[File:F22_EG_Overall_Design_Diagram_11_18_2022.png|800px|thumb|center|LED Matrix Rear]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
* LED Matrix Display: 13 GPIO channel on SJ2 (1)&lt;br /&gt;
* Joystick connection: 2 ADC channel on SJ2 (1)&lt;br /&gt;
* Bluetooth sender connection: 1 set UART, RX and TX on SJ2 (1)&lt;br /&gt;
* Bluetooth receiver connection: 1 set UART, RX and TX on SJ2 (2) &lt;br /&gt;
* MP3 Decoder connection: SPI communication, MOSI, CS, SCK, on SJ2 (2) &lt;br /&gt;
* Speaker connection: AUX cord&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
* LED Matrix: &lt;br /&gt;
**1. Initialized LED matrix connected pins to board IOs.&lt;br /&gt;
**2. Designed matrix driver for screen display by reading an matrix.&lt;br /&gt;
&lt;br /&gt;
* Joystick:&lt;br /&gt;
**1. Initialized 2 ADC channels for taking the x reading and y reading from joystick.&lt;br /&gt;
**2. Decoded voltage readings into joystick movement commands.&lt;br /&gt;
&lt;br /&gt;
* Buttons:&lt;br /&gt;
**1. Initialized several gpio for taking binary command from button pressed. &lt;br /&gt;
**2. Enabled interrupts for each botton pressed.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player: &lt;br /&gt;
**1. Initialize using UART3.&lt;br /&gt;
**2. Set device with selected sd card and volume.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
* LED Matrix driver functions: &lt;br /&gt;
**1. display_update: reload matrix display for refreshing the changes from the backend matrix.&lt;br /&gt;
**2. display_clear: erase all matrix values, and sets them to zeros.&lt;br /&gt;
**3. overwrite_pattern_to_screen: overite a given pattern onto the existing matrix &lt;br /&gt;
**4. append_pattern_to_screen: append a given pattern onto the existing matrix&lt;br /&gt;
**5. clear_pattern_on_screen: clear the pattern from screen by giving the pattern's current location and width and height.&lt;br /&gt;
&lt;br /&gt;
* Joystick driver:&lt;br /&gt;
**1. joystick_running: run ADC capture on joystick continuesly to monitor user inputs. &lt;br /&gt;
&lt;br /&gt;
* Buttons driver:&lt;br /&gt;
**1. Green button: starts a game, shots a missile, and start the game all over.&lt;br /&gt;
&lt;br /&gt;
* Mp3 Player:&lt;br /&gt;
**1. Play a song.&lt;br /&gt;
**2. Play a song in single cycle.&lt;br /&gt;
**3. Play a song from a folder.&lt;br /&gt;
**4. Pause on play.&lt;br /&gt;
**5. Resume playback.&lt;br /&gt;
&lt;br /&gt;
== '''RGB LED Matrix''' ==&lt;br /&gt;
=== Hardware Design ===&lt;br /&gt;
Below are symbol and footprint for custom component-part in EasyEDA tool. These parts would be used in future PCB design.&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_Schematic.png|800px|thumb|left|LED Matrix and SJ2 Board Connections Schematics]]&lt;br /&gt;
[[File:F22_Embedded_Gamers_LED_Matrix_PCB.png|600px|thumb|center|LED Matrix and SJ2 Board Connections PCB]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface ===&lt;br /&gt;
The 32x64 LED matrix is from Adafruit, with [https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/overview user mannual]. It is composed of two upper and lower sectional LED pannels. Each pannel has R, G, B led channels and A, B, C, and D row control registers. Addtionally, column shift is controlled by Latch bit, clock is controled by CLK, and OE turns LED off when switching rows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|RGB LED Matrix&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_0&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_2&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B1&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_5&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|R2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_1&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|G2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_4&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B2&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|A&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_6&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|B&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_26&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|C&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_16&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|D&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_22&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|CLK&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P2_9&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|LAT&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_20&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|OE&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|VCC&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|5VIN&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|External Power Supply&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|On Board&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_WelcomeScreen.jpg|500px|thumb|left|LED Matrix Front]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_LED_Rear.jpg|500px|thumb|right|LED Matrix Rear]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
LED matrix io and driver is developed for communication between boards and LED matrix. IO driver consists of pin inialization by using gpio.h for each rgb channels, row selection register, CLK, LAT, and OE pins. By using &amp;quot;led_matrix_io.h&amp;quot; developers can using public function led_matrix_io_init and other basic controller functions. &amp;lt;br&amp;gt;&lt;br /&gt;
For LED matrix driver, it is based on the previous IO driver to provide LED screen update, clean, init, and draw functionalities.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*Updating Display: for display to continuously updating screen, a task is assigned for running the display_update function from the driver every 500 milliseconds.&lt;br /&gt;
&lt;br /&gt;
== '''Joystick and Buttons''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table LED Matrix to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Joystick&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Xout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog X Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P0_25&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Yout&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Analog Y Channel&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_30&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Button &lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GPIO&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P1_14&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_Analog_Joystick.png|200px|thumb|right|[https://www.adafruit.com/product/512?gclid=Cj0KCQiA99ybBhD9ARIsALvZavVtFSwQejbcb1pB1_3x5x2FsKY89WqOIHKEsKq_jxfXcSg3rY-AsWQaAlnREALw_wcB Analog Joystick ]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Joystick with voltage input produces two analog channels of outputs from the x and y axises of the joystick. Designed a driver to convert these two analog outputs and convert them into digital signals, then decoded as user movment such as move up, move down, move left, move right, move right up, move right down, move left up, and move left down.&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Rtos Tasks:&lt;br /&gt;
*JoyStick Running: Keep recieving two channels of analog signals and decode them into agent moves corresponding to right, left, up, down, right up, right left, left up, and left down.&lt;br /&gt;
&lt;br /&gt;
== '''Mp3 Decoder''' ==&lt;br /&gt;
&lt;br /&gt;
=== Hardware Interface and Connections===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Connectivity Table Mp3 Player to Sj2 Board:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Mp3 Decoder&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|Pin Description&lt;br /&gt;
! align=&amp;quot;center&amp;quot;|SJ2 Board&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Vcc&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Voltage&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|+3.3V&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Rx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_28&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|Tx&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|UART3&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|P4_29&lt;br /&gt;
|-&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
| scope=&amp;quot;row&amp;quot; align=&amp;quot;center&amp;quot;|GND&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.aliexpress.us/item/3256803093988130.html?pdp_npi=2%40dis%21USD%21US%20%241.67%21%240.99%21%21%21%21%21%40210312ea16702784601312016e68e7%2112000024999658900%21btf&amp;amp;_t=pvid%3Ac6785b98-0d8f-441e-8be9-feb74c7b1693&amp;amp;afTraceInfo=1005003280302882__pc__pcBridgePPC__xxxxxx__1670278460&amp;amp;spm=a2g0o.ppclist.product.mainProduct&amp;amp;gatewayAdapt=glo2usa&amp;amp;_randl_shipto=US Mp3 Player]]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Software Design ===&lt;br /&gt;
Mp3 player driver was created. It initialized UART3 and configured IO connections of RX and Tx. To send command for adust volume, play songs by number, play songs by folder name, and set play songs in cycle, please find the user manual here: [https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view mp3 player user manual]&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
Public Tasks:&lt;br /&gt;
*Initialize device: Select the sd card which has songs on the player&lt;br /&gt;
*Cycle play mode: play a song in single cycle&lt;br /&gt;
*Pause a song &lt;br /&gt;
*Resume playback&lt;br /&gt;
&lt;br /&gt;
== '''Game Logic''' ==&lt;br /&gt;
&lt;br /&gt;
=== Game States ===&lt;br /&gt;
*1. Start Up&lt;br /&gt;
*2. Game Running&lt;br /&gt;
*3. Game Over&lt;br /&gt;
&lt;br /&gt;
=== Player Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Display start up screen once per starting &lt;br /&gt;
*2. Reset game parameters&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Display player and health bar on screen&lt;br /&gt;
*2. Capture and move player location by joystick signals&lt;br /&gt;
*3. Check health and switch to game over state when player's health reaches zero&lt;br /&gt;
*4. Check collision in collision mutex&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Display game over screen&lt;br /&gt;
&lt;br /&gt;
=== Enemy Task=== &lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Spawn enemy according to a timer for different game levels&lt;br /&gt;
*2. Checking enemy collision in collision mutex&lt;br /&gt;
*3. Remove collided enemy within a list of enemy objects&lt;br /&gt;
&lt;br /&gt;
=== Button Task===&lt;br /&gt;
Game state: start up&lt;br /&gt;
*1. Play the back ground music in single cycle &lt;br /&gt;
*2. If the green button is pressed, advanced to game running stage&lt;br /&gt;
&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Play the back groud music in single cycle&lt;br /&gt;
*2. If the green button is pressed, generate missile on screen and play a laser sound&lt;br /&gt;
&lt;br /&gt;
Game state: game over&lt;br /&gt;
*1. Play the game over music in single cycle&lt;br /&gt;
*2. If the green button is pressed, return the state over all back to start up&lt;br /&gt;
&lt;br /&gt;
=== Missile Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. Check missile collision with enemy, player, and the boundary of the screen &lt;br /&gt;
*2. Append missiles in array&lt;br /&gt;
&lt;br /&gt;
=== Score Task ===&lt;br /&gt;
Game state: game running&lt;br /&gt;
*1. If a missile hit an enemy, score plus two &lt;br /&gt;
*2. If an enemy hit the bottom white line, which is our home base, score minus two&lt;br /&gt;
*3. According to the number of score, increase enemy speed and spawn rate by a fix proportion&lt;br /&gt;
&lt;br /&gt;
== '''Testing &amp;amp; Technical Challenges''' ==&lt;br /&gt;
Most of the challenges for our project are bluetooth paring and game logic. For bluetooth to work between two boards, the configuration driver was wrote from scratch, which enable the device, and select paring bluetooth's physical address. For game logic, the problems are making sure the collision happened between mutiple objects with different moving speed. &lt;br /&gt;
&lt;br /&gt;
=== Bug/Issue Name ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Bug Number&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Description&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; | Solution&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 1&lt;br /&gt;
| &lt;br /&gt;
* Two bluetooth device are not talking to each others automatically. &lt;br /&gt;
|&lt;br /&gt;
* Used SJ2 board to configure the bluetooth through UART with AT commands&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 2&lt;br /&gt;
| &lt;br /&gt;
* When a missile hit an enemy on the screen, sometimes, the missile will disapear first but not the enemy, and sometimes, the other way around. &lt;br /&gt;
|&lt;br /&gt;
* Used mutex and pair locks to make sure when collision happened, only erase both objects by receiving both acknowledgments from enemy and missile. &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 3&lt;br /&gt;
| &lt;br /&gt;
* Button debounce issue. &lt;br /&gt;
|&lt;br /&gt;
* The button interrupt from ISR was not performing ideally. By using Preet's suggestion, a simple task of reading the button input solved this problem.  &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* 4&lt;br /&gt;
| &lt;br /&gt;
* Player animation conflicts with moving missile. &lt;br /&gt;
|&lt;br /&gt;
* Disabled missile generation while before playing the animation.  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion''' ==&lt;br /&gt;
Coding a complicated Atari game on a microcontroller is a bit more complicated than we thought before starting. We went through writing our own base line driver for controlling other electronic components. Then, figured out FreeRTOS task API to move each character pixels on the led matrix. During development, we faced all different kind of issues such as button debounce, priority conflicts, parallel logic in sequential programming, and etc. In the end, we truly learned that nothing is for granted, as an embedded engineers we have to do everthing ourselves. This project can be further improved on score system and joystick movements.  &lt;br /&gt;
&lt;br /&gt;
=== Project Video ===&lt;br /&gt;
https://youtu.be/QRE9pQ7dBBg&lt;br /&gt;
&lt;br /&gt;
=== Project Source Code ===&lt;br /&gt;
https://gitlab.com/runfeng.jiang/cmpe-244-space-invader-game/-/tree/main&lt;br /&gt;
&lt;br /&gt;
== '''References''' ==&lt;br /&gt;
=== Acknowledgement ===&lt;br /&gt;
Special thanks to Mr. Preet Kang for his lessons and detailed-documentation website on microcontrollers.&lt;br /&gt;
&lt;br /&gt;
=== References Used ===&lt;br /&gt;
*1. Mp3 user manual: https://usermanual.wiki/Pdf/Serial20MP320Player20v10120Manual.2117229468/view&lt;br /&gt;
*2. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*3. Adafruit LED matrix user manual: https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/&lt;br /&gt;
&lt;br /&gt;
=== Appendix ===&lt;br /&gt;
*1. LPC40xx_FreeRtos Github: https://gitlab.com/sjtwo-c-dev/sjtwo-c&lt;br /&gt;
*2. FreeRTOS: https://www.freertos.org/a00116.html&lt;/div&gt;</summary>
		<author><name>Proj user11</name></author>	</entry>

	</feed>