Sergio Rodriguez Barnuevo
The rest of the components will serve their usual basic functionality. The wifi won't be used for now, but it could allow for remote control of the door.
All the simulations were run correctly and performed in the desired way. More information about the results further down the page.
Before the setup function, some macros and variables are defined, such as the time the door will stay open, the pin numbers and other variables such as flags defining the state of hte button or the state of the door.
setup():
In the setup the initial parameters for the normal state of the door are set:
objectDetectedInterrupt():
This interruption sets a flag to true when an object is detected, that is, the sensor measures a distance. But in the end it has no functionality because the sensor is always measuring a distance. It could be used for a different type of sensor or system though.
buttonInterrupt():
This interruption is meant to work when the “emergency button is pressed”. This emergency button can be configured in different ways. For example, in one version of the code it locks the door into the current state that it's in (Automatic_Door_1) but in the other version it blocks the door closing it and leaving it closed until the button is pressed again. Here's a wuick rundown of how it works:
openDoor():
This function moves the servo to its open angle value by using the function servo.write() from the servo.h library
closeDoor():
This function moves the servo to its closed angle value by using the function servo.write() from the servo.h library
Loop():
The main loop of the microcontroller. The loop essentially calculates the distance measured by the ultrasonic sensor and checks if it's within the specified values for the door to allow the object to go through.
The results obtained after the realization of the project were, by the most part, the desired ones.
The microcontroller successfully identified whether the object was too short or tall enough and was able to turn the servo in order to open or close the door. The emergency button feature also worked as it was intended blocking the door and putting it in a standby mode until the button is pressed again. The 4×7 LED display, however, was not functional and could not be added to the system. This is because it was acquired from a third party and it was in a used state and it didn't work as it was intended initially when designing the project.
As for the hardware, the whole system was built in a primitive way, without regarding the esthetics since the purpose of the project was for the main idea to work and not build a finished product. Additionally, the LEDs which were intended to be placed by the side of the door had to be placed in the breadboard because of a lack of long wires and connectors (then again, this issue did not influence the performance of the door).
On the other hand, the method chosen to build a height selective automatic door was not ideal. There was an issue when programming the system because the sensor used is always detecting objects. In order to avoid this, a PIR sensor could've been added and therefore the calculation of the distance would only be made whenever this PIR sensor detects and object arriving in front of the door. This issue was not taken into account in the design phase of the project and the hardware necessary was not acquired in time.
Overall, the main idea of the project was accomplished and this early prototype could be modified and improved in many ways in order to be part of a real system or project.
The following videos show the functioning of the door for the code of the file AutomaticDoor2 where the emergency button blocks the door in the state it was and makes it enter the standby mode until the button is pressed again:
In conclusion, working on this Arduino automatic door project has been an incredibly rewarding experience. It has reinforced the importance of hands-on projects when it comes to learning about microprocessors like Arduino. Through practical experimentation and problem-solving, I've gained a deeper understanding of how hardware components interact and how to manipulate them using code. The automatic door project, in particular, has sparked my imagination. I can envision its integration into various systems or projects, such as a smart home setup or a security system. This project has truly showcased the versatility and potential of Arduino.
If you're passionate about microprocessors and eager to explore the endless possibilities of creative projects, hands-on experiences are an invaluable part of the learning journey.
Schematics:
Code: