You are on page 1of 10

MECHATRONICS ME156P SECTION E03 EXPERIMENT NO.

11
Experiment TITLE: Digital Hourglass
Salvado, John Henry M. Date Performed: Jan. 8, 2019
2013102950 Date Submitted: Jan. 15, 2020
Professor: Engr. Edward Ang Course and Year: MFGE/3
Group # 4

Discussion:
This Experiment titled the Digital Hourglass has the Class recreate an Hourglass,
wherein the main component of the experiment is the Tilt Switch Resistor. The tilt switch
resistor detects if the device has been flipped to control the turning on and resetting of
the hourglass. A tilt sensor has a metallic ball that is designed to move the two pins of
the instrument from the 'on' to the 'off' position, and vice versa, if the sensor reaches a
pre-determined angle. Tilt sensors are the environment-friendly version of a mercury-
switch
In the Experiment the Digital hourglass lights up the LEDs one at a time
depending on the time delay set between them which makes a predetermined time for
all of them to light up. Once all of them are lit you may “tilt” or turn over the Arduino to
activate the tilt switch resistor to start the count down again.

Learning Objectives:
This experiment’s objectives are;
- To be familiar with the time delay and time interval codes
- To familiarized the students with the function of tilt switch
- To understand the concept behind the operations of a tilt switch.
- To be able to successfully create a digital hour glass design project

Course Objectives and Anticipated Student Outcomes:


“a” to “k ” and “ L ”outcomes. The ABET outcomes taught and assessed in this course
are:
“A” Ability to apply knowledge of mathematics, science, and engineering
- The ability to apply knowledge of science and engineering was practiced in
this experiment as we could tinker with the Arduino and its code.
“B” Ability to design and conduct experiments as well as analyze and interpret data
- We were able to analyze the data we gathered using a cellphone app to
measure RPM.
“C” Ability to design a system to meet desired needs.
- We were able to adjust the code to meet the desired needs of the experiment.
“D” Ability to function on multidisciplinary teams
- We were able to spread out the workload among the group members evenly
so that each member has a role in the experiment.
“E” Ability to identify, formulate, and solve engineering problems.
- We were able to identify certain errors in our code and our set up. We were
able to confirm that some of our wiring wasn’t connected properly and we
were able to fix the issues in both the hardware and software side of the
experiment.
“F” Understanding of professional and ethical responsibility
- We were able to work independently as a group and finished the experiment
responsibly
“G” Ability to communicate effectively
- We were able to communicate together as a group and finished the work
efficiently.
“H” Broad education necessary to understand the impact of engineering solutions in a
global/societal context
- The scope of this experiment was very limited and didn’t tackle any global
issues.
“I” Recognition of the needs for and ability to engage in lifelong learning
- Aside from working as a group this piqued my interest in the programming
side of the Arduino experiments.
“J” Knowledge of contemporary issues.
- In the current Philippine situation, we lack innovators on that could compete
on a global scale, this experiment could be an eye opener for many students
“K” Ability to use the techniques, skills, and modern engineering tools for engineering
practice
- We exercised our skills in working with the modern engineering tool the
Arduino.
“L” Knowledge and understanding of engineering and management principles as a
member and leader in a team, to manage projects and in multidisciplinary environments
- As a member of the group we were able to acknowledge the different roles
we had to play in the experiment.
Group Assignments/Task done by EACH member:
GROUP NUMBER 4
EXPERIMENT #11
Experiment Title: Digital Hourglass Due Date: 1/15/2020
Group Member
Name: Brief % Completed
No. Group Member Description of by Members Your Score
Signature: the Work
assigned to
Members

Salvado, John Assembled the


1 Henry setup 100% 100

Roca , Reimbert
Randalla Programmed
2 100% 100
the arduino

Mendoza , Carlo E. Programmed


3 and 100% 100
troubleshooted

Fernando , Bon
Keno R. Brought the
4 100% 100
laptop

San Juan , Marco P.


Troubleshoot
5 100% 100
the experiment

*100% means the member completed his/her assigned work.


By signing this assignment cover sheet, I agree that the percentages stated in the %
completed column reflect the contribution made by me and the other members of the group.
List of materials Needed for the Experiment:
1. USB Data Cable (Yellow)
6. Red Connecting wires ( 3
medium length, 1 short)

2. Arduino Uno
3. Bread Board

7. Green Connecting Wires(6


4. RED LED (6 pieces) medium length , 3 short)

8. Tilt Switch Resistor


5. 220 ohm Resistor (6 pieces)
Schematic Diagram:
List of ACTUAL SAFETY procedures implemented in this experiment:
Steps:
1. Identify and Audit all parts needed for the experiment, Check if any are missing

2. Read the Arduino Uno Starter Kit for instructions.


3. Referencing from the Manual Assemble the Set up as shown in the schematic.
Take note of the polarity of the components as this is important.

4. While assembling the Set up another group member should Start Coding in the
Arduino Uno Program.
5. Once the set up has been assembled upload the code onto the Arduino Uno.
6. Test if the set up is working by tilting the breadboard to until the tilt shift resistor
activates. This should let the LEDs start to light up depending on the time delay
between them.

7. If set up is working as intended begin to record Data. Using a Stopwatch app on


a smart phone record the time intervals between the lighting up of the LEDs
8. Once finished, disassemble the setup and keep all component in the box.
Arduino Code:
1. const int switchPin = 8;
- Declares constant pin for the tilt switch with the value of 8.
2. unsigned long previousTime = 0;
- This is a variable that will hold the time a LED was last changed.
3. int switchState = 0;
- Declares the switchState to be a variable with the value of 0.
4. int prevSwitchState = 0;
- Declares the prevSwitchState to be a variable with the value of 0.
5. int led = 2;
- Declares the led to be a variable with the value of 0.
6. long interval = 5000;
- The number will be the time interval between two LEDs lighting up. The unit is in
microseconds.
7. void setup() {
- This is where the set-up code is placed.
8. for(int x = 2;x<8;x++){
- Declares all six as output with just 3 lines of code.
9. pinMode(x, OUTPUT);
- Sets x to be an output for LED
10. }
- This closes the for statement.
11. pinMode(switchPin, INPUT);
- This declares switch as an input
12. }
- This closes the void setup statement.
13. void loop(){
- This is where the main code is placed and ran repeatedly.
14. unsigned long currentTime = millis();
- This indicates how long the program is working
15. if(currentTime - previousTime > interval) {
- -If the difference between current and previous time is more that interval then.....
16. previousTime = currentTime;
- Makes the value for previousTime and currentTime to be equal in value.
17. digitalWrite(led, HIGH);
- Then the next LED will light up
18. led++;
- This makes for the preparing to light the next LED.
19. if(led == 7){
- If the led value is equal to 7
20. }
- Closes the second if statement.
21. }
- Closes the first if statement.
22. switchState = digitalRead(switchPin);
- This reads pin and stores it to switchState
23. if(switchState != prevSwitchState){
- If the value for the switchState is not equal to prevSwitchState then....
24. for(int x = 2;x<8;x++){
- When the signal read from switchState is not the same as before (prevSwitchState),
the
LEDs will turn off and the timer will reset
25. digitalWrite(x, LOW);
- This makes all LEDs will turn off
26. }
- Closes the for statement.
27. led = 2;
- Gives the value for led to be 2.
28. previousTime = currentTime;
- Makes the value for previousTime and currentTime to be equal in value.
29. }
- Closes the if statement
30. prevSwitchState = switchState;
- Makes the value for prevSwitchState and switchState to be equal in value.
31. }
- Closes the void loop statement
Data Sheet/ Gathered:
*in degrees
LED Time Interval Trial Time Interval Trial
1(seconds) 2(seconds)
1 5.1 3.0
2 5.4 3.2
3 5.0 3.4
4 5.6 3.1
5 5.6 3.2
6 5.2 3.3

ANALYISIS:
like in our previous experiment called spaceship interface we were tasked to
create time intervals between LEDS but instead of using a push button we used a tilt
switch resistor and more LEDs.
The data we gathered in this experiment was acquired by using a Smartphone
app stopwatch. Accuracy was dependent on the reaction time of the person holding the
smartphone as he watches the LEDs light up one after another, but the data we
gathered was all near the programmed time we put in which was 5 seconds and 3
second intervals.
In the end the experiment was a success and our data matched our
expectations.
Recommendation:
I recommend that we should integrate an LED screen into the experiment to
make it more challenging as this experiment is too similar to the spaceship interface
experiment. With the inclusion of the LED screen we may be able to digitally show the
countdown of the hourglass. This would overall be more interesting and useful in the
industry.
Conclusion:
In conclusion we were able to successfully set up the Digital hourglass
experiment. We were able to familiarize ourselves with the tilt sensor. A tilt sensor has
a metallic ball that is designed to move the two pins of the instrument from the 'on' to
the 'off' position, and vice versa, if the sensor reaches a pre-determined
angle. Tilt sensors are the environment-friendly version of a mercury-switch. This
experiment was very much like the spaceship interface, but instead of using a push
button to start the sequence we used the aforementioned tilt switch, this allows the set
up to behave just like an hour glass as you tilt the set up to activate it.
Answer to Questions:
a. Describe how does millis ( ) function in your experiment?
- Millis() function reports how long the Arduino has been running since it was
last powered on or reset. In the code this was used to assign the currenTime,
which tells the Arduino how long the program has been working or in our case
how long has it been since the tilt switch was activated.
b. What is the DIFFERENCE between tilt switch and accelerometer?
Research it! and explain its function. (Do not write it’s another type of tilt
switch!)
- Although tilt switch and accelerometer are similar in construction, they have
different functions. Accelerometers are used to detect magnitude and
direction of acceleration, and are available in one, two or three axis models.
Accelerometers may also be used as a tilt switch. A tilt switch however can’t
be used as an accelerometer, because it only does one function being an
on/off switch.
c. SUGGEST the INDUSTRIAL APPLICATION of this kind of experiment.
- An industrial application for this would be in factories where there are time
intervals between steps. The lights lighting up would signal workers if the
work done by a machine in that certain station is almost done and ready for
the next step.

You might also like