- ME 218A: “The Price is Right”
To design and build a penny arcade machine using mechatronics: electronics, electro-mechanical actuators, sensors, and embedded system software written entirely in C.
- 4 weeks to complete the project
- Can spend up to $150 for project purposes
- 3-person team
- The game must dispense a prize (edible or non-edible) if the game participant “wins” the game
- At least 3 interactions with the game participant: one must be analog and one must be non-contact sensing
- At least one game reaction must be electro-mechanical in nature
- At least one game reaction must take on a variable number of levels (at least 3)
- Game reactions must stimulate at least 2 senses
We decided to play a game pertaining to the popular television show, “The Price is Right.” Before the show’s contestants play a mini-game, they must bid on an initial product. All contestants who win the opportunity to play a mini-game also get to spin the “big wheel.” To incorporate elements of the television show in our penny arcade machine, we decided to design two games: a bidding game and a wheel spinning game.
The user was presented with a household item at random (out of 25 possible items); he/she had the goal of guessing more accurately than a randomly generated guess by the computer. If the user’s guess was within a price range determined by the correct price and a randomly-determined tolerance price, then the user proceeded to the wheel spinning game.
Wheel Spinning Game
The user spun our custom-made wheel on which 16 price divisions were printed. The user accumulated money by landing on certain positions on the wheel. The user’s goal was to get as close to $1.00 without going over. The computer generated a random wheel spin total which the player must compete against to win. If the user’s wheel spins were greater than or equal to those of the computer, then a motorized dispenser awarded a gumball to the user.
wheel for the user to spin during the wheel spinning game; the wheel was designed
using SolidWorks and built using laser-cut ¼” acrylic (see Figure 1 below)
- An electric motor to attach to the wheel so that the wheel would spin for fun while no user was playing; we obtained the motor from an inkjet printer
- A thin-walled structure to mount the coin sensor, wheel, LCD module, toggle switch, potentiometer, and LEDs; we designed the thin-walled structure using SolidWorks and built it using laser-cut 1/8” masonite
- A gumball dispenser using PVC and an electric motor from an inkjet printer
- Electrical Aspects
- C32 micro-controller
- Optical “coin” sensor to detect the insertion of a penny to begin playing the game
- Three optical emitter/detector pair sensors for the wheel’s homemade encoder
- LCD module to display information about the item up for bid and current game information
- One SPDT toggle switch for the user to enter a guess for the item up for bid
- One 10K potentiometer for the user to operate while changing his/her guess for the item up for bid
- An audio buzzer to emit sounds during the game
- Several LED lights placed around the wheel to attract potential game users while no user was playing
- LM339 comparators
- An H-bridge to drive the wheel motor
An optical encoder was used to detect the spinning wheel’s position. The encoder consisted of three optical emitter/detector pair sensors, each of which detected reflected infrared light from two sensor rings. The sensor rings and tape sensor positions are shown below in Figure 2. The outer sensor ring had a pattern of 16 alternating white and black squares corresponding to the 16 available prices shown on the front of the wheel. The primary tape sensor was aimed at this ring and incremented a counter each time it detected a rising edge going from black to white or a falling edge going from white to black. In this way, the encoder tracked the wheel’s relative movement.
- A secondary tape sensor used to determine direction was positioned on the outer ring at half of a division away from the primary tape sensor. By observing which sensor had a rising or falling edge first, the direction of the wheel’s rotation was inferred.
A second sensor ring, consisting of a single black square, was used to calibrate the absolute position of the encoder. Once per rotation, the calibration tape sensor detected the black square and reset the counter to reflect an accurate absolute position. While the tape sensor hardware was very reliable and accurately detected transitions at high wheel speeds, the speed at which the three tape sensor ports could be polled by our C32 microcontroller was not fast enough to ensure accurate counts over long periods of gameplay.
Each tape sensor’s output was conditioned before being fed into the C32 microcontroller. When optimally positioned, the tape sensors swung between approximately 2.5 and 4.0V as the black and white squares passed the sensors. This signal was used to generate clean, bounce-free transitions between 0 and 5V by passing the sensor output through a LM339 quad comparator with hysteresis.
The inner sensor ring was 4.75” OD/3.5” ID and the outer sensor ring was 7.5” OD/6.5” ID. The rings were made of cardstock and attached to the back of the wheel with the transitions lined up appropriately. The tape sensors were mounted approximately 1” from the back face of the wheel and were attached using laser-cut acrylic. While the spec sheet for the tape sensors gave a specific distance for optimal signal, we found that moving the sensors back further increased our signal and gave more reliable transitions.
- All embedded system software written in C
For code excerpt, please contact me.
The project and all intermediate deadlines were completed on time. We spent close to $142, and were thus roughly 5% under budget.
All project components worked well during the public demonstration. We observed user enjoyment to be high, perhaps due to user persistence because we designed the game to be fairly difficult to win (i.e. win a gumball).
Figure 3 below is a photo of our final project.