Shooting red balloons with a LEGO cannon automatically via camera analysis. Beware if you wear a red shirt!
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Author: Marvin Baral (

A project for shooting airballons with a modified LEGO Cannon automatically by the use of image processing. Everything is controlled by a RaspberryPi. The Camera is the 160° 5MP RaspberryPi Camera. If you want to boost performance you can run the Qt-program on your laptop and connect an Arduino and a USB Webcam to it. The camera can be any camera available on your PC. Red airballons can succesfully be hit and destroyed with the LEGO cannon IF they hold still. The flightpath calculation uses physical formulars and trigonometry and relies on the given size of the balloon (23 cm). To configure it you have to edit the constants defined in config.cpp and recompile. If you want to use your Laptop/PC with Arduino, change HARDWARE_VERSION to V1_1.

I made this project for my oral A level in computer technology. Therefore I am able to offer you a wonderfully colored presentation (in German):


DIY (Do It Yourself)

how to build:



  • l - lock - locks the servos, the turret will neither move nor shoot
  • c - clearance - clearance to shoot
  • m - manual mode - control the turret with keys and shoot with enter
  • a - let the program automatically detect and shoot at a airballoon (red)
  • r - reset connection to Arduino, resetting servo positions


Current Status:

Works ok, but not perfect. ~70% hit rate, best hit quote in horizontal level.


Hardware Variants:

1. PC makes the big ComputerVision-Processing, Arduino controls Servos, USB Webcam


2. RaspberryPi + RaspberryPi 160° Camera, everything done on RaspberryPi