Difference between revisions of "F24: Tilt Maze"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Parts List & Cost)
(Implementation)
Line 234: Line 234:
 
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.   
 
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.   
  
=== 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.
+
* **LED Matrix Driver Functions**:
 +
**1. `matrix_init`: Initializes GPIO pins for the RGB LED matrix and sets up the synchronization mutex​:contentReference[oaicite:0]{index=0}.
 +
**2. `display_update`: Refreshes the LED matrix display to reflect any changes​:contentReference[oaicite:1]{index=1}.
 +
**3. `display_clear`: Clears all active pixels on the matrix by setting them to zero​:contentReference[oaicite:2]{index=2}.
 +
**4. `overwrite_pattern_to_screen`: Overwrites a specific pattern onto the LED matrix​:contentReference[oaicite:3]{index=3}.8
 +
**5. `append_pattern_to_screen`: Adds a pattern to the existing screen matrix without overwriting​:contentReference[oaicite:4]{index=4}.
 +
 
 +
* **Accelerometer Driver**:
 +
**1. `accelerometer_init`: Configures the ADXL345 accelerometer with ±2g sensitivity and sets up I2C communication with semaphores for thread safety​:contentReference[oaicite:5]{index=5}.
 +
**2. `accelerometer_task`: Periodically reads acceleration data, applies smoothing, and updates player position based on tilt movements​:contentReference[oaicite:6]{index=6}.
 +
 
 +
* Maze Logic:
 +
**1. `get_maze_layout`: Retrieves the maze pattern for the current level​:contentReference[oaicite:7]{index=7}.
 +
**2. `is_wall_at`: Checks if a specific position in the maze contains a wall, used to constrain player movement​:contentReference[oaicite:8]{index=8}.
 +
**3. `is_goal_at`: Determines if the player has reached the maze's goal position to proceed to the next level​:contentReference[oaicite:9]{index=9}.
 +
 
 +
* **Game Logic**:
 +
**1. `set_player_to_start`: Resets the player position to the starting point of the current level​:contentReference[oaicite:10]{index=10}.
 +
**2. `handle_collisions`: Detects collisions with walls, traps, and goals, triggering state changes like `GAME_STATE_GAME_OVER` or `GAME_STATE_LEVEL_UP`​:contentReference[oaicite:11]{index=11}.
 +
**3. `change_game_state`: Manages game states such as `GAME_STATE_TITLE`, `GAME_STATE_PLAYING`, and `GAME_STATE_WIN`, and handles music transitions​:contentReference[oaicite:12]{index=12}.
 +
 
 +
* **MP3 Decoder**:
 +
**1. `mp3_decoder__init`: Initializes the MP3 decoder, sets the default volume, and selects the storage device​:contentReference[oaicite:13]{index=13}.
 +
**2. `mp3_decoder__play_song_at_index`: Plays a specific song based on its index in single-cycle mode​:contentReference[oaicite:14]{index=14}.
 +
**3. `mp3_decoder__play_song_with_mode`: Allows playback in loop or single-cycle mode, depending on the game state​:contentReference[oaicite:15]{index=15}.
 +
**4. `mp3_decoder__stop_playback`: Stops any active song playback​:contentReference[oaicite:16]{index=16}.
 +
**5. `mp3_decoder__volume_set_level`: Adjusts the volume level of the MP3 decoder​:contentReference[oaicite:17]{index=17}.
  
 
== Testing & Technical Challenges ==
 
== Testing & Technical Challenges ==

Revision as of 00:21, 20 December 2024

Project Title

Tilt Maze

Tilt maze Logo

Abstract

Tilt Maze is a motion-controlled puzzle game that challenges players to navigate a luminous ball through procedurally generated mazes using device tilting mechanics. Players must reach the exit within time constraints while maneuvering around obstacles and collecting power-ups that provide temporary advantages. The game combines physical device control with strategic gameplay elements, offering high replayability through its randomized level design and emphasizing skills in balance, spatial reasoning, and quick decision-making.

Objectives & Introduction

The Tilt Maze Game combines hardware and software to create an interactive puzzle experience. It uses an ADXL345 accelerometer for tilt-based movement control, navigating a character through a maze displayed on a 64x64 LED matrix. FreeRTOS manages concurrent tasks like accelerometer input, display updates, and game logic, ensuring smooth and responsive gameplay. Game states, collision detection, and immersive audio feedback via an MP3 decoder enhance the experience. Semaphores and mutexes ensure thread-safe resource management, while debug outputs provide insights during development. This project demonstrates advanced integration of peripherals and real-time systems in a cohesive gaming application.

Team Members & Responsibilities

  • Shreya Belide
  • Jyoshna Mallineni
  • Pavan Charith

Schedule

Week# Start Date End Date Task Status
1
  • 10/20/2024
  • 10/27/2024
  • 10/20/2024
  • 10/27/2024
  • Completed
  • Completed
2
  • 10/27/2024
  • 11/02/2024
  • Order necessary parts - LED Matrix , Speaker , Accelerometer
  • Completed
3
  • 11/02/2024
  • 11/08/2024
  • Read and familiarize with LED Matrix Datasheet
  • Completed
4
  • 11/02/2024
  • 11/08/2024
  • Develop graphics driver for LED matrix and implement initial game objects
  • Completed
5
  • 11/09/2024
  • 11/09/2024
  • 11/09/2024
  • 11/09/2024
  • 11/10/2024
  • 11/15/2024
  • 11/15/2024
  • 11/15/2024
  • Finalize wiki schedule
  • Order circuit boards components and complete the design for printing
  • circuit board and component assembly
  • Circuit board testing
  • Additional accessories if required and finalization of hardware
  • Completed
  • Completed
  • Completed
  • Completed
  • Completed
6
  • 11/16/2024
  • 11/22/2024
  • Integration of circuit boards and microcontroller
  • Game logic development
  • Testing and debugging the game logic
  • Completed
  • Completed
  • Completed
7
  • 11/23/2024
  • 11/29/2024
  • Integrate game logic code with LED matrix
  • Integrate game sounds with game logic
  • Completed
  • In progress
8
  • 11/30/2024
  • 12/06/2024
  • Integrate subsystem
  • Finalizing the video game
  • Update the wiki page.
  • In Progess
  • In progess
  • In progess
9
  • 12/07/2024
  • 12/13/2024
  • Address bugs during testing of integrated system
  • Test pause/play functionality
  • In Progess
  • Not started
  • Not started
10
  • 12/14/2024
  • 12/14/2024
  • 12/14/2024
  • 12/14/2024
  • 12/16/2024
  • 12/16/2024
  • 12/16/2024
  • 12/16/2024
  • Final Demo
  • Update Gitlab repo with final code.
  • Update test video.
  • Update the wiki page.
  • Not started
  • Not started
  • Not started
  • Not started


BILL OF MATERIALS

Part # Cost Source
SJ2 Board 1 $50.00 Preet
Sparkfun RGB (64x64) LED Matrix Display 1 $65.72 Amazon
Accelerometer 1 $10.99 JLC PCB
12v DC Power Jack Adapter Connector 1 $8.90 Amazon
MP3 Decoder 1 6.90 Amazon
Packaging 1 $12 Target
Jumper Wires 1 $6.99 Amazon
Total Cost $173.20

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.

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.

Implementation

  • **LED Matrix Driver Functions**:
    • 1. `matrix_init`: Initializes GPIO pins for the RGB LED matrix and sets up the synchronization mutex​:contentReference[oaicite:0]{index=0}.
    • 2. `display_update`: Refreshes the LED matrix display to reflect any changes​:contentReference[oaicite:1]{index=1}.
    • 3. `display_clear`: Clears all active pixels on the matrix by setting them to zero​:contentReference[oaicite:2]{index=2}.
    • 4. `overwrite_pattern_to_screen`: Overwrites a specific pattern onto the LED matrix​:contentReference[oaicite:3]{index=3}.8
    • 5. `append_pattern_to_screen`: Adds a pattern to the existing screen matrix without overwriting​:contentReference[oaicite:4]{index=4}.
  • **Accelerometer Driver**:
    • 1. `accelerometer_init`: Configures the ADXL345 accelerometer with ±2g sensitivity and sets up I2C communication with semaphores for thread safety​:contentReference[oaicite:5]{index=5}.
    • 2. `accelerometer_task`: Periodically reads acceleration data, applies smoothing, and updates player position based on tilt movements​:contentReference[oaicite:6]{index=6}.
  • Maze Logic:
    • 1. `get_maze_layout`: Retrieves the maze pattern for the current level​:contentReference[oaicite:7]{index=7}.
    • 2. `is_wall_at`: Checks if a specific position in the maze contains a wall, used to constrain player movement​:contentReference[oaicite:8]{index=8}.
    • 3. `is_goal_at`: Determines if the player has reached the maze's goal position to proceed to the next level​:contentReference[oaicite:9]{index=9}.
  • **Game Logic**:
    • 1. `set_player_to_start`: Resets the player position to the starting point of the current level​:contentReference[oaicite:10]{index=10}.
    • 2. `handle_collisions`: Detects collisions with walls, traps, and goals, triggering state changes like `GAME_STATE_GAME_OVER` or `GAME_STATE_LEVEL_UP`​:contentReference[oaicite:11]{index=11}.
    • 3. `change_game_state`: Manages game states such as `GAME_STATE_TITLE`, `GAME_STATE_PLAYING`, and `GAME_STATE_WIN`, and handles music transitions​:contentReference[oaicite:12]{index=12}.
  • **MP3 Decoder**:
    • 1. `mp3_decoder__init`: Initializes the MP3 decoder, sets the default volume, and selects the storage device​:contentReference[oaicite:13]{index=13}.
    • 2. `mp3_decoder__play_song_at_index`: Plays a specific song based on its index in single-cycle mode​:contentReference[oaicite:14]{index=14}.
    • 3. `mp3_decoder__play_song_with_mode`: Allows playback in loop or single-cycle mode, depending on the game state​:contentReference[oaicite:15]{index=15}.
    • 4. `mp3_decoder__stop_playback`: Stops any active song playback​:contentReference[oaicite:16]{index=16}.
    • 5. `mp3_decoder__volume_set_level`: Adjusts the volume level of the MP3 decoder​:contentReference[oaicite:17]{index=17}.

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.