The Resistors

Me En 495R Mechatronics Competition, Brigham Young University

Shooting Board

The shooting board is responsible for sorting the ping pong balls and firing the appropriate color ball into its respective hoop. As the figure shows below, the shooting board has many peripherals to control. It includes the following:

State Machine

A state machine was devoloped as the framework for programming the PIC24F. The source can be downloaded from the repository (, but a brief overview of the state machine follows. There are four distinct states: Homing, Sorting, Hold Fire, and Fire. In the Homing state, the carousel motor rotates until the PIC24 detects a rising edge from the opto-interrupt. This ensure that the carousel is positioned with both a ping pong ball directly over the hatch, as well as in the field of view of the color detection module. The state is then set to sorting.

The Sorting state is one of the "smartest" aspects of our robot. While the localization routine is being run on the navigation board, the sorting routine is being run simultatneously on the shooting board. Here, we detect the color of a ball and store it in a respective array. The carousel is rotated to the next ball where it is subsequently detected. This process is repeated for each of the six balls. By using this method we are prepared to shoot both of the same colored balls when we detect a target hoop. When the sorting is complete, the state is set to Hold Fire.

While the robot is in the Hold Fire state, it is continually listening for a message transmitted by the navigation board via the SPI bus. The message contains a target color. When a target color is received, the state is set to Fire.

The Fire state is another quite intelligent routine. First, the shooting motors are engaged. The number of opto-interrupt steps between the current index of the carousel and the target index is calculated. The carousel is then rotated to the target index, at which point the servo hatch is opened releasing a ball into the firing motor chute. This process is repeated for all existing target-colored balls. Upon firing all target-colored balls, the shooting motors are disabled and we re-enter the Hold Fire state.

The following diagram gives a simplified visual description of routine the robot performs.

Schematic and Board Layout

The following is an Eagle schematic for the shooting board. It, as well as its acompanying board layout files can be downloaded from the repository. A protoboard was used in the final project due to tight time constraints and the turn-over required to fabricate a PCB; however, a board layout was designed and given more time we would have liked to integrate it into our system.