Introduction: SpacedOut - IRL Space Invaders With Drones
SpacedOut is a real life remake of the old classic Space Invaders arcade game made during the GeekCon2016 hackathon.
Using Drones equipped with light sensors and LED strips we animated the space drones and arranged them in a game formation using a specially developed autonomous flight software. On the ground the player sits on the laser gunner station which moves across rails and shoots frickin' laser beams.
You can see the video here:
and the making of:
Step 1: Safety First!
For this project we've been using 8 DJI Phantom Advanced drones, which we got from our generous sponsors. You can basically use any number and any kind of drone(s) you are comfortable flying, that can carry the additional weight of the payload (about 170 grams). If you are new to flying a drone, acquaint yourself first! Drones can be dangerous if in the wrong hands. Make sure these hands are yours! We are not responsible in any way for any kind of damage, so please take care.
Step 2: List of Components and Tools
Components, per drone:
• 1.5 meters of WS2810/11/12 Neopixel individually addressable LED
• Arduino pro mini
• NRF24L01+ Radio chip, preferably the long range version
• DC-DC Step Down converter
• Zip locks
• Optional: Arduino Pro Mini IOT Shield, just for making life a bit easier
• 26 Light dependent resistors
Components, per entire project:
• Arduino Uno
• NRF24L01+ Radio chip, preferably the long range version
• Optional: Arduino Uno IOT Shield, just for making life a bit easier
• Soldering iron
• Laser cutter (optional)
Step 3: Creating the LED and Sensor Matrix
Start by preparing the matrix board. you can either use the laser cutter file, or create your own, according to the dimensions of your drone. Try to use a lightweight material that will allow the drones to lift off; we used 5mm popplar. Be sure not to block the ultrasonic sensor's line of sight, or else landing and takeoff might be difficult or not possible at all, depending on your drone.
Next, using scissors or cutter, cut 8 strips of the addressable LEDs, each 12 pixels long. Gently peel the double-sided glue tape on their back, and attach them to the matrix board along the marking lines. Note that the strips are directional: one of the ends is marked with Data In (DI) and the other - Data Out (DO). Glue the strips at the same direction in order for the graphics to be presented the right way. Be sure not to block the round holes that we will next use as the sensors' peepholes.
Using a wire and some solder, connect the GND terminal of all strips together. I did it with one wire that ran perpendicular to the strips, from the top strip all the way to the bottom. This technique, while taking a bit of practice to master, creates the most durable and lightweight arrangement (see images). Repeat the process for the VCC of all LED strips.
Finally, connect all DO (Data Out) terminals of each of the strips to the DI (Data In) terminals of their neighboring strips. Solder 3 wires from the 3 terminals of the first strip (GND, VCC and DI) that will get connected to the onboard arduino. We used a servo wire that was easy to connect to our custom PCB, but that is entirely up to you. We will later connect the GND and VCC to the Arduino's corresponding terminals, and DI will get connected to digital pin 2.
Next, we will install the light sensors, that sense the laser hits. After some trial and error, we found that it is possible to connect several LDRs to one another in parallel, then take 2 groups of such LDRs and connect one group to the other in series. The connection point goes to an analog pin of the Arduino (we used pins A0 to A3), and the other 2 ends go to the Arduino's GND and VCC, doesn't matter which one goes where. You may share these last 2 connections with the LED matrix. See the schema for precise wiring instructions. We used strip board both for the electrical connection and physical mounting of the sensors just in from of the sensor peepholes. Make sure that the sensors do not pass the board level but instead stay just below it, so that the light coming from the LEDs will not affect the readings.
Step 4: Hooking Up the Drone
First, we would need to get the power required to operate the onboard Arduino, from the drone. You may add a battery but from our experience the additional weight, which shortens the flight time, doesn't worth it. This means that you will have to connect to the drone's power line. On our DJI Phantom, we found that the best way to do so is to insert 2 wires through the slits in the plastic enclose and solder them directly to the terminals that the battery is connected to - see photo. Needless to say (or is it) - when dealing with LIPO batteries one can never bee too careful! Accidental shortcut the + and - terminals can and probably will lead to battery ignition. Youtube is full of demonstrations, so take care!
After soldering the wires to the terminals, connect their other ends to the DC-DC step-down regulator and adjust the output voltage to 5 volts. Next, connect the output to the Arduino pro mini's GND and VCC terminals, bypassing the tiny onboard voltage regulator that will not be able to take the voltage drop at the current drawn, anyway. Connect and activate the battery, making sure the Arduino gets powered on.
This is a good time to download all Arduino code (located here) and upload the TargetIdWriter Sketch to the Arduino. This sketch is used to set the ID of the target (i.e. drone) and should be executed just once. Prior to uploading the code to the Arduino, edit the code and change the DRONE_ID to a number starting from 0, incrementing by one for each additional drone. Next, upload the TargetController sketch to the Arduino. Upon connecting the led matrix to pin 2, GND and VCC you should be able to see the iconic image of the alien appear. Connect the LDRs to the Arduino as per the diagram to analog pins A0 to A3. If you want to make sure you've hooked up the sensors correctly, upload the SensorTest sketch and open either a Serial Monitor or, my personal favorite, a Serial Plotter. Make sure that as long as the sensors are in place and the light level is stable, the readings are more or less the same. Next, aim a torchlight or a laser at the sensor board and make sure that all sensors are connected, i.e. when targeting them, one of the readings change.
Connect the Arduino to the NRF24L01+ radio chip according to the diagram. We have developed a PCB onto which the chip can neatly be inserted and that contains both 3.3 voltage converter as well as other recommended peripherals such as capacitors, etc. The same board can also host the ESP8266 chip, which, although not used in this project, is a great way to connect an Arduino to the internet. If you want to get the PCB with all necessary components, see here.
Finally, attach the sensor plates to the bottom of the drone and secure using zip locks. Next, secure the Arduino, the NRF chip and the DC-DC step down converter to the drone legs or to the top of the sensor board using either zip locks or strong double sided tape (needed for isolation in case of attaching these components to the drone).
Step 5: Ground Control (to Major Drone)
Next we will connect the ground control - a computer to which another Arduino is connected, that configures and calibrates the targets, and gives audio notifications of laser hits.
Start by connecting an Arduino Uno to an NRF24L01+ chip, that will communicate with the airborne Arduino(s). The connection diagram is the same as for the Arduino Pro Mini in the previous stage, but this time the Arduino will be connected to the computer. Again, we used our Arduino Uno IOT Shield, see here for details.
Next, Upload the TargetDispatcher sketch from the source files onto the Arduino Uno and keep it connected to your computer.
Download and install Processing version 3 from the official Processing site. Now download the processing code that communicates with the airborne targets and open the sketch in the Processing IDE. Same as for the Arduino sketches, you will first need to set the sketchbook location (under Preferences) to point to the root directory of the extracted zip file. Close and re-launch Processing, then open the SpaceInvadersSounder and run with Ctrl+R. The game is controlled by pressing the number of the target (from 0 to 8), then pressing one of the following keys:
'r': respawns the active alien, in case it was dead
'c': calibrates the active alien, needed before starting to shoot it
'i': initialize the active alien, preparing it for the game
'q': identifying the active alien, making the matrix show its number
'd': killing the active alien
'z': testing the shot sound (or faking a hit)
Step 6: Fire the Laser!
Finally: Game Play!
Grab a laser, a drone and a friend and go somewhere open. Launch the drone and fire up the Processing control app. When the drone reaches a few meters height, initialize it and then calibrate. The color of the alien displayed on the LED matrix should now change and it should start animating. Now, take shifts: one person shoots the drone while the other(s) try to escape...
During the Geekcon hackathon we have built a laser cannon, but have decided to remove it from the build for brevity and for increasing the chances someone will actually try to repeat our endeavor.
Basically, any sort of laser will do as long as the shooter limits the duration and frequency of the laser bursts, since, you know, that's how laser guns roll, needing to recharge between shots and what not. So, you can either build a laser gun that does that, or apply an honor system dictating X shots per minute or limiting the duration of the shots, you decide.
In case you do have the time to replicate the laser gun, you can use the LaserCannon sketch found in the Arduino code zip file, connecting the laser diode via mosfet to Arduino pin 8, a fire button to pin 4 and/or 5 and vibration motor (again, via mosfet - see this article on how to connect a mosfet to Arduino) to pins 2 and/or 3. Also in the code are 2 strip of individually addressable led strips, connected to pins 6 and/or 7 that light up upon triggering the shot. Feel free to more LEDs or anything else to make the laser gun more, well, laser gunnish.
This project could not have been created without the contribution of all its members, listed here alphabetically:
- ForReal Team - An interactive experience design studio (Zvika Markfeld, Ofer Zvik & Saron Paz)
- Studio TinMan (Ronen Wasserman)
- VHhive - A start up that is developing a software that controls drone fleets ( Yariv Geller & Tomer Daniel)
- Avi Ostfeld - A tech entrepreneur and maker enthusiast
- Adam Bar-Niv
- Elad Segal
- Rotem Stahl
- Ran Nachmany
- Yiftach Beer
- Uri Harduf
Photo credit: Yariv Geller, Saron Paz, Zvika Markfeld
And for the front page photo, special thanks go to Tal Duek, the Geekcon photographer who is not only an admirable professional but also a great dude who visited us numerous times while helping us with the photos, always with a smile and good advice. Tal, you rock!
Live long and prosper!