Skip to content

MANE 3351 - Manufacturing Engineering Analysis

Homework One Assignment

Assigned: September 16, 2024

Due: September 23, 2024 before 11:59 pm


Comments

It is probably easiest to print this assignment out. Mark up your printout. Then scan and upload to Homework 1 Drop Box.


Question 1. Resistor

What is the value of the resistor and it's tolerance shown below (the color bands left to right are yellow, violet, brown, silver)?

resistor

Question 2. Complete the Circuit

A Raspberry Pi is being used in a project that contains a motion detector sensor (passive infrared -pir) that triggers a buzzer. The code for this project is shown below.

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)

GPIO.setup(23, GPIO.IN) #PIR
GPIO.setup(24, GPIO.OUT) #BUzzer

try:
    time.sleep(2) # to stabilize sensor
    while True:
        if GPIO.input(23):
            GPIO.output(24, True)
            time.sleep(0.5) #Buzzer turns on for 0.5 sec
            GPIO.output(24, False)
            print("Motion Detected...")
            time.sleep(5) #to avoid multiple detection
        time.sleep(0.1) #loop delay, should be less than detection delay

except:
    GPIO.cleanup()

Complete the wiring of the circuit given below so that the project will work. The missing connections are the red wire on the buzzer and the yellow wire on the infrared sensor

breadboard

Question 3. Complete the Code

An Arduino project is being used to simulate a traffic light. The schematic is shown below. Notice that the power is provided by the digital (pwm) pins.

Traffic Light Breadboard

Correct the code shown below so that the project will work.

// variables
int GREEN = 
int YELLOW = 
int RED = 
int DELAY_GREEN = 5000;
int DELAY_YELLOW = 2000;
int DELAY_RED = 5000;


// basic functions
void setup()
{
  pinMode(GREEN, OUTPUT);
  pinMode(YELLOW, OUTPUT);
  pinMode(RED, OUTPUT);
}

void loop()
{
  green_light();
  delay(DELAY_GREEN);
  yellow_light();
  delay(DELAY_YELLOW);
  red_light();
  delay(DELAY_RED);
}

void green_light()
{
  digitalWrite(GREEN, HIGH);
  digitalWrite(YELLOW, LOW);
  digitalWrite(RED, LOW);
}

void yellow_light()
{
  digitalWrite(GREEN, LOW);
  digitalWrite(YELLOW, HIGH);
  digitalWrite(RED, LOW);
}

void red_light()
{
  digitalWrite(GREEN, LOW);
  digitalWrite(YELLOW, LOW);
  digitalWrite(RED, HIGH);
}