top of page

Week #15 - 05/06 - 05/13

  • Nicolo Agostini
  • May 8, 2024
  • 2 min read

Updated: May 20, 2024

Nick:

The initial Python program of the SDD was created to accomplish the following tasks in sequence:

  1. Open the roll up door

  2. Wait 5 seconds

  3. Close the roll up door


The code was tested using LEDs to visually demonstrate the output of the microcontroller.


The green LED is connected to PIN17 and it represents the motor rotating forward, while PIN27 is connected to the blue LED and represents the motor rotating backwards.


 This same code will be tested using the motor driver later next week. In that case, the pins that are now connected to the LEDs will be connected to the controller inputs of the motor driver. We expect the output of the driver to provide 3.5V DC during the opening phase, and -3.5V DC during the closing phase.


Code:

from gpiozero import Motor
from time import sleep

doormotor = Motor (17,27) #assign pins 17 and 27 for forward and backward rotation

def rollup(): #this function rolls up the door
    doormotor.forward()
    sleep(2)
    doormotor.stop()
    
def rolldown(): #this function rolls down the door
    doormotor.backward()
    sleep(2)
    doormotor.stop()

def opensequence():
    rollup()
    sleep(5)
    rolldown()

Ryan:

Preliminary Python programming for the image detection functionality was began. The program below is running on the Spyder IDE on my laptop, and built in webcam is being used. An existing Github project was used as a reference to write the code shown below [8].


 Code:


import cv2

 

# importing the cascade file into the IDE

cascade_file = cv2.CascadeClassifier(r'C:\Users\rms12\Desktop\Senior Design Proposal\Haar Training\cascade2xml\myfacedetector.xml')

 

# creating a function to detect the dogs face

def dog_detection(img):

    # converting the image to greyscale

    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

   

    # refencing the cascade file to detect images with similar features

    dog_face = cascade_file.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5, minSize=(50, 50))

   

    # create a bounding box around the dog in the image

    for (x, y, w, h) in dog_face:

        cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 5)

       

    return img, len(dog_face)

 

# open the computer webcam and capture video

cap = cv2.VideoCapture(0)

 

while True:

    #allow openCV to read the frame and return a true or false reading

    ret, frame = cap.read()

 

    # run dog detection function for the frame

    frame_with_dogs, num_dogs = dog_detection(frame)

   

    # display the camera feed on the computer screen

    cv2.imshow('Dog Detection Test', frame_with_dogs)

   

    # function to close the camera when the q button is pressed

    key = cv2.waitKey(1) & 0xFF

    if key == ord('q'):

        break

 

#close the video capture window and release the function

cap.release()

cv2.destroyAllWindows()



The code begins by loading in the Haar Cascade classifier into the IDE. A function is created that will be run continuously. The function converts the image feed into grey scale and uses the XML file to look for similar pixels that match the known images of dogs that it had been pre trained to identify. A blue bounding box is then drawn around the known dog image. The code ends with a simple function to close the camera feed when the button q is pressed. An image of the working camera feed with the bounding box is shown below.





1596494170937.jfif

Nicolo is a 26-years-old student at Valencia College, pursuing a B.S. in Electrical and Computer Engineering Technology. Nicolo is currently an intern at a MEP engineering firm in Orlando, FL, working on a variety of projects including the local theme parks and rocket launch sites. When not in class, Nicolo enjoys working on DIY electrical projects, outdoors activities, and visiting the theme parks. 

image.png

Ryan is a 28-year-old Electrical and Computer Engineering Technology student at Valencia College. When not in class, he enjoys working on DIY projects, repairing cars, and cooking. Ryan recently began a Systems Engineering Internship at Walt Disney Imagineering for the Spring 2024 semester. After graduation, he hopes to continue his engineering career at Walt Disney Imagineering.

bottom of page