Leap Motion Laser Tanks!


The goal of this project was to create a set of robotic tanks to do battle where the operators got a more realistic feel for controlling the vehicles using the Leap Motion controller.  I wanted to create the robot tanks inexpensively, so people could replicate the project as easily as possible. leap motion laser tanks

The tank body is made out of generic Lego bricks and plates.   The power source is a simple block of 4 AA rechargeable batteries.   The controller for the tank is an Arduino Uno R3.   “Propulsion” is two simple DC motors with wheels in the back with a single caster in the front using a single L293D integrated circuit.   The “weaponry” is a single IR LED light and the “armor” is a set of IR sensors which detect hits from the opposing tanks IR LED.   The “heads up display” is a single multi-colored LED telling you of any actions occurring on the tank including your armor status.   Finally the “control” of the tank is handled wireless-ly via a Raspberry Pi 2 running NodeJS connected via a RF24 wireless module which each tank also is equipped with.

Using the operators hands, the Leap Motion controls the tank using the Leap Motion Javascript SDK.   Using the SDK to detect hand motion, javascript communicates with the NodeJS server on the Raspberry PI 2, which in turn communicates with the tank via the RF24 module.  Both hands forward, the tank moves forward.  Both hands back, the tank moves backwards.   Left hand forward, right hand backward, the tank turns right.  Right hand forward, left hand backward, the tank turns left.  Both hands in the “nuetral” position will stop the tank.   One hand forward (left or right) while dropping the other hand will “fire” the tank’s weapon.

Project Setup Steps:

1) Assemble tanks and wire them using the schematics below. Download the needed Arduino libraries (see README in github repository), Compile, and Upload the arduino sketch for tank1 to one tank, and tank2 to the other tank.

2) Wire the RF24 transceiver to the Raspberry Pi. Install Raspbian OS and node JS on the Pi.

3) Download, Configure, and Build (see README in github repository) the RF24 library on the Pi.

4) Download the NodeJS server software from the github site, configure, and start up the App Server/Web server (see README in github repository).

5) Install the Leap Motion and drivers onto your computer. Open a browser and load the URL to the Raspberry Pi Rest/Web server to load the web page (see README in github repository) to control tank one or tank two.

6) Click the calibrate button and hold your hands over the leap motion so it detects two hands and knows your neutral position. Once calibration is complete you can control the tank with your hands.

Quick note on the tank chassis:

The body of the tanks is assembled from simple legos that were “gorilla glued” to parts (motors, breadboards, etc) of the tank to help hold it together.   Here is a slide show to show how this was done.

A quick note about Infrared LEDs:

Infrared remote controls are very functional when you want to sit on the couch, or the floor, or the chair and be able to change the channel on your TV from anywhere.  Infrared LEDs are built to have the beam of light go in as many directions as possible to improve coverage.   But, if you want to control the beam of the LED to be smaller to make it harder to hit the remote sensor (like in a game of tank battle) is a little more difficult.   In my reading I found out that by using a very simple magnifying glass lens at the end of a tube, you can focus the Infrared beam.   Here is a diagram showing what I am talking about:

schematic leap motion laser tanks

I ended up purchasing a very inexpensive pocket magnifying glass at a drug store, taking the lens out of that and building a tube around it and having the Infrared LED at the other end of the tube, and this worked perfectly for narrowing the beam of the IR LED to be more precise.

For more detail: Leap Motion Laser Tanks!

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top