LED Video Player

= LED Video Player =
== Description ==
The LED Video Player is a project developed at the University of Idaho in the Spring of 2014 by Senior Computer Science undergraduates Alex Eklund and Tell O'Neal. The project consists of a system capable of displaying video on an M x N array of 32x32 pixel LED panels, including all the hardware to drive the display, and a web based user interface to control the display.
=== Sponsor: ===
Dr. Robert Rinker
=== Faculty: ===
Professor Bruce Bolden
=== Duration: ===
Two Semesters
== Problem Statement ==
The system being developed is an LED Matrix capable of displaying video. Potential applications of such a device are signs and large video displays used at concerts and sporting events. Our solution is a proof of concept for an open source design that business owners and hobbyists could use to build and maintain their own sign or video display. Current vendor solutions are very expensive to rent or buy and maintain, so such a design could be very helpful to entities that are interested in LED displays, but have a limited budget.
The LED Matrix can be assembled from one or more 32x32 LED panels. Upon completion of this project, functionality will be demonstrated with video played on a 2x2 and also a 4x1 configuration of panels.
The LED matrix and hardware required to drive it will be accompanied by a web based software interface that will allow the output of the display and the source of content for the display to be managed and configured from any internet connected device such as a PC, tablet, or smartphone.
=== Background ===
The LED panels that our project uses are the building blocks for vibrant street signs and enormous LED walls and displays. LED signs are an effective way of advertising, and can be found standing next to streets, on buses, and buildings. LED displays are used extensively in the entertainment industry. They can be found hanging in the middle of most professional and high level college sporting venues, used to playback clips of recent plays in slow motion, and give the audience a live, close up view of the action. Where LED displays really stand out is at live music events and dance clubs. An LED wall towering behind a live band or DJ shines very bright in an evening setting, and can help create the right atmosphere and visual content to go along with music. Video clips, evolving geometric shapes, graphs of complex functions, and strobing effects can look impressive when edited and played in time to music on LEDs, and for many types of rock and dance music complement a live show very well.
Major sporting venues are generally going to have access to a budget that will allow them to meet their LED display needs through traditional vendors. However, small businesses and gigging musicians alike could benefit from an open source design that provides code and plans to create an LED display of a size to fit their needs.
To truly make the design layman friendly, providing some parts to make wiring, giving structure to, and storing the system a breeze would be necessary. This is where a business model could potentially fit into this “open source” design. Provide code and plans freely, and work as a vendor of
=== Specifications ===
LED Matrix Functions:
•	Display Video on an LED matrix consisting of 4 panels (2 x 2 array)
•	Display Video with 24 bit color
•	Display Video at 30 Frames per Second
User Interface Functions:
•	Allow user to specify Video Source located on YouTube or locally
•	Allow user specify Number of LED Panels & Arrangement
•	Allow user to select Portion of Video Source to be Used
•	Pause and Play LED Display
== Design ==
=== Alternatives/selection ===
Displaying video at desirable frame rate ( >30 FPS) on even a small LED matrix consisting of only 4 LED panels with a resolution of 64x64 LEDs requires precise, dependable timing from the hardware driving the LED display. The general purpose input/output (GPIO) pins of the Raspberry Pi provide a suitable interface for connecting to and driving the LED panels, but the rate at which data can be dependably pushed to the LED panels is bottlenecked by the Linux operating system running on the Raspberry pi.
Early research into Real Time Operating Systems (RTOS) running on the raspberry pi indicated improvements could made over the Linux OS used by the other teams, but even the best RTOS options for the PI could only guarantee timing requirements to ±20µs of accuracy. This would be an improvement over the current implementation, but would still significantly limit future expandability, and very little work done by the previous teams could be reused.
Faced with the fact that much of the originally system would need to be redesigned anyway by using an RTOS on the Raspberry Pi, and even that option would not provide a suitable platform for all of the desired goals for the project, another option that would provide greater performance was desired.
To address the current and future needs of this project, an FPGA was selected as the primary component used to drive the LED Matrix. The Raspberry Pi will still be used to process and convert video, but rather than interface directly with the LED panels it will output the processed data stream to the FPGA which will buffer and output the video with precisely defined timing.
In addition to adding the FPGA, this project will bring back a GUI interface such as the one used by Team RPLD. The interface will be web based. The server for the web-application will run on the Raspberry pi and improves upon the previous projects as it will not require any software to be installed on the PC or device used to control the displays; it will be accessible via a web browser.
=== Detailed Design ===
====GUI and Video Conversion Software====
The GUI is a client side Angular JS application that follows a MVC pattern.
The GUI is served by an application server built in Node.js. The application server and GUI communicate over a TCP web socket using a client/server model. Communications are asynchronous.
The application server utilizes the Node.js modules YTDL, and Fluent FFMPEG.
The YTDL module is responsible for sending an http request to youtube and saving the returned MP4 video.
The Fluent FFMPEG module handles cropping and resizing the video as specified by the settings in the user interface.
The Conversion Module is a C++ application using the Open CV video processing library. The conversion is a stand-alone command line application.
The Application server spawns a child instance of the Conversion module and passes all of the video conversion parameters received from the GUI, along with a file stream for the downloaded video. 
The conversion module converts the video stream to a serialized data format suitable for use to be passed to the driver code.
====Data Transmission and VHDL====
Data Transmission - Data is sent from the Pi 8 parallel bits at a time. It is received by a module in the FPGA that shifts each new byte into a receiver register. A flag is raised every six bytes, at which point the data is stored in the memory module. Each panel writes two pixels at once, so the data for each pixel pair is stored together.
Memory Module - For our current design, a single frame is buffered. The LED control modules each provide the address of the pixel pair they are going to write next, and the output to each module is updated at every clock cycle.
LED Control Module - The control module is a state machine that keeps track of what pixel pair to write next, and when to write it. To write a pixel pair, the module grabs the memory module’s output, splits it up, calculates whether the LEDs should be on or off, puts the correct values on the color and addressing wires to the panel, and pulses the signal that tells the panel to write the data to the LEDs.
=== Implementation/Testing ===
== Team Information ==
== Document Archive ==
https://bitbucket.org/on3al/ledvideoplayer
Design Report
SRS