Height Selective Automatic Door

Author

Sergio Rodriguez Barnuevo

Introduction

Brief presentation of the project:

  • The goal and purpose of the project is to design and build an automatic door that only allows objects/users above a certain height to go through. This could be used for security reasons or simply in order to design a selective system of access to a building, event, area…
  • The idea of this project comes from the usual automatic door that opens with movement (i.e. shopping centre or supermarket doors) but with the addition of making it restrictive in order to improve its security.
  • This type of door can have numerous applications such as theme park attractions or zoo entrances and the idea can be adapted to different type of restrictions other than height (i.e speed or weight).

General description of the project



  • Ultrasonic sensor Module HC-SR04: Used for measuring distance to objects
  • LEDs: They will represent door state (denied entry, standby, etc.)
  • 4×7 LED display: This 4 digit display will show the current object's height
  • Button: The button will allow for emergency stops of the system
  • Servomotor: It will be used to opening and closing the door

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.

Hardware Design

List of components:

  • SG90 Servomotor
  • 3 LEDs
  • 4×7 LED display
  • Ultrasonic sensor Module HC-SR04
  • Connecting wires
  • Breadboard
  • Arduino UNO WIFI R2 motherboard
  • Resistors



Tinkercad Electrical Schemes








Early prototype of the door without the electrical connections

fotopuerta2.jpg 1)
fotopuerta1.jpg 2)

Finished prototype of the door

finalautomaticdoor2.jpg 3)
finalautomaticdoor1.jpg 4)

All the simulations were run correctly and performed in the desired way. More information about the results further down the page.

Software Design

Libraries used
  • Servo.h
Sources and functions imlpemented

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:

  • Pins are set as outputs or inputs
  • The servo pin is set as the pin for the servo using the servo.attach method from servo.h library and the servo is set to its initial angle
  • Some interrupts are defined
  • Blue led is turned on as it must be on in the initial state of the door


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:

  • When the interruption is triggered, the state of the button is saved
  • We check weather the button was pressed or released, and if it was released, a timer starts counting in order to avoid debouncing
  • The state of the door is changed (if it was in standby it will go back to functioning mode and viceversa
  • The blue led is turned of (just in case) and the red led is turned on announcing that the door will enter standby state
  • When the door is on standbyMode, the red LED will start blinking and teh door


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.

  • If the door is not on stanbyMode, the blue LED is turned on (just in case it wasn't). A delay is also added to allow sometime in case the door had just open or closed.
  • Measuring of the distance is performed (distance measured is displayed on the serial monitor for debugging and distance calibrating purposes).
  • Next, if the door isn't on standbyMode AND the distance is within the specified values (known after calibration and can be adjusted as the users sees fit):
    • If the distance of the object is close enough to the sensor (the object is tall enough) the blue led is turned of, the green led is turned on and door is opened by using the openDoor() function. A delay is added so the door stays open a certain amount of time (can be adjusted). In the case the button is pressed while the door is open and the door enters standbyMode, the microcontroller will enter an infinite loop where the door will stay open until the button is pressed again.
    • If the distance of the object isn't close enough, then the door will remain closed and the red LED will be turned on. A delay is added to allow for the LED to be seen for a while (can be adjusted).
  • Finally, if the door is in standbyMode, the blinking of the red LED will go on until the button is pressed again and the door exits the standbyMode.


Algorithms and structures

Obtained results

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:

5) 6)

Conclusion

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.

Download

Bibliografie/Resurse

1) Front side of the door where the sensor, display and leds are shown
2) Back side of the door where the servo, motherboard and breadboard are shown
3) Front side of the door where the sensor, breadboard, motherboard and leds are shown
4) Back side of the door where the servo is shown
5) Functioning of the door
6) Demonstration of the emergency button
pm/prj2023/avaduva/selective_automatic_door.txt · Last modified: 2023/05/30 17:30 by srodriguez
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0