Difference between revisions of "F19: T-Rex Run!"

From Embedded Systems Learning Academy
Jump to: navigation, search
(LED matrix control)
(Hardware Design)
Line 204: Line 204:
  
  
|[[File:Picture1.png | 450px | thumb | center | '''RGB LED Matrix connection ports''']]
+
[[File:Picture1.png|450px|thumb|left| '''RGB LED Matrix connection ports''']]
 
{|class="wikitable"
 
{|class="wikitable"
 
|-
 
|-

Revision as of 07:54, 18 November 2019

T-Rex Run!

T-Rex Run

Abstract

T-Rex Run! game is an adaptation of popular chrome browser offline game in which the player steers a T-Rex dinosaur through increasingly dangerous landscapes to escape a tree of doom. The game uses simple pixel art and sound to replicate the style of 1980s arcade games. The player will be able to control the game by using switch buttons available on the Sjtwo-C microcontroller. The main goal behind the project is to understand the basics of graphics programming in the C language on a microcontroller.

Objectives & Introduction

The primary objective of this project is to write efficient code to develop a game using FreeRTOS and SJTwo Board. SJTwo Boards act as the heart of the project which acts as the controller of the game which we primarily test using onboard switch controlled with GPIO. The main objective which we are achieving with is to use the accelerometer sensor as a controlling aspect. The accelerometer sensor on the SJTwo board which is connected via I2C is used to register the controller orientation and according to the orientation obtained by the sensor, game logic decides whether to make dinosaur jump up or not. The obstacles are generated randomly and are moved from left to right on the LED matrix. If dinosaur collides with any of the obstacles its game over. The speed of obstacle movement increases as the levels goes up.

The project includes the following modules:

1. Controller: One SJTwo board is used as the controller. It transmits orientation to the processor.

2. Display Module: Adafruit 32x32 Led Matrix display is used to display the game. This is driven by the GPIO pins on the master SJOTwo Board.


Team Members & Responsibilities

  • Tina Ruchandani
    • Accelerometer Calibration & Control.
    • Software Design (Switch control and Obstacle Generation).
    • Wiki Page Updates.
  • Tushar Tarihalkar
    • LED Matrix Interface.
    • Wiki Page Updates.
    • PCB and Hardware Design
    • Software Design (Dinosaur Design and Control).
  • Wenyan He
    • Software Design (Switch control and Obstacle Generation).
    • LED Matrix Interface
    • Manage GitHub Account

Schedule

Week Date Task Status
1 10/08
  • T-Rex Run project proposal approved by instructor.
  • Completed
2 10/10
  • Project Wiki page creation.
  • Github Repository creation.
  • Create bill of materials.
  • Selection and ordering parts.
  • Completed.
3 10/15
  • Research on software development for the game.
  • Initial divide of project modules.
  • Assigning responsibility to each group member.
  • Completed.
4 10/29
  • Understand working of LED matrix.
  • Understand Accelerometer MMA8452Q data sheet.
  • Completed.
5 11/13
  • Start screen for Game on LED Matrix(Tushar)
  • Accelerometer Reading and Calibration(Tina & Wenyan)
  • Initial display testing and generation of patterns, names, shapes.
  • In Progress.
6 11/19
  • Design and development of logic for Obstacle Generation.
  • Design and development of logic for Dinosaur Control using switch.
  • To Do.
7 11/26
  • PCB Design, Layout and Implementation.
  • Finalizing the schematic.
  • Initial testing of Game for proper flow.
  • To Do.
8 12/03
  • Wiki Update.
  • Soldering components and hardware testing on PCB
  • Packaging of hardware board and related components.
  • To Do.
8 12/10
  • Final Testing and Bug fixes
  • Complete Wiki Report.
  • To Do.
8 12/18
  • Final Demo
  • To Do.

Parts List & Cost

Part # Cost Source
SJ2 Board 1 $55.00 Preet
Adafruit RGB (32x32) LED Matrix Display 1 $60.80 Amazon
5V/4A Power Adapter 1 $8.99 Amazon
Female DC Power adapter - 2.1mm jack 1 $2.99 Adafruit
Jumper Wires 1 $6.99 Amazon

Design & Implementation

The block diagram for the project given below depicts the flow of the game

State_Diagram

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

The hardware design for the project consists of a 32x32 RGB LED matrix operated using SJTWO Board (LPC4078). The RGB LED matrix is controlled using GPIO pins available on the microcontroller. The functioning of the LED matrix is basically controlled by the four data lines A, B, C and D which can be addressed and used to control each LED on the Matrix.

LED Matrix specifications:

  • 190.5mm x 190.5mm x 14mm / 7.5" x 7.5" x 0.55"
  • Panel weight with IDC cables and power cable: 357.51g
  • 5V regulated power input, 4A max (all LEDs on)
  • 5V data logic level input
  • 2000 mcd LEDs on 6mm pitch
  • 1/16 scan rate


RGB LED Matrix connection ports
Label Name Pin Function
1 R1 Red data for top half of the LED Matrix
2 G1 Green data for top half of the LED Matrix
3 B1 Blue data for top half of the LED Matrix
4 A Select line A
5 B Select line B
6 C Select line C
7 D Select line D
8 R2 Red data for bottom half of the LED Matrix
9 B2 Blue data for bottom half of the LED Matrix
10 G2 Green data for bottom half of the LED Matrix
11 CLK CLOCK Pin
12 LAT LATCH
13 OE Output Enable
14 GND Ground

LED matrix control:

|
RGB LED Matrix

The 32x32 LED matrix consists of 1024 LEDs arranged in 32 rows and 32 columns each, with each led having a separate Red, Green and Blue LED chips assembled together as a single unit. This 32x32 LED matrix comprises of 2 of 16x32 led matrices placed vertically to each other. There are different drivers for controlling the corresponding rows and columns each. In order to illuminate a particular led, one needs to access and control the corresponding row and column (just like in coordinate-axis). To change the color of a particular led, each led must be controlled using the driver for that row and column.

The matrix pixels are controlled by 6 drivers, 3 for the top half of the matrix(R1,G1,B1) and 3 for the bottom half(R2,G2,B2). The three drivers for R, G and B share a SCLK, Latch and BLANK signal. The top half pixels of the matrix controlled by R1, G1,B1 are rows 0-15 and the second half controlled by R2,G2,B2 are rows 16-31. The display is multiplexed at a duty cycle of 1/16, this means that one row in the top half and one row in the bottom half will be illuminated at a time. In order to display an image, the row and column LEDs for that image must be turned “ON”, therefore, the entire panel must be scanned at a rate(speed) at which it appears that the image is being displayed without flickering. To display different colors and different brightness levels, the LED chips of corresponding row and column must be adjusted by varying the amount and time that each LED chip is turned on during each cycle.

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

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

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.