The videos below represent the electronics from our high fidelity model, before the electronics were integrated into our mechanical elements. For clarity, the "top" lights are represented by the green LEDs in the breadboard, the "bottom" lights are represented by the red LEDs and the internal timer is set to only 15 seconds, but will be much longer in the actual game. Additionally, while videos of the electronics working with the mechanical elements can be found on other pages (how to play and design process), these videos show the electronic components separated from the mechanical elements. The servo motor that turns 180º will be attached to an hourglass, flipping it over. The servo motors that flip 90º will be positioned at the top of the board, releasing the balls when time is up. Finally, the limit switches will be positioned in the slots at the bottom of the board, such that the balls will hit them when they fall through.
After pressing the button, all six lights turn on (three that will be at the top and three at the bottom), followed by the 180º revolution of the servo motor. Once the green lights turn off, and the other three servo motors rotate 90º, pressing any of the limit switches triggers the light strip.
Once the arcade button is pressed, the three top lights and two, randomly selected, bottom lights all turn on, followed by the rotation of a servo motor. When time is up and the three servos rotate 90º, the press of a limit switch associated with one of the lit bottom lights will result in the illumination of the light strip.
As with the other two levels, pressing the button triggers all three of the top lights, but, this time, only one (randomly selected) bottom light. After the servo motors have flipped and the time is up, the light strip will only light up if the limit switch corrresponding to the singular bottom light is pressed.
Code (Python)
The three codes used to power each level are nearly identical in their setup and operation, with a few key adjustments that allow the levels to be differentiated. In all three codes, all the different electronic components (LEDs, servo motors, arcade buttons, limit switches, and LED strip lights) are defined before being used. The main code is extraordinarily short on account of the major sequences being incorporated into various functions. The main function follows this basic sequence: button pressed, flip hourglass motor 180º , turn on top and bottom lights, sleep for designated amount of time, release balls, determine if balls hit corresponding limit switches. As discussed in the "How to Play" section, the amount of time that the player has to make their path before the ball drops is different for each level: 2 minutes for easy, 1 minute for medium and 30 seconds for hard. To control this, the code sleeps for that defined amount of time before dropping the balls. The other major difference is the number of bottom LEDs that light up for each level. For the easy level, there is no randomization as all three bottom easy LEDs light up. For the medium level, 2 integers (from 1 to 3) are randomly generated, then checked against each other to ensure they are different numbers. The bottom medium LEDs that correspond to the numbers generated are then lit up. Finally, for the hard level, 1 integer (from 1 to 3) is generated and the bottom hard LED corresponding to this number is turned on. Accordingly, the only limit switches that will result in a "win" are those that are associated with the lit up bottom LEDs. This matters because winning the game is dependent on getting the ball into a lit up bottom slot.
Pseudocode Flowcharts (Easy, Medium, Hard)
Wiring
Despite having tabletop version of our circuitry, as well as our code, since the first prototypes, the wiring and integration of electronics became one of our greatest challenges. Ultimately, the wires on each circuit were extended via soldering (length specfics can be seen below) for a total of 111 wires. These wires, now removed from their respective breadboards, were carefully placed, labeled and taped to the back of the board, with their loose ends placed in the general location of the broadboards. The breadboards and picos were then placed on the back of the board and each wire was methodically pushed into place according to the pin numbers assigned in the code. Once this process had been completed, the breadboard were taped to the backboard and wires were further secured to avoid displacement during transport.
Easy wiring diagram
Medium wiring diagram
Hard wiring diagram
This image shows all of the wiring that was done to connect the three picos to their repsective electronic components, corresponding to each of the three levels.