-
Notifications
You must be signed in to change notification settings - Fork 0
System Setup
This section provides step-by-step guidance for assembling the hardware components of the Auto-Aiming System and setting up the necessary software. Follow these instructions to ensure proper system configuration and functionality.
The project requires the following components:
- Raspberry Pi 4: Main processing unit for image acquisition and target segmentation.
- Raspberry Pi Camera V2: High-definition camera for real-time video capture.
- ESP32-WROOM: Microcontroller responsible for PID control and servo actuation.
- Pan-Tilt Mechanism: A 3D-printed structure designed to mount and control the Raspberry Pi Camera.
- 9G Servo Motors (x2): Control pan (Z-axis) and tilt (X-axis) movements.
- I2C Interface: Communication bridge between Raspberry Pi and ESP32.
- Additional items:
- Breadboard and jumper wires
- Power supply for Raspberry Pi and ESP32
- Screwdrivers and assembly tools
- OpenCV 2 (for C++): For image processing.
- GStreamer: For the video streaming pipeline between the Raspberry Pi and the Raspberry Pi Camera V2.
We used the Servo Pan Tilt - Raspberry Pi Camera model available on Thingiverse. This model is licensed under Creative Commons - Attribution - Share Alike (CC BY-SA).
- Download the STL files from Thingiverse.
- Use a standard 3D printer to print the components:
- Recommended material: PLA or ABS.
- Layer height: 0.2 mm.
- Infill: 20% for a balance between strength and print time.
-
Attach the Servos:
- Fix the first servo to the base to control the rotation along the Z-axis (pan).
- Mount the second servo to the tilt arm to control the X-axis rotation.
-
Install the Camera:
- Secure the Raspberry Pi Camera V2 to the designated slot on the tilt arm.
- Ensure proper alignment for stable image capture.
Pin (Raspberry Pi) | Pin (ESP32) |
---|---|
GPIO 2 (SDA) | GPIO 21 |
GPIO 3 (SCL) | GPIO 22 |
GND | GND |
- Connect the Raspberry Pi Camera V2 to the CSI port on the Raspberry Pi.
- Update the system:
sudo apt update && sudo apt upgrade
- Install OpenCV development libraries:
sudo apt install libopencv-dev
- Test OpenCV with a sample C++ program:
Compile the program using:
#include <opencv2/opencv.hpp> #include <iostream>
int main() { cv::Mat img = cv::imread("test_image.jpg"); if (img.empty()) { std::cout << "Image not found!" << std::endl; return -1; } cv::imshow("Test Image", img); cv::waitKey(0); return 0; }
g++ -o test_opencv test_opencv.cpp `pkg-config --cflags --libs opencv4`
- Install GStreamer and related plugins:
sudo apt install gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly
- Test the pipeline with the Raspberry Pi Camera:
libcamera-vid --inline --width 640 --height 480 --timeout 0 -o - | gst-launch-1.0 fdsrc ! decodebin ! videoconvert ! appsink
- Use a reliable 5V, 2.5A power supply for the Raspberry Pi.
- Power the ESP32 using either:
- A 5V USB connection.
- The 5V and GND pins on the ESP32 board.
- Secure all components to ensure stability.
- Verify wiring connections.
- Power on the system and manually test the pan-tilt mechanism by sending test signals to the servos.
With the hardware and software setup complete, proceed to the Image Processing section for details on the image processing pipeline.
Se precisar de mais algum ajuste ou sugestão, é só avisar! 😊