Академический Документы
Профессиональный Документы
Культура Документы
1
Experiment TITLE: SPACESHIP INTERFACE
Discussion:
This experiment titled the spaceship interface is about controlling the power
states of the Arduino. The experiment wants us to emulate a spaceship interface out of
an old science fiction movie. Where in while the button isn’t pressed a green light is
constantly lit, then when the button is pressed it shuts off and a red LED turns on. A
countdown starts then it turns off then another Red LED turns on, then another
countdown then it shuts off and the green LED turns on. In short it turns LEDs on and
off with a time delay in between after pressing a button. To achieve this, we will be
controlling the digital pins of the Arduino. Which can read two states which are if there is
voltage or not. These two states are call High and Low, High being a powered state and
low being a non-powered state. To tun on a pin we use the command DigitalWrite() and
use HIGH.
Learning Objectives:
This experiment’s objectives are to familiarize the students with working on the
Arduino. This first experiment allows the students to tinker with the Arduino and set it up
for the first time. By using a very simplified set up any student can properly connect all
the components together and learn how to properly check the connections if they are
indeed working. In line with the ABET objectives student are able to apply their
knowledge in engineering and to further improve on them.
The experiment’s programming side allows the students to tinker with the given
code. Adjusting the variables to achieve different results. This also exercises the
students Data gathering skills, when checking if changing different variables in the
program is achieved in practice.
Course Objectives and Anticipated Student Outcomes:
“a” to “k ” and “ L ”outcomes. The ABET outcomes taught and assessed in this course
are:
Salvado, John
Henry Assembly of the
1 100% 100
Setup
Fernando , Bon
Keno R. Gathered the
4 100% 100
Data
Legend:
1. USB Data Cable (Yellow)
2. Arduino Uno
3. Bread Board
4. 2 pieces Medium length Connecting Wires (Green)
5. 1-piece Short length Connecting Wire (Green)
6. 2 pieces Red LED
7. 1-piece Green LED
8. 1 Piece Push button Switch
9. 4 pieces Medium Length Connecting Wire (Red)
10. 3 pieces 220 ohm Resistor
11. 1 piece 10k ohm Resistor
List of ACTUAL SAFETY procedures implemented in this experiment:
Steps:
1. Identify the different parts needed for the set up
2. Assemble the Spaceship Interface setup, referencing from the manual provided.
3. Assemble all the parts onto the breadboard and connect it to the Arduino Uno.
4. Connect the Arduino Uno to the Laptop using the Provided Data Cable.
5. Open the Arduino Program
6. Referencing from the Manual copy the Code for the spaceship interface.
7. Upload the Code onto the Arduino.
8. Make necessary adjustment to the code if errors are found.
9. Measure the time delay between the LEDs if they correspond with the program.
10. Once data has been confirmed run a second test with different time variables.
11. Repeat confirmation of data gathered.
12. Disassemble the set up and return to the box.
Arduino Code:
void setup () {
pinMode (3, OUTPUT); //sets the pin mode for pin 3
pinMode (4, OUTPUT); //sets the pin mode for pin 4
pinMode (5, OUTPUT); //sets the pin mode for pin 5
pinMode (2, INPUT); //sets the pin mode for pin 2
}
void loop () {
int switchState = 0; //tells the variable that it stores
switchState = digitalRead (2);
if (switchState == LOW) {
digitalWrite (3, HIGH);
digitalWrite (4, LOW);
digitalWrite (5, LOW);
}
// the codes in the loop starting at switchstate , powers the Green LED in pin 3 as long
as the button is not pressed
else {
digitalWrite (3, LOW);
digitalWrite (4, LOW);
digitalWrite (5, HIGH);
delay (2500);
digitalWrite (4, HIGH);
digitalWrite (5, LOW);
delay (2500);
}
// the Code above starting from the else{ comman contains a loop, in this loop once the
push button is pressed, it switches pin 3 into a LOW state , and makes pin 4 a LOW
state , and make pin 5 a HIGH state. After a time delay which would be 2500 ms in here
, it will then make pin 4 a HIGH state and pin 5 a low State, then another time delay of
2500. This is a repeating loop as long as the button is pressed.
}
Data Sheet/ Gathered:
TRIAL 1:
LED # COLOR TIME
1 RED 2.48
2 RED 2.68
3 GREEN 0
TRIAL 2:
LED # COLOR TIME
1 RED 9.99
2 RED 10.11
3 GREEN 0
ANALYISIS:
The only data that we could gather in this experiment was the time delay
between the powering on and off of the LEDs. This was only done to confirm that our
programming was correct. The data we gathered was done using a stopwatch app on
our smartphones. We succeeded with the experiment because the program was easy
to analyze and to tweak. The Data we gathered was also successful because the
variables we set in the program were in line with the data we gathered with human error
playing a big part for the differences in the times.
I learned the basics of the Arduino Uno and how to upload programs to it. I also
learned how to tweak the program provided by the manual to achieve our desired
results.
Recommendation:
I recommend that we be given situations or problems, wherein we have to tweak
the program so that the LEDs react properly to the given situation. This would enhance
our problem solving skills, and our ability to tweak with the Arduino programs.
Conclusion:
In conclusion to this experiment we were able to achieve the objectives set for
us. We were able to set up the Spaceship Interface on the breadboard and Arduino
Uno. We were also able to properly tweak and adjust the program provided to us by the
manual so that it reacts properly when we press the push button on the breadboard. We
were able to program the Arduino so that there is a variable we can adjust so that we
may change the time delay between the powering on and off of the different LEDs.
Answer to Questions: