ME106 HW 5

docx

School

San Jose State University *

*We aren’t endorsed by this school

Course

106

Subject

Electrical Engineering

Date

Apr 3, 2024

Type

docx

Pages

6

Uploaded by KidSalmon4208

Report
ME-EE 106 Fundamentals of Mechatronics Name : Praxedo P. Gacrama III Date: 3/11/2024 SID: 015914054 Intro To Mechatronics Summary What was learned in the assignment: In this assignment, several key concepts were covered. Firstly, we explored the specifications of the 2N2222 transistor to determine its suitability for driving a QED233 LED at 80mA, considering factors such as maximum collector emitter voltage and maximum collector current. Secondly, we designed an interface for controlling a solenoid valve for a cooling system using a microcontroller, understanding the components involved and their connections. Finally, we developed a program to run on a Raspberry Pi Pico that controlled the solenoid valve based on button presses, implementing a cycle of energizing and de- energizing the solenoid and returning to a waiting state upon button press. Overall, this assignment provided hands-on experience in understanding component specifications, designing interfaces, and programming microcontrollers for practical applications in mechatronics. Enter file name here Use dropdown here for date Page 1 of 6
ME-EE 106 Fundamentals of Mechatronics Problem 1: (10 pts) Search online for the datasheet for a 2N2222 (or P2N2222) transistor. Could this transistor be used to drive a QED233 LED at 80 mA? Justify your answer. Solution (enter and describe below): Based on the data for 2N2222, it shows that the transistor can be used to drive a QED233 LED at 80mA because the 2N2222 transistor can withstand a maximum collector emitter voltage of 40 V and maximum collector current of 800 mA, while the QED233 LED run at a low forward voltage of 1.6 V. The transistor should be able to drive LEDs at 80 mA if the voltage across the LED is lower than the transistor’s maximum collector emitter voltage of 40 V. Enter file name here Use dropdown here for date Page 2 of 6
ME-EE 106 Fundamentals of Mechatronics Problem 2: (40 pts) You landed an internship at a local company, because you listed on your resume that you have experience in mechatronics. Your first assignment is to come up with an interface that will allow a microcontroller to control a solenoid valve for a cooling system. The valve you have been given is like this one: Solution (enter and describe below): Enter file name here Use dropdown here for date Page 3 of 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
ME-EE 106 Fundamentals of Mechatronics Problem 3: (40 pts) For the solenoid valve, write a program to run on the Pico that will wait for a button press from the Pico base, and will continuously run a cycle of: a) energize (turn on) the solenoid for 20 minutes b) de-energize (turn off) the solenoid for 10 minutes If the button is pressed again, the solenoid de-energizes, and the system returns to a waiting state. Make sure that your code is well-commented. Include your code files as .py files in addition to your homework submission to Canvas. Solution (enter and describe below): Code: import machine import utime # Define pin numbers for button and solenoid BUTTON_PIN = 20 # GP20 SOLENOID_PIN = 21 # GP21 # Set button pin as input with pull-up resistor button = machine.Pin(BUTTON_PIN, machine.Pin.IN, machine.Pin.PULL_UP) # Set solenoid pin as output solenoid = machine.Pin(SOLENOID_PIN, machine.Pin.OUT) # Function to energize the solenoid for 20 minutes def energize_solenoid(): solenoid.on() # Turn on solenoid print("Solenoid energized") # Function to de-energize the solenoid for 10 minutes def deenergize_solenoid(): solenoid.off() # Turn off solenoid print("Solenoid de-energized") Enter file name here Use dropdown here for date Page 4 of 6
ME-EE 106 Fundamentals of Mechatronics # Main function to control solenoid based on button press def control_solenoid(): while True: # Wait for button press while button.value(): # Wait for button press pass # Button pressed, toggle solenoid state if solenoid.value(): # If solenoid is currently on deenergize_solenoid() # Wait for button release before checking for press again while not button.value(): pass else: energize_solenoid() # Wait for 20 minutes utime.sleep(20 * 60) # De-energize solenoid after 20 minutes deenergize_solenoid() # Wait for 10 minutes utime.sleep(10 * 60) # Run the control function control_solenoid() Enter file name here Use dropdown here for date Page 5 of 6
ME-EE 106 Fundamentals of Mechatronics [Copy the above two lines for the rest of your submission] Enter file name here Use dropdown here for date Page 6 of 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help