paper portfolio

30
ELECTRICAL ENGINEERING TECHNOLOGY PAPER PORTFOLIO COREY B NIKIRK

Upload: corey-nikirk

Post on 14-Apr-2017

222 views

Category:

Career


0 download

TRANSCRIPT

Page 1: Paper Portfolio

ELECTRICAL ENGINEERING TECHNOLOGY

PAPER PORTFOLIOCOREY B NIKIRK

Page 2: Paper Portfolio

ELECTRICAL ENGINEERING TECHNOLOGYCOREY B NIKIRK

Page 3: Paper Portfolio

EGG DROP LAB REPORTLab Partners: Luke PorterDate of Experiment: 10/15/2015Objective: The objective is to design a lightweight device using the least number of provided materials to protect a large grade A egg from breaking when dropped. When dropping the built device, the goal is to have it land within the smallest diameter of the target drawn on the ground.List of Equipment:

General Equipment• Scale to measure the weight of the device (without the egg)• Chalk and string to draw target on the ground• Measuring tape to measure height of drop• Stopwatch• Egg drop data sheet and pencil to record data• Calculator to calculate score and velocity

Engineering Concepts In Technology

Resources: Microsoft Word

First Trial Second Trial

• 1 plastic bag• 2 rubber bands• 3 popsicle sticks• 1 Styrofoam cup• 1 sandwich baggie

• 2 rubber bands• 3 popsicle sticks• 1 Styrofoam cup• 1 sandwich baggie

Page 4: Paper Portfolio

EGG DROP LAB REPORTTheory: When holding an egg upright by the top and bottom and applying pressure, the egg would be very difficult to break. When building a design, it is important to remember this concept and to place the egg upright in the device, rather than on it’s side. There are two goals at stake: preventing the egg from breaking, and landing the egg within the smallest diameter of the drawn target on the ground. The drawn target has 3 drop zones: a 2 ft. diameter, 4 ft. diameter, and a 6 ft. diameter. The experiment is done outside, so environmental factors must be considered when dropping the egg.In the first trial, the principal at mind was to apply pressure and support to the egg at the same time. Parachuting the device was considered, but quickly dismissed. Environmental factors, such as wind, would most likely prevent the device from landing in the desired target zone if a parachute were used. A plastic bag was cut and used to cushion the top, bottom, and sides of the supported egg. Rubber bands were used to apply the pressure to the egg and add support to hold the egg in the middle of the Styrofoam cup. Popsicle sticks were used to hold the rubber bands in place.In the second trial, a design alteration had to take place. Since one of the goals is to have the design be lightweight with the least number of parts, removing the plastic bag seemed to be the solution. This design still had the egg in the middle of the Styrofoam cup supported by rubber bands. As long as the design landed on the top or bottom, the egg should not break.

First Trial Second Trial WITH plastic bag WITHOUT plastic bag

Resources: Microsoft Word

Engineering Concepts In Technology

Popsicle Sticks

Popsicle Sticks

Popsicle Sticks

Rubber Bands

Page 5: Paper Portfolio

EGG DROP LAB REPORTProcedure:1. Gather all necessary equipment to complete the experiment.2. First, weigh just the egg and record the weight. Next, weigh the entire device with the egg included.

Subtract the weight of the egg from the total weight and record this number on the data sheet under “Weight.”

a. The weight should be in grams.3. Record the number of materials used to build the device on the data sheet.

a. The sandwich bag around the egg is not to be counted as an item. This item is required to contain any broken pieces of the egg after the drop.

4. Go to experiment site.5. Measure the distance in inches from the height where the drop will take place to the ground.

a. Record this number, as it will be used in calculating the velocity.6. Under the drop area, begin drawing the target. There should be 3 drop zones: 2’, 4’, and 6’ diameter.

a. Use a piece of string and measure a 2 ft. piece, 4 ft. piece, and a 6 ft. piece. Use each piece of string to help assist in drawing an accurate circle.

b. Below is an example of how the target should appear:BLUE: 6ft diameterGREEN: 4ft diameterRED: 2ft diameter  NOTE:Colors used to illustrate multiple diameters, not necessary in actual experiment!

Engineering Concepts In Technology

Resources: Microsoft Word

Page 6: Paper Portfolio

EGG DROP LAB REPORT7. Have one group member drop the device from the drop height and another member use the stopwatch

to record the time it takes for the egg to drop to the ground.a. Begin the stopwatch when the device leaves the team member’s hands and stop the time when the

device hits the ground.b. Record this time (in seconds) on the data sheet under “Time of Drop.”

8. Determine what drop zone the egg landed in and record under “DZ” on the data sheet.a. Outside of the 6 ft. diameter is considered drop zone 4b. 6 ft. diameter (BLUE) is drop zone 3c. 4 ft. diameter (GREEN) is drop zone 2d. 2 ft. diameter (RED) is drop zone 1

9. After the drop zone is recorded, determine if the egg broke or not.a. Record a 1 or 0 under “EIF” on the data sheet.

i. 1 if the egg DID NOT breakii. 0 if the egg broke

10. Calculate the velocity of the egg using the formula:a. Velocity= distance divided by time.

i. NOTE: Distance from the drop height to the ground was measured in inches.ii. Convert inches to feet by dividing number of inches by 12.

b. Record velocity under “Average Velocity” on data sheet.

Resources: Microsoft Word

Engineering Concepts In Technology

Page 7: Paper Portfolio

EGG DROP LAB REPORT11.Determine the score using the following equation:

a. Score = [ 30 × (W/31) + 30 × (N/18) + 40 × (DZ/2) ] × EIF

i. W: Weight of device in gramsii. N: Number of parts usediii. DZ: Drop Zoneiv. EIF: Egg Integrity Factor (1 or 0)

b. Record score under “Score” on data sheet.i. The group with the lowest nonzero score wins.

12. Make a design alteration to achieve a better score and repeat steps 1-11.

Data:

Resources: Microsoft Word

Trial Number

Weight(Grams)

No. Parts

Time of Drop

(Seconds)

DZ EIF(1 or 0)

Average Velocity

Score

1 16.2 g 7 0.82 s 3 1 20.22 ft./s 87.352 10.1 g 6 0.91 s 2 0 18.22 ft./s 0

Engineering Concepts In Technology

Page 8: Paper Portfolio

EGG DROP LAB REPORTCalculations: If necessary, round numbers to two decimal places.Convert inches to feet with the following equation:

drop height in inches--------------------------------

12

The drop height was 199 inches. This must be converted to feet to calculate the velocity.

199 inches-----------------

12

Calculate the average velocity with the following equation:

distance--------------

Time

The average velocity for the first trial was calculated as follows:

16.58 ft.---------------

0.82 s

Resources: Microsoft Word

= 16.58 ft.

velocity =

= 20.22 ft./s

Engineering Concepts In Technology

Page 9: Paper Portfolio

EGG DROP LAB REPORTCalculate the score with the following equation:

Score = [ 30 × (W/31) + 30 × (N/18) + 40 × (DZ/2) ] × EIF

W: Weight of device in gramsN: Number of parts usedDZ: Drop ZoneEIF: Egg Integrity Factor (1 or 0)

The score for the first trial was calculated as follows:Score = [ 30 × (16.2/31) + 30 × (7/18) + 40 × (3/2) ] × 1 ≈ 87.35

Conclusion: The rubber bands provided a constant pressure and helped maintain stability to keep the egg in the centermost portion of the Styrofoam cup.By placing the plastic bag around the egg, this helped cushion the fall, preventing the egg to break. The first trial achieved a design less than 17 g and the egg did not bust. The device landed in the 6 ft. diameter circle.For the required redesign, the key is to land closer to the 2 ft. diameter circle with a lighter design. As long as the egg stays in the correct position in the centermost portion of the Styrofoam cup, the egg should not break. To keep the majority of the design the same, but obtain a better score, a lighter design was the key to success.Removing the plastic bag would achieve a lighter design, but the egg would no longer have the extra cushion. The second trial’s design was less than 10.5 g and landed in the 4 ft. diameter circle. Although the second trial achieved a lighter device with fewer parts and landed closer to the center of the target, without the extra cushion, the egg busted.Resources: Microsoft Word

Engineering Concepts In Technology

Page 10: Paper Portfolio

Problem: Use your imagination and creativity to design and build a class project. The project should be something that is a “stretch” for you and not just more of what you have already done in your academic career. This project was completely open-ended and could be anything.

Solution: For this project, I assembled and wired a steampunk lamp and charging station. This rustic black iron pipe lamp and charging station consists of an AC female plug accompanied with two USB ports for device charging. The electrical box has a two gang metal cover with the AC plug and USB port in one side, and a dimmer switch in the other. The lamp bulb resembles an old fashion Edison bulb, making the lamp look antique. The switch controls the bulb only, allowing the light to be ON/OFF and the dimmer portion controls how bright the bulb shines. Due to the dimmer switch only controlling the light bulb, the AC plug and USB ports still work when the switch is in the OFF position. The lamp is mounted on a stained piece of oak by a ¾ inch floor flange and stands upright by various black iron pipe pieces connected together.

Resources: AutoCAD 2014

Portfolio Preparation

STEAMPUNK STATION

Page 11: Paper Portfolio

STEAMPUNK STATION

Resources: AutoCAD 2014

2D Computer-Aided Design

Electrical Junction Box AutoCAD Sketch

Internal Wiring AutoCAD Sketch

Page 12: Paper Portfolio

FLOOR PLANProblem: I was given a two-dimensional drawing of a house and a floor plan with dimensions labeled and had to recreate the drawing exactly to scale.

Solution: I used the given dimensions of the two-dimensional drawing and my knowledge of the AutoCAD software to complete the project.

Resources: AutoCAD 2014

2D Computer-Aided Design

EQUAL

4'-6"

1'-10"

EQUAL

ROOF ABOVE

1'-0" TYP.

7'-0" 4'-6"

6'-6"

EQUA

LEQ

UAL

1'-10"3'-0"

13'-0

"

EQUA

LEQ

UAL

17'-0"0'-6" TYP.

A

A

A

B

C

C

B B

A A

FLOOR PLAN

DOOR & WINDOWLEGEND

5'-0" X 5'-0"

3'-0" X 3'-0"

3'-0" X 5'-0"

3'-0" X 6'-8"

Page 13: Paper Portfolio

BLOCKS-HOMEADDITIONProblem: I was given a two-dimensional drawing of a house and a floor plan with dimensions labeled and had to recreate the drawing exactly to scale. I had to incorporate multiple blocks and incorporate them into my drawing.

Solution: I used the given dimensions of the two-dimensional drawing and my knowledge of the AutoCAD software to complete the project. I added various blocks to the floor plan to add furniture for a living room and bedroom as well as blocks to create a bathroom.

Resources: AutoCAD 2014

2D Computer-Aided Design

Page 14: Paper Portfolio

DRAWING SET2D Computer-Aided Design

Resources: AutoCAD 2014

Problem: Use your previous “Blocks-Home addition” and “Duplex Receptacle” drawing and make necessary alterations to complete this drawing.

Solution: I used the given requirements and made alterations to the drawings. I changed various lineweights, added a North symbol by using the Design Center, added various hatch patterns, and utilized my knowledge of the AutoCAD software to create multiple scales and viewports.

STANDARD BRICK

ASPHALT ROOF SHINGLES

HEADER

6'-8" A.

F.F.12'-0"

8'-0" 1'-0"

2'-77 8"

8" ROOF JOIST

12" SLAB ON GRADE

6" STUDS

ASPHALT SHINGLES

1'-0" TY

P.

SEE DETAILA-A

SCALE : 3/8"=1'-0"SECTION A-A

FINISHED FLOOR

ROOF EAVE@ 7'-3" A.F.F.

@ 0'-0"

@ 12'-9" A.F.F.ROOF RIDGE

SCALE : 1/4"=1'0"FRONT ELEVATION

STAN DARD BRICK

ASPHALT ROOF SH IN GLES

HEAD

ER6'-

8" A.F

.F.12'-0

"

8'-0" 1'-0"

2'-77 8"

8" ROOF JOIST

12" SLAB ON GRADE

6" STUDS

ASPHALT SH IN GLES

1'-0"

TYP.

SEE DETAILA-A

SCALE : 3/8"=1'-0"SECTION A-A

FINISHED FLOOR

ROOF EAVE@ 7'-3" A.F.F.

@ 0'-0"

@ 12'-9" A.F.F.ROOF RIDGE

SCALE : 1/4"=1'0"FRONT ELEVATION

Page 15: Paper Portfolio

DRAWING SET2D Computer-Aided Design

Resources: AutoCAD 2014

EQUAL

7'-0"

EQUAL

4'-6"

1'-10"ROOF ABOVE

1'-0"4'-6"

EQUAL6'-6

"

1'-10"

EQUAL

3'-0"

EQUA

L

13'-0"

EQUA

L

17'-0"0'-6"

A

A

A

B

C

C

B B

A A

ELEV - FRONT

BATHROOM

MASTERBEDROOM

LOUNGEAREA

ENTRY

3'-0" X 3'-0"

3'-0" X 5'-0"

5'-0" X 5'-0"

3'-0" X 6'-8"

SCALE: 3/8"=1'-0"

STANDARD BRICK

ASPHALT ROOF SHIN GLES

HEAD

ER6'-8

" A.F.F

.12'-0"

8'-0" 1'-0"

2'-77 8"

8" ROOF JOIST

12" SLAB ON GRADE

6" STUDS

ASPHALT SHINGLES

1'-0" T

YP.

SEE DETAILA-A

SCALE : 3/8"=1'-0"

43 16"

21 2"

18"7 8" 3 4"

7 16"

3 4"

11 4"

Ø 1 4"

FLOOR PLAN

DOOR & WINDOW LEGEND

SECTION A-A

DETAIL A-ASCA LE : 1'-0"=1'-0"

FIN ISHED FLOOR

ROOF EAVE@ 7'-3" A.F.F.

@ 0'-0"

@ 12'-9" A. F.F.ROOF RIDGE

SCALE : 1/4"=1'0"FRONT ELEVATION

EQU AL

7'-0"

EQUAL

4'-6"

1'-10"ROOF ABOVE

1'-0"4'-6"

EQUAL6'-6

"

1'-10"

EQUAL

3'-0"

EQUAL

13'-0"

EQUAL

17'-0"0'-6"

A

A

A

B

C

C

B B

A A

ELEV - FRONT

BATHROOM

MASTERBEDROOM

LOUNGEAREA

ENTRY

3'-0" X 3'-0"

3'-0" X 5'-0"

5'-0" X 5'-0"

3'-0" X 6'-8"

SCALE: 3/8"=1'-0"

STANDARD BRICK

ASPHALT ROOF SHINGLES

HEADER

6'-8" A.

F.F.12'-0"

8'-0" 1'-0"

2'-77 8"

8" ROOF JOIST

12" SLAB ON GRADE

6" STUDS

ASPHALT SHINGLES

1'-0" TY

P.

SEE DETAILA-A

SCALE : 3/8"=1'-0"

43 16"

21 2"

18"7 8" 3 4"

7 16"3 4"

11 4"

Ø 1 4"

FLOOR PLAN

DOOR & WINDOW LEGEND

SECTION A-A

DETAIL A-ASCA LE : 1'-0"=1'-0"

FIN ISHED FLOOR

ROOF EAVE@ 7'-3" A.F.F.

@ 0'-0"

@ 12'-9" A.F.F.ROOF RIDGE

SCALE : 1/4"=1'0"FRONT ELEVATION

EQUAL

7'-0"

EQUAL

4'-6"

1'-10"ROOF ABOVE

1'-0"4'-6"

EQ

UAL

6'-6"

1'-10"

EQ

UAL

3'-0"

EQ

UAL

13'-0"

EQ

UAL

17'- 0"0'-6"

A

A

A

B

C

C

B B

A A

ELEV - FRON T

BATHRO OM

MASTERBEDROO M

LOUNGEAREA

ENTRY

3'-0" X 3'-0"

3'-0" X 5'-0"

5'-0" X 5'-0"

3'-0" X 6'-8"

SCALE: 3/8"=1'-0"

STAN DARD BRICK

ASPH ALT ROOF SH IN GLES

HEAD

ER

6'-8"

A.F

.F.

12'-0"

8'-0" 1'-0"

2'-

77 8

"

8" ROOF JOIST

12" SLAB O N GRAD E

6" STUDS

ASPH ALT SH INGLES

1'-0"

TYP.

SEE DETAILA-A

SCALE : 3/8"=1'-0"

43

16

"

21 2"

1 8"7 8 " 3 4"

716

"3

4"

11 4"

Ø 1 4"

FLOOR PLAN

DOOR & WINDOW LEGEND

SECTION A-A

DETAIL A-ASCA LE : 1'- 0"=1'-0"

FINISHED FLOOR

ROOF EAVE@ 7'-3" A.F.F.

@ 0'-0"

@ 12'-9" A.F.F.ROOF RIDGE

SCALE : 1/ 4"=1'0"FRONT ELEVATION

EQUAL

7'-0"

EQUAL

4'-6"

1'-10"ROOF ABOVE

1'-0"4'-6"

EQUA

L6'-6"

1'-10"

EQUA

L

3'-0"

EQUA

L

13'-0"

EQUA

L

17'-0"0'-6"

A

A

A

B

C

C

B B

A A

ELEV - FRONT

BATHROOM

MASTERBEDROOM

LOUNGEAREA

EN TRY

3'-0" X 3'-0"

3'-0" X 5'-0"

5'-0" X 5'-0"

3'-0" X 6'-8"

SCALE: 3/8"=1'-0"

STANDARD BRICK

ASPH ALT ROOF SHINGL ES

HEAD

ER6'-8

" A.F.

F.12'-0"

8'-0" 1'-0"

2'-77 8"

8" ROOF JOIST

12" SLAB ON GRADE

6" STUDS

ASPHALT SHINGLES

1'-0" T

YP.

SEE DETAILA-A

SCAL E : 3/8"=1'-0"

43 16"

21 2"

18"7 8 " 3 4"

7 16"

3 4"

11 4"

Ø1 4"

FLOOR PLAN

DOOR & WINDOW LEGEND

SECTION A-A

DETAIL A-ASCA LE : 1'-0"=1'-0"

F IN ISHED FL OOR

ROOF EAVE@ 7'-3" A.F. F.

@ 0'-0"

@ 12'-9" A.F .F.ROOF RIDGE

SCALE : 1/4"=1'0"FRONT ELEVATION

Page 16: Paper Portfolio

DUPLEX RECEPTACLEProblem: I was given a two-dimensional drawing of a duplex receptacle with dimensions labeled and had to recreate the drawing exactly to scale. Requirements included drawing objects on the appropriate layer and utilizing different viewports and scales to show the drawings details.

Solution: I used the given dimensions of the two-dimensional drawing and my knowledge of the AutoCAD software to complete the project. I utilized appropriate layers throughout the drawing and multiple viewports. The drawing is visible on two separate viewports to show the details of the drawings. The duplex receptacle at a 1’-0”=1’-0” scale and the socket at a 2’-0”=1’0” scale for better visuals.

Resources: AutoCAD 2014

2D Computer-Aided Design

Page 17: Paper Portfolio

HOME ALARM SYSTEM

Resources: Arduino, Microsoft PowerPoint

Problem: This project was completely open-ended. My lab partner, Derek, and I had to create a project that incorporated required project elements into the Arduino operating system.

Solution: Derek and I created the Home

Alarm System, which would use required project elements to sound an alarm when an intruder was detected. An ultrasonic sonar was used to detect an intruder’s movement. If movement was detected, a buzzer was used to sound an alert. Two LED lights, one red and one green, were used to inform a person if the alarm was armed (RED) or disarmed (GREEN).

Introduction to Microcontrollers

Lab Partner: Derek Hayes

This photo shows the LCD screen wired on the testing breadboard prior to being installed in the model home.The LCD screen displays the alarm state on the first line and whether or not an intruder is detected on the second line.

Page 18: Paper Portfolio

HOME ALARM SYSTEM

Resources: Arduino, Microsoft PowerPoint

Introduction to Microcontrollers

This photo shows the complete wiring required for the Home Alarm System. We completed the wiring and alarm testing on a breadboard first to easily test the alarm and troubleshoot if necessary.Once the alarm was tested and passed all tests, we then moved the system to a model home for better illustration of the alarm system.

Page 19: Paper Portfolio

HOME ALARM SYSTEMIntroduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

We mounted the push buttons on the horizontal plane isolated from the Arduino and wiring breadboard to easily press the buttons without damaging the walls or wiring inside the walls. We mounted the Arduino and wiring breadboard to the vertical outside wall as shown. The pushbuttons required a Schmitt Trigger Inverter for debouncing purposes. In addition to the SN7414N IC chip, a 4700-pF capacitor was also added. With these additions to the pushbuttons, the in-home lighting and/or the alarm state would change to the opposite state with one simple push of the button.

Labeled push buttons for easy interpretation

Page 20: Paper Portfolio

HOME ALARM SYSTEMIntroduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

The ultrasonic sensor and the LCD screen are mounted into the wall. This strategic sonar placement along with coding specifications prevented the floor, walls, and home furniture from tripping the sensor, but detected an intruder immediately after motion is detected.

LCD Screen

Servomotor

UltrasonicSensor

Page 21: Paper Portfolio

Introduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

HOME ALARM SYSTEMThe photo below shows the front view of the model home with the LED alarm state indicator lights mounted right above the door.

Red: Alarm ONGreen: Alarm OFF

The above photo is an up-close view of the LCD screen mounted into the wall. The LCD screen displays information about the system on two lines.

Line 1: Alarm State (ON/OFF)Line 2: Intruder State (Intruder/No

Intruder)

Page 22: Paper Portfolio

HOME ALARM SYSTEMIntroduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

As you can see, we have mounted 3 white LEDs classified as our in-home lighting. When the alarm is on, and an intruder is detected, the in-home lights will turn on, the buzzer will sound, and the servomotor will also begin.

The buzzer is located above the bed and the servomotor is next to the dresser.

Buzzer

Servomotor

Home

LightingHome

Lighting

Page 23: Paper Portfolio

HOME ALARM SYSTEMIntroduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

This overhead view shows allthe components in this homealarm system including the LCDscreen, ultrasonic sensor, alarm indicator lights, buzzer, home lighting fixtures, and the servomotor.

Page 24: Paper Portfolio

We ran all the wires between the two walls as you can see in this photo. This eliminated clutter on the inside of the model home and more of a home look on the outside without a bunch of wires taped everywhere.The LCD screen had 16 wires coming off the back. For the LCD screen to work correctly, the wires need to be properly connected to power and ground, as well as connected to the proper digital pins outlined in the code. To keep the wires coming off the LCD screen to the Arduino organized, we color coded the wires and utilized electrical tape to group the wires into different categories, i.e. ground, power, digital pins.

Introduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

HOME ALARM SYSTEM

Page 25: Paper Portfolio

#include "pitches.h"#include <Servo.h>#include <LiquidCrystal.h> // Load Liquid Crystal LibraryLiquidCrystal LCD(10, 12, 4, 5, 6, 7); // Create Liquid Crystal Object called LCDconst int HomePinButton = 0; // ON/OFF In-Home Lightingconst int AlarmPinButton = 0; // Arm/Disarm Light// char HomePinLed[2] = "A0"; // In-Home Lightingint HomeiPin = 2; // Home Interrupt Pinint AlarmiPin = 3; // Alarm Interrupt Pin// char RedPinLed[2] = "A1"; // Alarm ON Light// char GreenPinLed[2] = "A2"; // Alarm OFF Light int trigPin = 13; // Sensor Trip pin connected to digital pin 13int echoPin = 11; // Sensor Echo pin connected to digital pin 11int myCounter = 0; // Declare your variable myCounter and set to 0int servoControlPin = 6; // Servo control line is connected to pin 6float pingTime; // Time for ping to travel from sensor to target and return int var = 0; // Switch Case variableint sense = 0; int UpDown = 0;int BuzzCount = 0; int servoPin = 9; // Servo control on digital pin 9Servo servo; volatile int AlarmState = LOW;volatile int HomeState = LOW;

Introduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

HOME ALARM SYSTEM

ARDU

INO

CODE

Page 26: Paper Portfolio

void setup() { Serial.begin(9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT);  LCD.begin(16,2); // Tell Arduino to start your 16 column 2 row LCD LCD.setCursor(0,0); // Set LCD cursor to column 0, row 0 pinMode(A0, OUTPUT); // In-Home Lighting LED Pin digitalWrite(A0, HIGH); pinMode(HomeiPin, INPUT); // In-Home Lighting Interrupt Pin attachInterrupt(digitalPinToInterrupt(HomeiPin), home, FALLING); // Interrupt Home Pin on falling edge pinMode(A1, OUTPUT); // Alarm ON LED Pin digitalWrite(A1, HIGH); pinMode(A2, OUTPUT); // Alarm OFF LED Pin digitalWrite(A2, HIGH); pinMode(AlarmiPin, INPUT); // Alarm Interrupt Pin attachInterrupt(digitalPinToInterrupt(AlarmiPin), alarm, FALLING); // Interrupt Alarm Pin on falling edge  servo.attach(servoPin);}

Introduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

HOME ALARM SYSTEM

ARDU

INO

CODE

Page 27: Paper Portfolio

void loop() { digitalWrite(A1, AlarmState); digitalWrite(A2, !AlarmState);  digitalWrite(trigPin, LOW); // Set trigPin LOW delayMicroseconds(2000); // Let signal settle digitalWrite(trigPin, HIGH); // Set trigPin HIGH delayMicroseconds(15); // Delay in HIGH state digitalWrite(trigPin, LOW); // Ping has now been sent delayMicroseconds(10); // Delay in LOW state  pingTime = pulseIn(echoPin, HIGH); // pingTime is presented in microseconds  if(AlarmState == LOW && pingTime > 1000) // Case 1: Alarm OFF & No Intruder { var = 1; sense = 0; } if(AlarmState == HIGH && pingTime > 1000) // Case 2: Alarm ON & No Intruder { var = 2 + 2*sense; } if(AlarmState == LOW && pingTime < 1000) // Case 3: Alarm OFF & Intruder var = 3; if(AlarmState == HIGH && pingTime < 1000) // Case 4: Alarm ON & Intruder { var = 4; sense = 1; }

Introduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

HOME ALARM SYSTEM

ARDU

INO

CODE

Page 28: Paper Portfolio

switch (var) { case 1: noTone(8); // No tone on pin 8 digitalWrite(A0, HomeState); LCD.setCursor(0,0); // Set LCD cursor to column 0, row 0 LCD.print(" "); LCD.setCursor(0,0); // Set LCD cursor to column 0, row 0 LCD.print("Alarm OFF."); // LCD reads Alarm OFF on first line LCD.setCursor(0,1); // Set LCD cursor to column 0, row 1 LCD.print(" "); LCD.setCursor(0,1); // Set LCD cursor to column 0, row 1 LCD.print("No intruder."); // LCD reads No Intruder on second line delay(50); // Delay for 50 microseconds break;  case 2: LCD.setCursor(0,0); // Set LCD cursor to column 0, row 0 LCD.print(" "); LCD.setCursor(0,0); // Set LCD cursor to column 0, row 0 LCD.print("Alarm ON."); // LCD reads Alarm ON on first line LCD.setCursor(0,1); // Set LCD cursor to column 0, row 1 LCD.print(" "); LCD.setCursor(0,1); // Set LCD cursor to column 0, row 1 LCD.print("No intruder."); // LCD reads No Intruder on second line delay(50); // Delay for 50 microseconds break;

Introduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

HOME ALARM SYSTEM

ARDU

INO

CODE

Page 29: Paper Portfolio

case 3: noTone(8); // No tone on pin 8 LCD.setCursor(0,0); // Set LCD cursor column 0, row 0 LCD.print(" "); LCD.setCursor(0,0); // Set LCD cursor to column 0, row 0 LCD.print("Alarm OFF."); // LCD reads Alarm OFF on first line LCD.setCursor(0,1); // Set LCD cursor column 0, row 1 LCD.print(" "); LCD.setCursor(0,1); // Set cursor to first column of second row LCD.print("Intruder!!!"); // LCD reads Intruder on second line delay(50); // Delay for 50 microseconds break; case 4: if(UpDown == 0) { tone(8, 139); // Tone pin 8. Note 139. BuzzCount++;} else { noTone(8); // No tone on pin 8 BuzzCount--;} if(BuzzCount >= 10) UpDown = 1; if(BuzzCount <= 0) UpDown = 0;

Introduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

HOME ALARM SYSTEM

ARDU

INO

CODE

Page 30: Paper Portfolio

digitalWrite(A0, HIGH); servo.write(BuzzCount * 18);  LCD.setCursor(0,0); // Set LCD cursor to column 0, row 0 LCD.print(" "); LCD.setCursor(0,0); // Set LCD cursor column 0, row 0 LCD.print("Alarm ON."); // LCD reads Alarm ON on first line LCD.setCursor(0,1); // Set LCD cursor column 0, row 1 LCD.print(" "); LCD.setCursor(0,1); // Set cursor to column 0, row 1 LCD.print("Intruder!!!"); // LCD reads Intruder on second line delay(50); // Delay for 50 microseconds break; }}

void home() { HomeState = !HomeState; // (! signifies opposite) digitalWrite(A0, HomeState);} void alarm() { AlarmState = !AlarmState; // (! signifies opposite)}

Introduction to Microcontrollers

Resources: Arduino, Microsoft PowerPoint

HOME ALARM SYSTEM

ARDU

INO

CODE