Difference between revisions of "F24: Space 6"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Parts List & Cost)
(Hardware Interface and Connections)
 
(13 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
</font>
 
</font>
  
== Project Title ==
+
== '''Space 6''' ==
  
 
+
== Introduction ==
Space 6
+
In this project, we've created a version of the classic Space Invaders game. Instead of using a traditional joystick, the player controls the spaceship's movement using a linear potentiometer that responds to touch. The spaceship shoots to destroy enemies, and the entire game map scrolls in the opposite direction of the spaceship's movement. As the game progresses, the speed of the map's flow and the number of enemies increase, adding more challenge. The spaceship's health decreases when it collides with enemies or their bullets, and the game ends when the health reaches zero.
 
 
== Abstract ==
 
  
 
== Objectives & Introduction ==
 
== Objectives & Introduction ==
Line 88: Line 86:
 
* Finalize project schedule and create Wiki page
 
* Finalize project schedule and create Wiki page
 
|
 
|
* <span style="color:orange">In Progress</span>
+
* <span style="color:green">Completed</span>
* <span style="color:orange">In Progress</span>
+
* <span style="color:green">Completed</span>
 
|-
 
|-
 
! scope="row"| 5
 
! scope="row"| 5
Line 101: Line 99:
 
* Connect linear potentiometer and develop ADC functions
 
* Connect linear potentiometer and develop ADC functions
 
|
 
|
* <span style="color:red">Not started</span>
+
* <span style="color:green">Completed</span>
* <span style="color:red">Not started</span>
+
* <span style="color:green">Completed</span>
* <span style="color:red">Not started</span>
+
* <span style="color:green">Completed</span>
 
|-
 
|-
 
! scope="row"| 6
 
! scope="row"| 6
Line 116: Line 114:
  
 
|
 
|
* <span style="color:red">Not started</span>
+
* <span style="color:green">Completed</span>
* <span style="color:red">Not started</span>
+
* <span style="color:green">Completed</span>
* <span style="color:red">Not started</span>
+
* <span style="color:green">Completed</span>
 
|-
 
|-
 
! scope="row"| 7
 
! scope="row"| 7
Line 131: Line 129:
 
* Integrate game sounds with game logic  
 
* Integrate game sounds with game logic  
 
|
 
|
* <span style="color:red">Not started</span>
+
* <span style="color:green">Completed</span>
* <span style="color:red">Not started</span>
+
* <span style="color:green">Completed</span>
 +
* <span style="color:orange">In Progess</span>
 
|-
 
|-
 
! scope="row"| 8
 
! scope="row"| 8
Line 253: Line 252:
 
=== Hardware Interface ===
 
=== Hardware Interface ===
 
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.
 
In this section, you can describe how your hardware communicates, such as which BUSes used.  You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.
 +
 +
== '''Linear Potentiometer''' ==
 +
 +
== '''LED Display 64x64''' ==
 +
 +
== '''MP3 Decoder''' ==
 +
 +
=== Hardware Interface and Connections===
 +
 +
<center>
 +
<table>
 +
<tr>
 +
<td>
 +
Connection Table: MP3 Player to SJ2 Board
 +
{| class="wikitable"
 +
|-
 +
! align="center"|Mp3 Decoder
 +
! align="center"|Pin Description
 +
! align="center"|SJ2 Board
 +
|-
 +
| scope="row" align="center"|Vcc
 +
| scope="row" align="center"|Voltage
 +
| scope="row" align="center"|+3.3V
 +
|-
 +
| scope="row" align="center"|Rx
 +
| scope="row" align="center"|UART2
 +
| scope="row" align="center"|P0_10
 +
|-
 +
| scope="row" align="center"|Tx
 +
| scope="row" align="center"|UART2
 +
| scope="row" align="center"|P0_11
 +
|-
 +
| scope="row" align="center"|GND
 +
| scope="row" align="center"|GND
 +
| scope="row" align="center"|GND
 +
|-
 +
|}
 +
</td>
 +
<td>
 +
[[File:F22_EG_mp3_encoder.png|200px|thumb|right|[https://www.amazon.com/HiLetgo-YX5300-Control-Serial-Arduino/dp/B0725RHR4D?tag=googhydr-20&source=dsa&hvcampaign=electronics&gclid=Cj0KCQiA0--6BhCBARIsADYqyL_BMZ2h-mOcuh5WwG5svWIxx1E1mMnshbjV585AcgeaFOCdNd9oU-waAgZ3EALw_wcB]]]
 +
</td>
 +
<td>
 +
[[File:Screenshot 2024-12-13 112822.png]]
 +
</td>
 +
</tr>
 +
<tr><td>
 +
[[File:Screenshot_2024-12-13_122654.png]]
 +
</td>
 +
</tr>
 +
</table>
 +
</center>
 +
 +
=== Supported Specifications ===
 +
*File Formats: MP3, WAV
 +
*Sampling Frequencies: 8 kHz, 11.025 kHz, 12 kHz, 16 kHz, 22.05 kHz, 24 kHz, 32 kHz, 44.1 kHz, 48 kHz
 +
*SD cards (≤2GB) / SDHC cards (≤32GB)
 +
*File System: FAT16, FAT32
 +
*UART Baud Rate: 9600 bps
 +
*Volume Levels: 30 adjustable levels in hex
 +
*Power Supply: 3.2–5.2 VDC (3.3V)
 +
*Naming Songs:Name audio files as 001sng.mp3, 002sng.mp3, etc., and place them in folders like 01, 02 etc
  
 
=== Software Design ===
 
=== Software Design ===
Show your software design.  For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.
+
We developed a driver for the MP3 player module that sets up UART communication and connects the RX and TX pins properly. The driver makes it easy to send commands to the MP3 player, such as adjusting the volume, playing specific songs by their number or folder, skipping tracks, and setting playback modes like repeatt. For more details, check out the user manual: [https://github.com/0xcafed00d/yx5300/blob/master/docs/Serial%20MP3%20Player%20v1.0%20Manual.pdf]
  
 
=== Implementation ===
 
=== Implementation ===
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
+
*Initialize MP3 decorder: Get the MP3 player ready by selecting the SD card that has your songs.
 +
*Cycle play mode: Set a song to play on repeat.
 +
*Pause a song: Temporarily stop playback.
 +
*Resume playback: Continue playing the song from where it was paused.
 +
*Play by index: Start playback of a specific song using its number.
 +
*Set volume: Adjust the playback volume to a desired level.
 +
*Next song: Skip to the next track in the playlist.
 +
*Previous song: Go back to the previous track in the playlist.
 +
 
 +
=== Code Structure ===
 +
*Initialization: Call sound_manager__init() to set up the sound manager, including initializing the MP3 decoder, creating FreeRTOS tasks for each sound effect, and configuring semaphores for synchronization.
 +
*Pin Selection: Configure the UART pins in mp3_dec.c using gpio__construct_with_function() to match your hardware setup.
 +
*Sound Effects: Trigger sound effects using the provided functions in the sound manager:
 +
<center>
 +
<p>sound_manager__play_laser(); <br>
 +
sound_manager__play_explosion();<br>
 +
sound_manager__play_won_game();<br>
 +
mp3_decoder__play_song_at_index(0x01); </p></center>
 +
check here for more [https://gitlab.com/randy.nguyen01/sjtwo-c/-/raw/0feb4a50f2ec2a7e9be37454a1c675c205f1020d/projects/lpc40xx_freertos/l3_drivers/mp3/readme.md]
  
 
== Testing & Technical Challenges ==
 
== Testing & Technical Challenges ==

Latest revision as of 20:28, 13 December 2024

Grading Criteria

  • How well is Software & Hardware Design described?
  • How well can this report be used to reproduce this project?
  • Code Quality
  • Overall Report Quality:
    • Software Block Diagrams
    • Hardware Block Diagrams
      Schematic Quality
    • Quality of technical challenges and solutions adopted.

Space 6

Introduction

In this project, we've created a version of the classic Space Invaders game. Instead of using a traditional joystick, the player controls the spaceship's movement using a linear potentiometer that responds to touch. The spaceship shoots to destroy enemies, and the entire game map scrolls in the opposite direction of the spaceship's movement. As the game progresses, the speed of the map's flow and the number of enemies increase, adding more challenge. The spaceship's health decreases when it collides with enemies or their bullets, and the game ends when the health reaches zero.

Objectives & Introduction

Show list of your objectives. This section includes the high level details of your project. You can write about the various sensors or peripherals you used to get your project completed.

Team Members & Responsibilities

  • Ambarish Govindarajulu Kaliamurthi
  • Jesus Morales
  • Randy Nguyen

Schedule

Week# Start Date End Date Task Status
1
  • 10/08/2024
  • 10/14/2024
  • Discuss potential project ideas. Research materials required
  • Get project idea approved
  • Completed
  • Completed
2
  • 10/15/2024
  • 10/21/2024
  • Order LED matrix, power supply, buttons, linear potentiometer
  • Research MP3 audio decoder
  • Completed
  • Completed
3
  • 10/22/2024
  • 10/28/2024
  • Read and familiarize with LED Matrix Datasheet
  • Set up Gitlab repository
  • Completed
  • Completed
4
  • 10/29/2024
  • 11/04/2024
  • Develop LED Matrix driver
  • Finalize project schedule and create Wiki page
  • Completed
  • Completed
5
  • 11/05/2024
  • 11/11/2024
  • Order MP3 decoder
  • Implement initial game objects and test on LED Matrix
  • Connect linear potentiometer and develop ADC functions
  • Completed
  • Completed
  • Completed
6
  • 11/12/2024
  • 11/18/2024
  • Integration of circuit boards and microcontroller
  • Create starting page of video game
  • Begin Game logic development
  • Completed
  • Completed
  • Completed
7
  • 11/19/2024
  • 11/25/2024
  • Finish game logic development
  • Integrate game logic code with LED matrix
  • Integrate game sounds with game logic
  • Completed
  • Completed
  • In Progess
8
  • 11/26/2024
  • 12/02/2024
  • Test and debug video game from start screen to end
  • Finalize the video game
  • Update the wiki page.
  • Not started
  • Not started
  • Not started
9
  • 12/03/2024
  • 12/09/2024
  • Record and Upload Final Demo
  • Final edits on wiki page
  • Submit Gitlab repo
  • Not started
  • Not started
  • Not started


Parts List & Cost

Give a simple list of the cost of your project broken down by components. Do not write long stories here.

Item# Description Quantity Price
1

SJ2C Board

1

$50.00

2

LED Display (WaveShare 64x64)

1

$85.95

3

Momentary switches

5

$8.99

4

Jumper wires

Pack

$6.99

5

5V Power Supply

1

$ 16.99

6

MP3 serial module

1

$ 8.39

7

Linear Potentiometer

1

$ 28.73

8

Game enclosure (wood / paint / adhesive)

Misc

$ 30.00

Design & Implementation

The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.

Hardware Design

Discuss your hardware design here. Show detailed schematics, and the interface here.

Hardware Interface

In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.

Linear Potentiometer

LED Display 64x64

MP3 Decoder

Hardware Interface and Connections

Connection Table: MP3 Player to SJ2 Board

Mp3 Decoder Pin Description SJ2 Board
Vcc Voltage +3.3V
Rx UART2 P0_10
Tx UART2 P0_11
GND GND GND

Screenshot 2024-12-13 112822.png

Screenshot 2024-12-13 122654.png

Supported Specifications

  • File Formats: MP3, WAV
  • Sampling Frequencies: 8 kHz, 11.025 kHz, 12 kHz, 16 kHz, 22.05 kHz, 24 kHz, 32 kHz, 44.1 kHz, 48 kHz
  • SD cards (≤2GB) / SDHC cards (≤32GB)
  • File System: FAT16, FAT32
  • UART Baud Rate: 9600 bps
  • Volume Levels: 30 adjustable levels in hex
  • Power Supply: 3.2–5.2 VDC (3.3V)
  • Naming Songs:Name audio files as 001sng.mp3, 002sng.mp3, etc., and place them in folders like 01, 02 etc

Software Design

We developed a driver for the MP3 player module that sets up UART communication and connects the RX and TX pins properly. The driver makes it easy to send commands to the MP3 player, such as adjusting the volume, playing specific songs by their number or folder, skipping tracks, and setting playback modes like repeatt. For more details, check out the user manual: [2]

Implementation

  • Initialize MP3 decorder: Get the MP3 player ready by selecting the SD card that has your songs.
  • Cycle play mode: Set a song to play on repeat.
  • Pause a song: Temporarily stop playback.
  • Resume playback: Continue playing the song from where it was paused.
  • Play by index: Start playback of a specific song using its number.
  • Set volume: Adjust the playback volume to a desired level.
  • Next song: Skip to the next track in the playlist.
  • Previous song: Go back to the previous track in the playlist.

Code Structure

  • Initialization: Call sound_manager__init() to set up the sound manager, including initializing the MP3 decoder, creating FreeRTOS tasks for each sound effect, and configuring semaphores for synchronization.
  • Pin Selection: Configure the UART pins in mp3_dec.c using gpio__construct_with_function() to match your hardware setup.
  • Sound Effects: Trigger sound effects using the provided functions in the sound manager:

sound_manager__play_laser();
sound_manager__play_explosion();
sound_manager__play_won_game();
mp3_decoder__play_song_at_index(0x01);

check here for more [3]

Testing & Technical Challenges

Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.

Include sub-sections that list out a problem and solution, such as:

<Bug/issue name>

Discuss the issue and resolution.

Conclusion

Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?

Project Video

Upload a video of your project and post the link here.

Project Source Code

References

Acknowledgement

Any acknowledgement that you may wish to provide can be included here.

References Used

List any references used in project.

Appendix

You can list the references you used.