You Are Here: Home » AVR ATmega Projects » Wall of Pong using ATmega32 microcontroller

Wall of Pong using ATmega32 microcontroller




Wall of Pong is a fast-moving, interactive, laser-based pong game playable on any flat surface.

The system uses a digitally controlled laser projection platform to draw a pong ball onto any flat surface. This allows for a large playing area that can be set up almost anywhere. Hand held paddles with embedded sensors are given to each player. The real life paddles increases the interactivity of the game and makes it an enjoyable and dynamic derivative of the original PONG arcade game.

Wall of Pong

This project was a five week design lab for ECE 476 at Cornell University. Video of the final demonstration is available in the Results section.

Adrian Wong (aw259)
Bhavin Rokad (bkr24)

High Level Design

Inspiration | Concept | Mathematics | Standards

Project Inspiration

The Wall of Pong is actually the successor to the project that we were originally designing for ECE 476. Our original objective was to design a laser tracking system built around a circular saccade (see “Laser-Based Finger Tracking System Suitable for MOEMS Integration” by S. Perrin, A. Cassinelli, and M. Ishikawa). We completed most of the project, but we were unable to design the necessary focusing optics. As a result, we decided to adapt our base platform to the Wall of Pong concept.

The Wall of Pong brings the arcade PONG game to the real world by projecting an image of the pong ball on any flat surface and allowing players to play the game with real paddles. The game also targets all three of our personal objectives for our ECE 476 final project: an interactive electromechanical system with fast operation. We wanted a project that involved interaction between the user and the system with very fast response times to user’s actions to give a satisfying experience. We also wanted to stress a project with electromechanical components, as we wanted something tangible with our project instead of a project based entirely in software.

Overall Concept

The laser platform is built around three main components: the laser project platform, the hand held paddles, and the microcontroller. The first is the laser beam projection platform. The laser beam is first projected onto a rotating mirror. The reflected beam will be circular due to a slight off-axis mounting angle. The circular beam can then be steered using two motors. One motor controls the x-axis motion and the second motor controls the y-axis motion. The mechanical mechanism that allows for orthogonal rotation of the mirror in independent axes is called a gimbal.

The second component is the hand held paddles. Each player will hold a paddle that has three embedded light sensors. The light sensors can detect when the laser beam hits the paddle. The light sensors are spaced close enough together so that they can collectively detect any ball collision along the full length of the paddle. The paddles are wired into the microcontroller through a long flexible cable.

The third component is the microcontroller itself. The microcontroller will control the operation of the gimbal to move the ball around the playing field and have it bounce off virtual walls. The microcontroller also handles the detection of the projected laser beam by two hand held paddles.

Background Mathematics

The pong ball is drawn using a gimbaled laser platform and two paddles are wired to detect the pong ball projection. Our two primary concerns were the angular resolution of our system as well as the operating speed of the laser pong ball.

Angular Resolution

Our target specification was to have an angular resolution of less than 0.3 degrees for targeting of the laser beam. This corresponds to 5.236 mm of spatial resolution at 1 meter range. We overdesigned the system with a 100% margin by designing for 0.15 degrees of spatial resolution in both axes. This means that our final design can place the laser beam with 2.6 mm of accuracy in both x and y axes at 1 meter range.

With each degree of mirror rotation, the projected beam actually moves twice as much. This can easily be seen by considering the law of reflection (angle of incidence is equal to angle of reflection). If the incident beam is held steady and the mirror is rotated by an angle θ, the incident angle as measured off the normal of the mirror has increased by θ and the reflection angle has increased by θ as well. The angle between the incident beam and the reflected beam has now increased by 2θ. This means that the target resolution must be 0.075 degrees per step for the motor mounted to the mirror.

The stepper motors only have a 7.5 degree step resolution. In order to increase this to 0.075 degrees per step to reach the target specification, the stepper motor must have a 100 fold increase in resolution. This is achieved through a combination of software and hardware. The software can double the resolution by half stepping the stepper motors. The remainder must be achieved through hardware.

One approach is to design a gear train for the stepper motor, which can increase the angular resolution as well as the torque output of the motor. The gear train must have a 50:1 gear reduction. The brass gear on the stepper motor has 10 teeth at 48 diametral pitch. A naive approach would involve a 500 tooth gear meshed to the 10 tooth pinion gear. That approach, however, would create 10.5” diameter gear. This is much too large for the mechanical gimbal design. Instead, our proposed compound gear train runs uses two 100 teeth gears and an intermediary 20 tooth gear (10:100 and 20:100). This achieves the 50:1 gear reduction target.

For the x-axis rotation, we can circumvent the loss of mirror resolution due to reflection by mounting the laser onto the same platform as the mirror. Since the laser moves along with the mirror, we simply rotate the entire assembly. This reduces our requirement to 0.15 degrees or a 50:1 gear reduction. We can again apply the half stepping approach to relax the hardware requirement to a 25:1 gear reduction. The y-axis gimbal assembly can fit on a 6.25” diameter gear, which corresponds to a 300 tooth gear at 48 pitch. If this gear is meshed directly to the 10 tooth pinion gear, this exceeds our target specification by creating a 30:1 gear reduction.

Operating Speed

With such a large gear reduction, the actual movement of the laser beam is also reduced by a factor of 50. We were concerned that the stepper motors would not be able to step quickly enough to move the ball in a satisfying manner for the game.

Our goal was for the ball to move at least 10 cm per second at 1 meter range. This corresponds to 5.71 degrees per second of angular velocity. Going through the 50:1 gear reduction, the stepper motor must reach 285 degrees per second. This corresponds to a frequency of 4.974 Hz in full step operation or 9.948 Hz at half step operation. This is readily achievable using a 16 MHz microcontroller.

 

For more detail: Wall of Pong using ATmega32 microcontroller

Leave a Comment

You must be logged in to post a comment.

Read previous post:
How Digital Clocks Work
How Digital Clocks Work

The Basics If you have read How Pendulum Clocks Work, you know that all clocks (regardless of technology) have a...

Close
Scroll to top