FABRIQUER UN SONAR A ULTRASON ! [arduino]
Table of Contents
Introduction
In this tutorial, you'll learn how to create a simple ultrasonic sonar system using an Arduino Uno, an ultrasonic sensor, and a servo motor. This project is not only a great introduction to electronics and coding but also demonstrates practical applications of sonar technology.
Step 1: Gather Your Materials
Before you start, ensure you have the following components:
- Arduino Uno
- Ultrasonic Sensor
- Servo Motor
- Jumper Cables
- USB Cable for Arduino connection
You can find links for purchasing the components in the video description.
Step 2: Set Up the Arduino IDE
-
Download the Arduino IDE:
- Visit Arduino Software to download and install the IDE on your computer.
-
Install Required Libraries:
- Open the Arduino IDE and ensure that you have the necessary libraries for the ultrasonic sensor and servo motor.
Step 3: Wiring the Components
Connect the components using jumper cables as follows:
-
Ultrasonic Sensor:
- VCC to 5V on Arduino
- GND to GND on Arduino
- Trigger pin to digital pin 9 on Arduino
- Echo pin to digital pin 10 on Arduino
-
Servo Motor:
- Connect the power wire (usually red) to the 5V on Arduino
- Connect the ground wire (usually black or brown) to GND on Arduino
- Connect the control wire (usually yellow or white) to digital pin 11 on Arduino
Step 4: Upload the Arduino Code
-
Access the Code:
- Copy the code provided in the video or access it directly from Pastebin.
-
Paste the Code in the IDE:
- Open the Arduino IDE and paste the copied code into a new sketch.
-
Select the Correct COM Port:
- In the IDE, go to Tools > Port and select the COM port corresponding to your Arduino.
-
Upload the Code:
- Click the upload button (right arrow icon) to upload the code to your Arduino.
Step 5: Set Up Processing Software
-
Download Processing:
- Go to Processing Download and install it.
-
Import the Processing Code:
- Access the Processing code from Pastebin and paste it into a new Processing sketch.
-
Configure the COM Port:
- Ensure you select the correct COM port in the Processing code to match your Arduino.
-
Run the Processing Sketch:
- Execute the Processing sketch to visualize the sonar readings.
Step 6: Testing the Sonar System
-
Power Everything On:
- Connect your Arduino to your computer or a power source.
-
Observe the Output:
- Move an object within the sensor's range and watch the output in the Processing window.
- The servo motor should also move according to the detected distance.
Conclusion
Congratulations! You've successfully built a functional ultrasonic sonar system using Arduino. This project not only enhances your understanding of electronics and programming but also serves as a foundation for more advanced projects. Consider exploring additional features, such as integrating an LCD display or adding more sensors to expand your sonar system capabilities. Happy DIYing!