ECE434 Project - Cornhole Board
Embedded Linux Class by Mark A. Yoder
Team members: Sam Hedrick, Tristen Foisy
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!
10 Executive Summary 10 Packaging 10 Installation Instructions 10 User Instructions 10 Highlights 10 Theory of Operation 10 Work Breakdown 10 Future Work/Conclusions 10 Hackster.io 10 Demo/Poster 00 Not Late Score: 100/100
Our project features a game modeled after cornhole (also known as bags). The player is able to throw objects into the hole on the game board to score, which is indicated and kept track of using various electrical elements we included.
We implemented the project by using a servo, infrared reflection sensor, buzzer, and 7-segment digital display, we can give feedback to the user regarding the current score. The IR reflection sensor detects when an object is in front of it and the returned wavelength is less than the amount set by changing a potentiometer on the sensor. Then, it reacts by changing a servo’s position and after a round is complete the display updates with the current score.
The implementation currently has nothing that was not implemented; everything that was implemented was what in accordance with what we planned for this iteration of the project (we elaborate on previous ideas later). One component that didn’t work exactly as planned was the 7-segment display; we had to use GPIO to drive it because we did not have a way to drive the display with i2c.
Though we were not able to realize our initial goals, we did arrive at a product that we are satisfied with. It was very fun to explore some hardware that we did not use in class, and we are grateful that Dr. Yoder’s instruction was able to help us complete the project!
Picture that summarizes the project.
Our project features a scaled-down version of cornhole, and thus requires a board to be made to match. This board is simple: it is a slanted cardboard platform with a hole near the top. Inside this hole is our infrared reflection sensor, which detects when an object (bag, ball, or otherwise) enters the hole. The servo features a pinwheel that shows the current score outcome for that round. Based on how many times each player has scored, one of 9 positions will be pointed to. There is also a pushbutton that is used to change which player is currently shooting.
Pictures and diagrams
To install and use, a few things are needed. First, the IRBuzzerServoTest.py program needs to be downloaded. This can be found in our hw10 repos on Github. Running this program requires the imports below. If the user does not have them, they need to be installed first.
- Import Adafruit_BPIO.GPIO - Import Adafruit_BPIO.PWM - From time import sleep - Import math
As this is a python program, the user must also have python installed to run it. The pins needed for this project are GPIO and PWM pins, so we also need to setup all of the pins to be able to be ran this way. To do this just run the setup.sh file that we have provided.
Using our game is incredibly simple! Our goal was to make something engaging to the player, yet familiar.
To begin gameplay, the user must run “FinalProject.py” with the computer connected to the BeagleBone. After doing so, the program will have started running and the players may proceed to play.
Once gameplay has started, players take turns trying to throw objects into the hole. After each player has taken a shot, they must press the pushbutton that is on the board to switch to the next player’s turn. Players continue taking turns until each one takes 4 shots for a total of 8 attempts across both players.
Each time a player makes a shot, the servo’s position will change to reflect the new round score. It will point to one of 9 positions (between 1-4 for each player, plus 0 points) based on who has made how many shots. Making a shot will cause the position to move towards each player’s respective ‘half’ of the 180-degree semicircle; the first player causes the servo to move to the left and the second player causes the servo to move to the right.
After all 8 shots have been taken in a round, the servo resets its position to position 0 and the 7-segment display is updated with how many points were earned.
The game ends when either player has scored a total of 21 points. At this point, the console thanks the users for playing and program execution ends.
What we are proudest of with this project is how many different components we were able to use. It let us use a lot of hardware that we did not get exposure to in class, which was an engaging and informative experience. We are particularly proud of how we got the 5V power rail working, which was necessary to use the servo. All other components used the 3.3 volt coming from the external power supply as well.
We also take pride in the fact that our game is fun to play! Cornhole is a staple of outdoor hangout sessions across the country and having a miniaturized electronic version of it adds some extra features (and hopefully, player enjoyment). Keeping track of the score is incredibly helpful for forgetful people like us. Being able to track per-round score and overall game score is truly a useful addition.
Include a YouTube demo the audio description.
Theory of Operation
Our software requires one Python script to run. It does not use GStreamer. It does utilize a while loop structure to wait for an object to pass in front of the IR proximity sensor. After detection is made, the buzzer and servo are updated accordingly. The program also keeps track of shots made; if the number equals 8, the round is ended and the display is updated.
After the target score of 21 is reached by either player, the while loop is exited. After this occurs, PWM and GPIO need to be stopped.
Almost all inputs and outputs are handled using GPIO, however, the servo is used by changing the duty cycle of the pulse width modulation.
Necessary packages required to run the program include Adafruit_BPIO, time, and math.
Both Sam and Tristen did a great deal of research for the previous ideas that were planned for the project. This includes research into stepper motors, electromagnets, 3D printing, and parts to buy.
After we moved onto the current version, work was broken down as follows: - Sam programmed the scripts and wired the board up for the project. He was able to figure out how the majority of things worked and write the programs that allowed everything to execute. - Tristen did the writing for the project and built the housing. He did most of this webpage and used hot glue and cardboard to build the casing, which was designed to fit the components of the board.
As far as additional work is concerned, we will focus primarily on two different facets. Namely, we will focus on how this design can be improved and a few of the previous ideas we had planned but were unable to execute on due to technical and temporal difficulties.
There are a small handful of things we think would improve our project in its current state. They are: - Improving the 7-segment display to work over i2c. Doing so would lessen the flicker that is currently visible and also help to give the project a more polished look. - Making the board larger. By making it larger and out of better materials, we can improve the general quality of our project. It also gives us more room for the next improvement, which is: - Creating two gameplay boards. Doing this would require us doubling the number of IR detectors we use, but the rest of the project can use the given hardware. Points and the rotation of the servo work the same. With a larger play area, we might need to add a second button to indicate the next player’s turn. The location of some of the common hardware (like the servo, display, and buzzer) might need to be changed as well to facilitate ease of use. Having two boards closer approximates the real-world analog of our game too. - Changing how we switch between players. A simple solution for this would be an IR remote and receiver to replace the buttons. A more complex version could be to add a camera and use computer vision to teach the BeagleBone to recognize when different colored bags make an appearance in the game area.
We also feel that now is a good time to mention some of the previous ideas and how they would be implemented. The primary reason for doing so is because we may complete some of these in the future and we believe that future students could feel inspired by our ideas.
- Initially, we planned to make a 2-dimensional chess board. This would work using stepper motors to create an XY table, which allows movement in two dimensions. Attached to each of the chess pieces is a magnet that interacts with an electromagnet on the steppers that is powered on and off when moving pieces. To picture this, think of a 3D printer, but instead of the plastic nozzle there is an electromagnet. Commands are issued via the pc terminal. The primary issues we ran into with implementing this design were figuring out the stepper motors and power supply. - Once we had figured out that using the XY table for chess was too complex, we changed our design slightly, this time trying to make tic tac toe due to its simplicity. However, we ran into the same issues that prevented us from realizing this: the stepper motors and power supply were difficult to work with.
We are very grateful that we were able to complete a project that we are happy with. We were very inspired by all the different hardware we looked at and working with so many different components presented us with a great deal of learning opportunities. Above all, we are glad we got to learn something new through our cornhole board and are grateful for all the intellectual growth we got from this class!
Embedded Linux Class by Mark A. Yoder