Dijamin Bisa | Membuat Kotak Sampah Otomatis

M. Abidzar Channel
26 Jul 202013:48

Summary

TLDRIn this tutorial, Muhammad Abidzar demonstrates how to build an automatic trash bin that opens and closes based on proximity. Using an Arduino Nano, an ultrasonic sensor, and a micro servo motor, the system detects nearby objects and triggers the lid to open for a set duration before closing. The step-by-step guide includes connecting components like the servo and sensor to the Arduino, programming the device, and testing the functionality. This project is an excellent way to learn about automation and sensor integration with Arduino, while also creating a fun and practical gadget for everyday use.

Takeaways

  • 😀 The project demonstrates how to create an automatic trash can that opens and closes based on proximity using an Arduino Nano, ultrasonic sensor, and servo motor.
  • 😀 The primary components used for the project are the Arduino Nano, HC-SR04 ultrasonic sensor, SG90 micro servo motor, and jumper wires.
  • 😀 The ultrasonic sensor detects the proximity of an object and triggers the servo motor to open and close the trash can lid accordingly.
  • 😀 The servo motor is connected to the Arduino Nano, and its movement is controlled by the programming code to open (10°) and close (120°) the lid.
  • 😀 Wiring is crucial in the project, with proper connections between the ultrasonic sensor and Arduino Nano, as well as between the servo motor and Arduino.
  • 😀 The code includes libraries for controlling the servo and ultrasonic sensor, with settings to define pin assignments and control the servo’s position based on sensor readings.
  • 😀 The maximum detection range for the ultrasonic sensor is set to 70 cm, and when an object enters this range, the servo motor commands the lid to open for 2 seconds.
  • 😀 After the lid opens, the servo motor closes it after a delay of 1.5 seconds, ensuring the trash can is closed after use.
  • 😀 The project was successfully tested, with the trash can opening and closing automatically when approached by the user.
  • 😀 The project also demonstrates the flexibility of the setup, with the ability to use a power bank as the power source and copper wire to connect the servo motor to the trash can lid.

Q & A

  • What is the purpose of the ultrasonic sensor in this project?

    -The ultrasonic sensor detects the presence of an object (such as a person approaching the trash can) by measuring the distance. If the object is within a certain range, the sensor triggers the servo motor to open the lid of the trash can.

  • Why is an Arduino Nano used in this project?

    -The Arduino Nano is used because it is small, compact, and ideal for projects with limited space. It allows for easy connection and control of the components in the automatic trash can system.

  • What is the role of the micro servo motor in the project?

    -The micro servo motor controls the opening and closing of the trash can lid. It rotates to a specified angle to open the lid when the sensor detects a nearby object and closes the lid after a set delay.

  • What is the significance of the 70 cm range in the code?

    -The 70 cm range is the maximum distance at which the ultrasonic sensor will detect an object. If the object is within this range, the servo motor will trigger to open the trash can lid.

  • How is the servo motor controlled in the code?

    -The servo motor is controlled using the 'Servo' library, where specific angles are set to control its rotation. In this project, the lid opens to 10 degrees and closes to 120 degrees, with corresponding delays for each action.

  • Why is there a delay after the lid opens and closes?

    -The delays ensure that the trash can lid remains open for a few seconds (2 seconds) and then closed for 1.5 seconds. These time intervals allow the user to dispose of trash before the lid closes.

  • What components are required to assemble the automatic trash can?

    -The required components include an Arduino Nano, an ultrasonic sensor (HC-SR04), a micro servo motor (SG90), jumper wires, a breadboard, and copper wire to connect the servo to the lid.

  • What power source is used to power the components?

    -The project is powered using a power bank with a 18650 battery, which provides enough voltage and current to operate the Arduino, ultrasonic sensor, and servo motor.

  • How does the ultrasonic sensor communicate with the Arduino?

    -The ultrasonic sensor communicates with the Arduino through two digital pins: the Trigger pin (which sends a pulse) and the Echo pin (which receives the reflected pulse). The Arduino calculates the distance based on the time it takes for the pulse to return.

  • Can the code be modified to adjust the opening and closing times of the lid?

    -Yes, the code can be modified by changing the delay values. For example, adjusting the 'delay(2000)' in the code will change how long the lid stays open, and modifying 'delay(1500)' will change how long the lid stays closed.

Outlines

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级

Mindmap

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级

Keywords

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级

Highlights

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级

Transcripts

plate

此内容仅限付费用户访问。 请升级后访问。

立即升级
Rate This

5.0 / 5 (0 votes)

相关标签
ArduinoSmart DevicesDIY ProjectsAutomationTech TutorialServo MotorUltrasonic SensorTrash CanArduino NanoTech InnovationElectronics
您是否需要英文摘要?