Sei sulla pagina 1di 4

Electronics and Coding

The Pirate Battle RGM utilized a variety of electronic events during its run. Electronic events were used
when replacing that event with a mechanical event was impossible or more difficult. Also, when creating
an electronic had a higher fun factor than creating a mechanical event, the electronic event was used.
All of the actuators used by the RGM were to be run off of 12 Volts except for the speaker. However, the
Arduino could only supply 5 Volts so transistor circuits were required for every actuator in order to
properly supply the actuator while still utilizing the Arduino logic.
The first electronic event was the human interaction of shining a light on a photoresistor to simulate
lighting a cannon. Prior to having the light shining on it, the Arduino code would wait in a while loop
anticipating a change in detected resistance. After the light was put to the cannon wick, the
photoresistor would change resistance. The new resistance value would be detected by the Arduino and
the code would move out the photoresistor loop and move into the first actuator loop.
This loop would first flash 3 LEDs in series and after which would play the song Hes a Pirate using the
speaker. Once the song was over, a spring-loaded solenoid in the cannon would turn on, pause for one
second, and then turn off. This would hit the cannon ball and begin the first mechanical event. The code
at this point would return to another while loop waiting for the next photoresistor to be read.
The next photoresistor was located under the falling anchor and would be covered up to change the
photoresistors resistance value. When the change in resistance was detected, the Arduino code would
enter the next loop which would turn on the second solenoid holding up the plank. The solenoid would
turn off after about 2 seconds to prevent it from drawing more current. The code would yet again begin
waiting for the next photoresistor to change.
The third photoresistor was at the end of the domino track and would be covered by the last falling
domino. When the Arduino detected the change in resistance, it would enter the third actuator loop
which would turn on the steering wheel motor for about 5 seconds and then turn it off. This was
determined through trial and error to be enough to allow the steering wheel to knock over the
collapsing wall as the event called for. At this point the code would wait for a change in resistance from
the final photoresistor.
The final photoresistor was covered by the collapsing wall. When the Arduino detected the change in
resistance, the code would enter the final actuator loop. In this loop, the fan would turn on for about 5
seconds then stop. After the fan was off, the motor attached to the flag pole would turn on for .8
seconds then stop. The RGM had completed its run after this step.
The Bill of Materials for the electronic components is shown below.

Item

Quantity

Price

Total Price

Purchased From

Photoresistor

$0.79

$3.16

RadioShack

Solenoid
Speaker

2
1

$10.00
$15.00

OSU
RadioShack

LEDs

$3.99

RadioShack

Fan
DC Motor

1
2

$5.00
$15.00
$3.99 per
pack
$19.99
$5.00

$19.99
$10.00

RadioShack
RadioShack

The figure below shows the location of the Arduino and all the electronic component in relation to the
board.

A flowchart for the microprocessor logic explained above is shown below.

The figure below is the wiring diagram for all the electronic components.

Potrebbero piacerti anche