For my ENGR-199 class, I was tasked with creating a circuit that would take a user-detected presence, detected through an ultra-sonic sensor, and cause a servo to turn 180 degrees, which would in theory be attached to a door opening system, causing a door to open completely. This effectively creates an automatic door-opening system, which could be utilized in real-world applications.
To give a brief background on how the components involved in the circuit work, an ultrasonic sensor sends a high-frequency sound wave directly in front of its location on a clock pulse (effectively it receives a signal where it is told to send that sound wave off into open space), then it sits and waits to detect the sound wave bouncing back to it. The amount of time that passes between the ultrasonic sensor sending and receiving the sound wave is recorded through its pin labeled echoPin, which can be used to determine distance from the formula of distance = speed * time (speed of sound is a constant, so you can use the echoPin returned time value multiplied by the speed of sound to give you distance).
The servo motor in the circuit works by taking a signal input of a certain number of degrees (in the case of this assignment, it’s either 180 when the ultrasonic sensor detects a distance of less than a certain value, or it’s 0), and moving to that amount from it’s resting state (default is 0). The servo can detect at which position it is currently at through internal components (a whole bundle full of complex things, this is just a brief background so I will just say it possesses the capability to detect where it is at in relation to its rest state) and will actively resist changing from that state unless told otherwise digitally.
An example of my physical Arduino and circuit setup working to create the expected output can be accessed by the link below:
Recent Comments