Difference between revisions of "F22: xGameCreate"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Schematic)
(PIN CONFIGURATION)
Line 291: Line 291:
  
 
! scope="row"| R1
 
! scope="row"| R1
| PIN for Red terminal of RGB LED for the upper half of LED Matrix
+
|  
 
! P0_0
 
! P0_0
 
|-
 
|-
 
! scope="row"| G1
 
! scope="row"| G1
| PIN for Green terminal of RGB LED for the upper half of LED Matrix
+
|  
 
! P0_1
 
! P0_1
 
|-
 
|-
 
! scope="row"| B1
 
! scope="row"| B1
| PIN for Blue terminal of RGB LED for the upper half of LED Matrix
+
|  
 
! P2_2
 
! P2_2
 
|-
 
|-
 
! scope="row"| R2
 
! scope="row"| R2
| PIN for Red terminal of RGB LED for the lower half of LED Matrix
+
|  
 
! P2_4
 
! P2_4
 
|-
 
|-
 
! scope="row"| G2
 
! scope="row"| G2
| PIN for Green terminal of RGB LED for the lower half of LED Matrix
+
|  
 
! P2_5
 
! P2_5
 
|-
 
|-
 
! scope="row"| B2
 
! scope="row"| B2
| PIN for Blue terminal of RGB LED for the lower half of LED Matrix
+
|  
 
! P2_6
 
! P2_6
 
|-
 
|-
 
! scope="row"| A
 
! scope="row"| A
| Mux pin for row selection
+
|  
 
! P2_7
 
! P2_7
 
|-
 
|-
 
! scope="row"| B
 
! scope="row"| B
| Mux pin for row selection
+
|  
 
! P2_8
 
! P2_8
 
|-
 
|-
 
! scope="row"| C
 
! scope="row"| C
| Mux pin for row selection
+
|  
 
! P2_9
 
! P2_9
 
|-
 
|-
 
! scope="row"| D
 
! scope="row"| D
| Mux pin for row selection
+
|  
 
! P0_16
 
! P0_16
 
|-
 
|-
 
! scope="row"| E
 
! scope="row"| E
| Mux pin for row selection
+
|  
 
! P0_15
 
! P0_15
 
|-
 
|-
 
! scope="row"| OE
 
! scope="row"| OE
| Output Enable
+
|  
 
! P1_28
 
! P1_28
 
|-
 
|-
 
! scope="row"| LATCH
 
! scope="row"| LATCH
| Data Latch
+
|  
 
! P1_29
 
! P1_29
 
|-
 
|-
 
! scope="row"| CLK
 
! scope="row"| CLK
| Clock Signal
+
|  
 
! P0_17
 
! P0_17
 
|-
 
|-
Line 359: Line 359:
 
! P2_0
 
! P2_0
 
|-
 
|-
 
! scope="row"|
 
! scope="col"| XBEE Module Receiver
 
|
 
|-
 
 
! scope="row"| RX
 
| UART Receive From Game Controller
 
! P0_11
 
|-
 
! scope="row"| VCC
 
| VCC Supply
 
! VCC 3.3
 
 
|-
 
|-
 
|}
 
|}

Revision as of 23:03, 10 December 2022

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.

Whack-a-mole

Abtract

Whac-a-Mole is a fun arcade game in which the player hits plastic moles with a hammer as soon as it appears out of their hole, to score points. We will be recreating the same old game with some modifications. Instead of plastic moles and a hammer, we will be using a LED Matrix to display mole-like characters and touch sensors to imitate the hammer. The scoring will be based on the no of moles you hit and how accurately you hit. We will be designing three levels and after each level, the difficulty of the game will rise.

Objectives & Introduction

  • The aim of the game is to hit as many moles as possible as they appear out of the holes
  • There will be three lives and the speed and complexity of the game increase as the score goes up.
  • If you miss a mole you lose a life
  • Based on how many moles you hit your score will increase.
  • The LED matrix is used to create the 12-mole-hole-like animation and the moles appear randomly in some holes.
  • ITO-coated PET is used for receiving the touch input (hitting the mole).
  • A speaker is used to play background music, and sound clips when you hit a mole.

Team Members & Technical Responsibilities

  • Stephen Oneto
    • Graphics Driver Implementation
    • Game logic design
    • Enclosure design and 3D printing
    • Battery regulatory circuit design
  • Yatish Koul
    • MP3 Driver Implementation
    • Integrating MP3 module with the Game
    • Game logic design

Schedule

Week# Start Date End Date Task Status
1
  • 10/13/2022
  • 10/22/2022
  • Read Past projects to get some design ideas
  • Finalize our choice of game
  • Game Design
  • Confirm functionalities of the game
  • Decide the parts & material for our project
  • Completed
  • Completed
  • Completed
  • Completed
  • Completed
2
  • 10/23/2022
  • 10/29/2022
  • Create a project Wiki page
  • Study previous projects
  • Order parts
  • Completed
  • Completed
  • Completed
3
  • 10/30/2022
  • 11/5/2022
  • Create Git repository
  • Test whether all the components are working properly
  • Read and familiarize with the datasheets of the components
  • Completed
  • Completed
  • Completed
4
  • 10/31/2022
  • 11/12/2022
  • Draw schematic
  • Design game character
  • Develop graphics driver for LED matrix
  • Develop Driver for audio
  • Develop Driver for touch sensors
  • Completed
  • Completed
  • Completed
  • Completed
  • Completed
5
  • 11/13/2022
  • 11/19/2022
  • Test and debug the driver functionality
  • Hardware integration
  • Display game Character on the screen
  • Completed
  • Completed
  • Completed
6
  • 11/20/2022
  • 11/26/2022
  • Game score design
  • Integrate game sound with the background music
  • Completed
  • Completed
7
  • 11/27/2022
  • 12/3/2022
  • Test & bug fix
  • Design Game enclosure
  • In Progress
  • In Progress
8
  • 12/04/2022
  • 12/10/2022
  • Fine-tuning timing and logic
  • Improve and add animations as necessary
  • Finalizing the video game
  • Update the wiki page.
  • In Progress
  • In Progress
  • In Progress
  • In Progress
9
  • 12/11/2022
  • 12/15/2022
  • Prepare for the Final Project DEMO
  • Prepare project video
  • Wrap up Wiki page & Project submission
  • Final demo
  • Not started
  • Not started
  • Not started
  • Not started

Materials List with cost

Part Name Part Model & Source Quantity Cost Per Unit (USD)
  • Micro-Controller SJ2 Board
  • SJ2 Board (Purchased from Preet Kang)
  • 1
  • 50.00
  • RGB LED MATRIX
  • 64X64 RGB - 2.5mm Pitch
  • 1
  • 54.95
  • Power Supply
  • Universal AC Adapter
  • 1
  • 11.99
  • ITO Coated Pet Plastic
  • ITO (100mm X 200mm)
  • 2
  • 20.00
  • Touch Sensor Breakout
  • 12-Key Capacitive Touch Sensor Breakout
  • 1
  • 7.95
  • Speaker
  • 3" Diameter-4Ohm 3 Watt
  • 1
  • 1.95
  • Audio Decoding Player Module
  • Hiletgo MP3 Decode Module
  • 1
  • 6.49

Design & Implementation

Schematic

Touch Breakout Board

PIN CONFIGURATION

==

  • Pin# SJ2 Main Board - LED Matrix Pin Configuration SJ-2 PIN
    R1 P0_0
    G1 P0_1
    B1 P2_2
    R2 P2_4
    G2 P2_5
    B2 P2_6
    A P2_7
    B P2_8
    C P2_9
    D P0_16
    E P0_15
    OE P1_28
    LATCH P1_29
    CLK P0_17
    MP3 Decoder
    RX UART Receive From MP3 Decoder P2_1
    TX UART Send Command from SJ-2 Main Board P2_0
  • Pin# Controller Board Pin Configuration uC PIN
    XBEE Module Transmitter
    TX UART Transmit to Main Board P0_10
    VCC VCC Supply VCC 3.3
    Joystick
    VCC VCC 3.3V
    GND GND GND
    Vx X-axis ADC Reading for character movement P0_25
    Push Button
    I/0 Pin Arrow Shooting P1_29

Hardware Design

The system is built on the SJ2 development board. A 64*64 LED matrix, a touch breakout board, and an MP3 decoder are interfaced with the SJ2 board. The LED matrix screen has a top rectangle to display the score and lives. The remaining portion is divided into 12(4*3) rectangles depicting 12-mole holes. Each of the 12 holes is covered with an ITO-coated flexible transparent sheet. Each of the ITO sheets is connected to the touch sensor breakout board through wires. The system is designed to operate on a battery. The entire system is enclosed in a 3D-printed enclosure.

Hardware Interface
Hardware Design front view

Capacitive Touch Breakout

Touch Breakout Board

We used a MPR121 12-channel capacitive touch sensor breakout board. It supports I2C and can be configured for different levels of sensitivity. The 12 touch sensor pins are connected to 12 ITO films which are placed on top of the LED matrix. When a touch is detected an interrupt will be generated. The status of the 12 sensors is then verified one by one in order to determine which pin is touched.

Hardware Design

Software Design

LED Matrix

LED Matrix

Hardware Design

Software Design

MP3 Decoder

This module is a straightforward MP3 player that runs on the YX5300 high-quality MP3 audio chip. MP3 and WAV file formats with sampling rates of 8 kHz to 48 kHz are supported. The micro SD card used to store the audio files can be inserted because there is a TF card socket on the board. By sending commands to the module via the UART interface, the MCU can control the MP3 playback state by altering the volume, switching tracks, etc.

Serial MP3 Player

Hardware Design

The UART Tx, UART Rx, VCC, and GND pins are the 4 pins that the MP3 decoder module needs. The SJ2 board provided the module with the 3.3V it needed to start up. On the SJ2 board, UART1 pins have been set up so that commands can be sent to the decoder. This UART communication's baud rate is set at 9600 bps. Additionally, this decoder has a speaker-connected 3.5mm audio jack.

Connection diagram of MP3 decoder to SJ2 board.

Software Design

MP3 Initialization


In our project, the command we use plays the song by navigating to its index on the SD card. In our code, the function that sends this command is referred to as play music at index. We must first send the command [Select device] before we can send the instruction to play music at a specific index. The datasheet specifies that you should send "7E FF 06 09 00 00 02 EF" since Serial MP3 Player only accepts micro SD cards. Additionally, the function uart_polled_put on UART1 is being used to transmit the commands.

Game Logic

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.

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.

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

This project was a valuable teaching tool. Every module used for the project was effectively integrated, and we were able to reproduce our original game concept. During the project, we had a number of challenges, including difficulties starting the LED matrix driver, difficulties figuring out how to integrate touch sensing with so many game objects, difficulties creating and maintaining our complex game logic state machine, and much more. We were able to understand the real-world use of FreeRTOS while working on our project. We came to the conclusion that defining weekly goals and exceeding them could assist compartmentalize the project and eventually meet the desired outcome. This project improved our proficiency with embedded software and solidified our command of it.

Project Video

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

Project Source Code

Acknowledgement

We would like to thank Professor Preetpal Kang for sharing his knowledge and insights with us during the course of the project.

References

List any references used in project.

  1. Serial MP3 Player Datasheet
  2. Whack_a_Mole Miniclip Game