Difference between revisions of "Gymnastics Competition App"

From ESE205 Wiki
Jump to navigation Jump to search
m (Protected "Gymnastics Competition App" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(23 intermediate revisions by 2 users not shown)
Line 25: Line 25:
 
# $29.95 Raspberry Pi Camera - https://www.adafruit.com/products/3099
 
# $29.95 Raspberry Pi Camera - https://www.adafruit.com/products/3099
 
# $7.97 Camera Extension Cord https://www.amazon.com/Adafruit-Flex-Cable-Raspberry-Camera/dp/B00XW2NCKS/ref=sr_1_2?ie=UTF8&qid=1486763635&sr=8-2&keywords=raspberry+pi+camera+extension+cable
 
# $7.97 Camera Extension Cord https://www.amazon.com/Adafruit-Flex-Cable-Raspberry-Camera/dp/B00XW2NCKS/ref=sr_1_2?ie=UTF8&qid=1486763635&sr=8-2&keywords=raspberry+pi+camera+extension+cable
# $7.99*2 Adeept 4pcs Digital Push Button Keypad Module for Arduino and Raspberry Pi AVR MSP430 MCU DIY Kit - https://www.amazon.com/Adeept-Digital-Button-Arduino-Raspberry/dp/B01LXHNBBJ/ref=sr_1_3?ie=UTF8&qid=1486763176&sr=8-3&keywords=raspberry+pi+buttons
 
 
# $22.99 Elecrow TFT Display Monitor 3.5 Inch 480x320 TFT LCD Display with Touch Screen for Raspberry Pi 2B B+ Raspberry Pi 3B - https://www.amazon.com/gp/product/B013JEV6VA/ref=ox_sc_act_title_1?ie=UTF8&psc=1&smid=A3UAI31N6IJM2
 
# $22.99 Elecrow TFT Display Monitor 3.5 Inch 480x320 TFT LCD Display with Touch Screen for Raspberry Pi 2B B+ Raspberry Pi 3B - https://www.amazon.com/gp/product/B013JEV6VA/ref=ox_sc_act_title_1?ie=UTF8&psc=1&smid=A3UAI31N6IJM2
 
# $0.00 3D-Printing Materials and Software<br>
 
# $0.00 3D-Printing Materials and Software<br>
 
# $7.50 (+ $7.14 Shipping) Foot Switch https://www.adafruit.com/products/423?gclid=Cj0KEQiAxeTFBRCGmIq_7rGt_r8BEiQANdPqUk8XYG37qe-_8iJT87roB9Z0fK-OCeW72jrDsBP9niUaAlmV8P8HAQ
 
# $7.50 (+ $7.14 Shipping) Foot Switch https://www.adafruit.com/products/423?gclid=Cj0KEQiAxeTFBRCGmIq_7rGt_r8BEiQANdPqUk8XYG37qe-_8iJT87roB9Z0fK-OCeW72jrDsBP9niUaAlmV8P8HAQ
Total: $91.53
+
Total: $75.55
 
 
==Machine Design==
 
[[File:Gymnastics_Machine_Design.jpeg|frameless|border|600px|Machine Design]]
 
  
 
=== Gantt Chart ===
 
=== Gantt Chart ===
 
[[File:Gantt_Chart_Gymnastics_Competition_App_Group.png|frameless|border|1000px|Gantt Chart]]
 
[[File:Gantt_Chart_Gymnastics_Competition_App_Group.png|frameless|border|1000px|Gantt Chart]]
 +
 +
==Initial Machine Design==
 +
[[File:Gymnastics_Machine_Design.jpeg|frameless|600px|none|Initial design for the scoring machine]]
 +
Initial design for the scoring machine. Includes a screen, four buttons for deductions, and one button for camera recording.
  
 
==Design and Solutions==
 
==Design and Solutions==
Line 42: Line 42:
 
We needed a mini-computer to act as the main body of our machine, that is able to connect to other inputs such as the foot pedal and the camera. We also needed something to display the GUI of our program.
 
We needed a mini-computer to act as the main body of our machine, that is able to connect to other inputs such as the foot pedal and the camera. We also needed something to display the GUI of our program.
 
====Solution====
 
====Solution====
We are using the Raspberry Pi as the main body of our machine, connecting it to a 3.5 inch LCD with touch screen for the GUI of our program from Elecrow. The installation of the 3.5 inch Pi LCD is shown in this page: [[Installation of the 3.5 inch Pi LCD]].
+
We are using the Raspberry Pi as the main body of our machine, connecting it to a 3.5 inch LCD with touch screen for the GUI of our program from Elecrow. The installation of the 3.5 inch Pi LCD is shown in this page: [[Installation of the 3.5 inch Pi LCD]]. <ref>https://www.elecrow.com/35-inch-480x320-tft-display-with-touch-screen-for-raspberry-pi-p-1385.html</ref>
  
 
===Module 2: Inputs===
 
===Module 2: Inputs===
Line 66: Line 66:
 
====Design====
 
====Design====
 
The judge needs interface screens for:
 
The judge needs interface screens for:
# entering the gymnast's number (or some way to identify each gymnast)
+
# Entering the gymnast's number (or some way to identify each gymnast)
# recording the video
+
# Recording the video
# entering the gymnast's skill values
+
# Entering the gymnast's skill values
# entering the gymnast's fulfilled element groups
+
# Entering the gymnast's fulfilled element groups
# entering deduction values for each of the deductions
+
# Entering deduction values for each of the deductions
 
There also must be a way to navigate to the next screen. Our original screen sketches incorporated all of these.
 
There also must be a way to navigate to the next screen. Our original screen sketches incorporated all of these.
  
Line 106: Line 106:
 
In order for the athletes to receive feedback for the deductions at each part of their routines, we need a way to upload the video of the athlete's routine with time-stamps showing when each deduction occurred.  
 
In order for the athletes to receive feedback for the deductions at each part of their routines, we need a way to upload the video of the athlete's routine with time-stamps showing when each deduction occurred.  
 
====Solution====
 
====Solution====
We decided to use YouTube as the platform to provide feedback for the athletes. This is because it is a widely-used website for videos sharing and that the description of each video allows time-stamps to the video that is easily accessible by just clicking on it. This is a guide to direct uploads of videos from the Raspberry Pi by using a Python program: [[Directly Upload Videos to YouTube with Raspberry Pi and Python]]
+
We decided to use YouTube as the platform to provide feedback for the athletes. This is because it is a widely-used website for videos sharing and that the description of each video allows time-stamps to the video that is easily accessible by just clicking on it. This is a guide to direct uploads of videos from the Raspberry Pi by using a Python program: [[Directly Upload Videos to YouTube with Raspberry Pi and Python]]. <ref>http://raspi.tv/2013/another-way-to-convert-raspberry-pi-camera-h264-output-to-mp4</ref>
  
 
==Results==
 
==Results==
 
===Final Product===
 
===Final Product===
All the modules described above were implemented. Our machine includes a Raspberry Pi connected to a 3.5" display screen which displays the interface. A raspberry pi camera records video and a foot pedal time-stamps deductions. Both of these are connected to the Raspberry Pi. The camera and Raspberry Pi both have 3-D printed housings. The user interface is simple and takes the judge through multiple scoring screens before automatically uploading the video with time-stamped deductions to YouTube.  
+
All the modules described above were implemented. Our machine includes a Raspberry Pi connected to a 3.5" display screen which displays the interface. A raspberry pi camera records video and a foot pedal time-stamps deductions. Both of these are connected to the Raspberry Pi. The camera and Raspberry Pi both have 3-D printed housings. The user interface is simple and takes the judge through multiple scoring screens before automatically uploading the video with time-stamped deductions to YouTube.
 +
 
 +
[[File:Final_Housing.jpeg|frameless|border|600px|Final Machine]]
 +
 
 
===Compared to Original Objectives===
 
===Compared to Original Objectives===
 
We successfully designed circuitry and utilized the Raspberry Pi. Unlike our initial design, which used four buttons, our final design used only one foot pedal, simplifying our circuitry and the user experience. We also successfully 3-D printed housings for both our Raspberry Pi + Screen and Camera. The machine also automatically uploads the video and deduction time-stamp information to YouTube, which is available for viewing within 2 minutes and does not interrupt the program. We had a successful demo. The audience was able to use the machine to time-stamp a gymnast's fall deduction, and then see that video uploaded in real time.  
 
We successfully designed circuitry and utilized the Raspberry Pi. Unlike our initial design, which used four buttons, our final design used only one foot pedal, simplifying our circuitry and the user experience. We also successfully 3-D printed housings for both our Raspberry Pi + Screen and Camera. The machine also automatically uploads the video and deduction time-stamp information to YouTube, which is available for viewing within 2 minutes and does not interrupt the program. We had a successful demo. The audience was able to use the machine to time-stamp a gymnast's fall deduction, and then see that video uploaded in real time.  
 
===Critical Decisions and Factors===
 
===Critical Decisions and Factors===
*Our machine requires the user to authenticate the YouTube channel before uploading. This is only 2 extra buttons to press, but it is inconvenient and requires a browser pop-up. We were unable to automate this process because, unlike the old ClientLogin to authorize command-line scripts to run on servers without a browser, YouTube's new OAuth 2.0 system requires user authentication through a browser.  
+
*Our machine requires the user to authenticate the YouTube channel before uploading. This is only 2 extra buttons to press, but it is inconvenient and requires a browser pop-up. We were unable to automate this process because, unlike the old ClientLogin to authorize command-line scripts to run on servers without a browser, YouTube's new OAuth 2.0 system requires user authentication through a browser. <ref>https://developers.google.com/youtube/v3/guides/moving_to_oauth</ref>
 
*Our system only allows time-stamps of deductions to be precise within one second. This is because YouTube only allows second time-stamp marks for videos. However, this is not a huge problem as there is human error in the reaction time to the judge to press the pedal, and deductions never occur more frequently than several seconds apart.  
 
*Our system only allows time-stamps of deductions to be precise within one second. This is because YouTube only allows second time-stamp marks for videos. However, this is not a huge problem as there is human error in the reaction time to the judge to press the pedal, and deductions never occur more frequently than several seconds apart.  
 
*When we turn on the Raspberry Pi the system does not automatically start. This is because we thought that the trade off of not being able to access other files important to the program would be too great. As a prototype version, we valued the ability to easily manually edit files on the Raspberry Pi.  
 
*When we turn on the Raspberry Pi the system does not automatically start. This is because we thought that the trade off of not being able to access other files important to the program would be too great. As a prototype version, we valued the ability to easily manually edit files on the Raspberry Pi.  
 
===Demo Poster===
 
===Demo Poster===
[[File:Demo_Poster.png|frameless|border|600px|Demo Poster]]
+
[[File:Demo_Poster_1.png|frameless|border|600px|Demo Poster]]
 +
 
 +
===Source Code and CAD Files===
 +
:Source Code: https://lll2657@bitbucket.org/lll2657/gym-project.git
 +
:Cad Files: http://www.thingiverse.com/thing:2284240
  
 +
==References==
 +
<references />
 
[[Category:Projects]]
 
[[Category:Projects]]
 
[[Category:Spring 2017 Projects]]
 
[[Category:Spring 2017 Projects]]

Latest revision as of 16:08, 3 May 2017

Project Proposal

Group Members

Aidan Warren and Lawrence Chan
TA: Nathan Schmetter

Project Overview

Right now, judges score gymnasts using pen and paper, and often have to employ assistants to enter scores for them. We would like to improve this process and to have a more efficient and better way of scoring gymnastics moves. We would build a machine using Raspberry Pi to record deductions with buttons (including a time-stamp of each deduction). There will also be a camera that records the gymnasts' routines. Gymnasts now are unable to view feedback from judges and only receive the final score. Our machine will upload the gymnasts's routine video to Youtube along with timestamp information about when each deduction took place. It will also include their routine's difficulty points and other scoring information. The gymnasts will then be able to go online to view their routines and figure out what mistakes they made and what they need to work on. For our demo, people will be able to watch recorded routines or skills on a computer and score them using our machine. They can then view the youtube video and comments that are uploaded.

Objectives

  1. Design the circuitry and Raspberry Pi to input scores with buttons and record the gymnasts' routines using a camera.
  2. Design and build a unit to house the computer and circuits.
  3. Upload the information to Youtube for the gymnasts to see the scoring process and view their mistakes.
  4. Let the audience use the machine for score deduction with a video of a gymnastics routine during our demo.

Challenges

  • Learn how to use Raspberry Pi.
  • Learn how to code with Python.
  • Learn how circuits work and how to create them (for visual inputs, and display/internet outputs).
  • Learn how to implement buttons to the Raspberry Pi.
  • Learn how to connect the camera to the Raspberry Pi and take videos with it.
  • Learn how to upload the information collected from the Raspberry Pi to Youtube.
  • Figure out how to 3D print the housing for the unit.

Budget

  1. $0.00 Raspberry Pi
  2. $0.00 Youtube upload videos service
  3. $29.95 Raspberry Pi Camera - https://www.adafruit.com/products/3099
  4. $7.97 Camera Extension Cord https://www.amazon.com/Adafruit-Flex-Cable-Raspberry-Camera/dp/B00XW2NCKS/ref=sr_1_2?ie=UTF8&qid=1486763635&sr=8-2&keywords=raspberry+pi+camera+extension+cable
  5. $22.99 Elecrow TFT Display Monitor 3.5 Inch 480x320 TFT LCD Display with Touch Screen for Raspberry Pi 2B B+ Raspberry Pi 3B - https://www.amazon.com/gp/product/B013JEV6VA/ref=ox_sc_act_title_1?ie=UTF8&psc=1&smid=A3UAI31N6IJM2
  6. $0.00 3D-Printing Materials and Software
  7. $7.50 (+ $7.14 Shipping) Foot Switch https://www.adafruit.com/products/423?gclid=Cj0KEQiAxeTFBRCGmIq_7rGt_r8BEiQANdPqUk8XYG37qe-_8iJT87roB9Z0fK-OCeW72jrDsBP9niUaAlmV8P8HAQ

Total: $75.55

Gantt Chart

Gantt Chart

Initial Machine Design

Initial design for the scoring machine

Initial design for the scoring machine. Includes a screen, four buttons for deductions, and one button for camera recording.

Design and Solutions

Module 1: Raspberry Pi and Display Screen

Design

We needed a mini-computer to act as the main body of our machine, that is able to connect to other inputs such as the foot pedal and the camera. We also needed something to display the GUI of our program.

Solution

We are using the Raspberry Pi as the main body of our machine, connecting it to a 3.5 inch LCD with touch screen for the GUI of our program from Elecrow. The installation of the 3.5 inch Pi LCD is shown in this page: Installation of the 3.5 inch Pi LCD. [1]

Module 2: Inputs

Design

We needed an input to record the routine video and an input to time-stamp the judge's deductions. For the time-stamps, we need a an input that does not interfere with the judge's handwritten scoring. For filming, we needed a small camera that was easily compatible with Raspberry Pi to reduce our work load.

Solution

We decided to use a foot pedal to time-stamp deductions because it left the judge's hands free to score. Also, only having one button (pedal) instead of multiple makes it easier to use during a fast routine. Because the display screen from module 1 used up all the voltage pins, we didn't have any left for the foot pedal (which had a voltage, ground, and pin wire). In order to solve this problem we coiled the ground and voltage wires together and connected them to a single ground pin. The pin wire we simply connected to a GPIO pin. This works because it completes the circuit and the foot pedal doesn't actually require any voltage to work. It functioned as a simple button. For the camera, we used the Raspberry Pi camera. It is extremely small, and easily compatible with the Raspberry Pi. We plugged it in and only needed to change the screen orientation in order for it to work.

Module 3: Housing

Design

The Raspberry Pi camera must have a housing that protects it. It must also move so the camera can point in any direction. The Raspberry Pi and screen case must be easily openable so we can work on it, and must have ports for many different wires. It also should make it easy for the judge to use and see the screen.

Solution

The camera housing is a small box on top of a base, held together by a pin. The pin allows the camera to rotate up and down, while the base can simply be turned in either direction. This allows the camera to point at any angle to best capture the routine. The pin and lid joints are sticking joints, so the camera will remain in whichever position it is put in.


Camera Housing: Lid, Body, Pin, Base


The Raspberry Pi and Screen is housed in a box at an angle to make viewing easier. It has a sliding lid to make accessing the Raspberry Pi easy (this is also a sticking joint to that the lid won't fall out). There are three holes to accommodate the charger, camera cord, and pedal wires.

Machine Housing: Lid (rotated 180°), Body

Module 4: User Interface

Design

The judge needs interface screens for:

  1. Entering the gymnast's number (or some way to identify each gymnast)
  2. Recording the video
  3. Entering the gymnast's skill values
  4. Entering the gymnast's fulfilled element groups
  5. Entering deduction values for each of the deductions

There also must be a way to navigate to the next screen. Our original screen sketches incorporated all of these.

Screen Interface Designs

Solution

Our final interface screens look pretty similar to our designs. We used a blue continue button in the upper right corner of each screen to keep the interface consistent. We also chose a black background to match the machine housing, and used grey buttons across all screens. This contrast makes the buttons easy for the judge to see.

Screen1

The first screen inputs the gymnast's identification number.

Screen2

The second screen starts and stops the video recording. Once the judge presses the green "start recording" button, the button changes to a red "stop recording" button. There is also a counter that tracks the number of times the judge presses the pedal during the routine (deduction counter). The judge judges the routine by hand (using pen and paper) as he watches. The next three screens accept inputs from the information he wrote down on his paper.

Screen3

The third screen inputs the skill values. The judge can use the up and down arrows to adjust the number of each level (A, B, and C) skills the gymnast performed.

Screen4

The fourth screen inputs the element groups the gymnast performed. The judge can check the boxes of the element groups performed.

Screen5

The fifth screen inputs the deduction value for each time-stamped deduction. The number in the upper left corner tells the judge which number time-stamp deduction this screen is. This screen repeats for as many deductions as the judge recorded. After pressing the continue button, the video is automatically converted, and an internet browser for YouTube opens. The judge then must click the "allow" button in order for the video to be uploaded. After clicking "allow," the system automatically closes the browser the proceeds to the sixth screen.

Screen6

The sixth screen displays the final score. Clicking "continue" moves to screen one and restarts the judging process.

Module 5: YouTube Upload

Design

In order for the athletes to receive feedback for the deductions at each part of their routines, we need a way to upload the video of the athlete's routine with time-stamps showing when each deduction occurred.

Solution

We decided to use YouTube as the platform to provide feedback for the athletes. This is because it is a widely-used website for videos sharing and that the description of each video allows time-stamps to the video that is easily accessible by just clicking on it. This is a guide to direct uploads of videos from the Raspberry Pi by using a Python program: Directly Upload Videos to YouTube with Raspberry Pi and Python. [2]

Results

Final Product

All the modules described above were implemented. Our machine includes a Raspberry Pi connected to a 3.5" display screen which displays the interface. A raspberry pi camera records video and a foot pedal time-stamps deductions. Both of these are connected to the Raspberry Pi. The camera and Raspberry Pi both have 3-D printed housings. The user interface is simple and takes the judge through multiple scoring screens before automatically uploading the video with time-stamped deductions to YouTube.

Final Machine

Compared to Original Objectives

We successfully designed circuitry and utilized the Raspberry Pi. Unlike our initial design, which used four buttons, our final design used only one foot pedal, simplifying our circuitry and the user experience. We also successfully 3-D printed housings for both our Raspberry Pi + Screen and Camera. The machine also automatically uploads the video and deduction time-stamp information to YouTube, which is available for viewing within 2 minutes and does not interrupt the program. We had a successful demo. The audience was able to use the machine to time-stamp a gymnast's fall deduction, and then see that video uploaded in real time.

Critical Decisions and Factors

  • Our machine requires the user to authenticate the YouTube channel before uploading. This is only 2 extra buttons to press, but it is inconvenient and requires a browser pop-up. We were unable to automate this process because, unlike the old ClientLogin to authorize command-line scripts to run on servers without a browser, YouTube's new OAuth 2.0 system requires user authentication through a browser. [3]
  • Our system only allows time-stamps of deductions to be precise within one second. This is because YouTube only allows second time-stamp marks for videos. However, this is not a huge problem as there is human error in the reaction time to the judge to press the pedal, and deductions never occur more frequently than several seconds apart.
  • When we turn on the Raspberry Pi the system does not automatically start. This is because we thought that the trade off of not being able to access other files important to the program would be too great. As a prototype version, we valued the ability to easily manually edit files on the Raspberry Pi.

Demo Poster

Demo Poster

Source Code and CAD Files

Source Code: https://lll2657@bitbucket.org/lll2657/gym-project.git
Cad Files: http://www.thingiverse.com/thing:2284240

References