Automated Laser Tracking and Balloon Popping System
by thomas9363 in Circuits > Raspberry Pi
739 Views, 2 Favorites, 0 Comments
Automated Laser Tracking and Balloon Popping System
This project draws inspiration from the 2023 incident involving the impractical use of a $400k Sidewinder missile to shoot down a non-spy balloon. In response to the need for a more cost-effective solution, I propose the development of an innovative system utilizing computer vision technology. The primary objective of this project is to create a cost-effective alternative for identifying and targeting circular balloons using a laser system. The project utilizes a Raspberry Pi 4 with 4 GB of RAM as the central computing unit. This hardware is responsible for real-time tracking and targeting of balloons, ensuring a cost-effective yet efficient solution. A laser system is integrated for precise targeting and shooting down of identified balloons.
Supplies
Raspberry Pi 4 with 4GB of memory
A Pi camera or a web cam
A laser unit (I am using a 500mw blue laser from my engraver)
A pan-tilt mechanism (I am using MG665 servos)
3s lipo battery to power laser
5v battery pack to power servos
5v power supply to power Pi
A i2c servo drive (PCA9685 or UGEEK Stepper Motor Hat)
Detecting Balloons
Artificial intelligence can be used for real-time detection to identify objects, including balloons. However, the Raspberry Pi may not have the same level of computational power as high-end desktops or cloud servers. Therefore, instead of using an AI model, I use a function, namely cv2.HoughCircles, in OpenCV, to detect circles:
cv2.HoughCircles(image, method, dp, minDist, param1, param2, minRadius, maxRadius)
The cv2.HoughCircles function uses a variant of the Hough Transform method. To achieve reliable circle detection with cv2.HoughCircles, it's important to fine-tune the parameters and preprocess the image appropriately. Experimentation and adjustment of parameters may be necessary to obtain good results. As shown above, a slight change in parameters may result in a different detection result.
Wiring
As shown above, the wiring is straightforward. Although a 500mW laser is not powerful, it can still cause a burning smell and damage eyesight. Therefore, I added a blue LED to test my program before connecting power to the laser. In addition, you need power supplies for the Pi and PCA9685. The camera and the laser are coaxially set on top of the pan-tilt mechanism.
Python Program
To facilitate detection, I am using the trackbar function in OpenCV to make adjustments much easier, as shown above for adjusting parameters. After the balloons are identified, the tracking and firing functions can be activated. The program automatically sorts the balloons based on their diameters, singling out the largest balloon in the current view and drawing a red circle around it. Using the pan and tilt mechanism, the camera and laser are moved until the largest balloon is approximately at the center of the frame. The target area is set at 5% of the frame width. After the balloon stays in the target area for a period of time, the laser is automatically activated, and a laser beam is fired. The loop continues to find the next largest one, draw a red circle, and pop it until there are no balloons left in sight. You can download the program from my GitHub repository.
Conclusions
As shown in the video, the system works well. There are numerous applications, such as scaring away unwanted intruders like mice or even cockroaches. Having said that, one needs to exercise caution when using lasers, including following safety protocols, complying with local regulations regarding laser usage, and performing rigorous testing and calibration.