Star-Wars X-Wing 2

by vishalapr in Circuits > LEDs

6608 Views, 14 Favorites, 0 Comments

Star-Wars X-Wing 2

Star-Wars-X-Wing-2 copy copy.jpg
DSCN1898.JPG
DSCN1894.JPG
Star-Wars-X-Wing-2 copy.jpg
DSCN1901.JPG
DSCN1902.JPG
DSCN1900.JPG
DSCN1899.JPG
DSCN1897.JPG
DSCN1950.JPG
DSCN1952.JPG
DSCN1847.JPG
DSCN1829.JPG
DSCN1826.JPG
DSCN1832.JPG
DSCN1817.JPG
DSCN1955.JPG
DSCN1723.JPG
DSCN1830.JPG
DSCN1724.JPG
DSCN1949.JPG
DSCN1725.JPG
DSCN1726.JPG
DSCN1727.JPG
DSCN1728.JPG
DSCN1729.JPG
DSCN1730.JPG
DSCN1731.JPG
DSCN1732.JPG
DSCN1733.JPG
DSCN1734.JPG
DSCN1735.JPG
DSCN1736.JPG
DSCN1737.JPG
DSCN1739.JPG
DSCN1797.JPG
DSCN1798.JPG
DSCN1799.JPG
DSCN1800.JPG
DSCN1801.JPG
DSCN1802.JPG
DSCN1819.JPG
DSCN1820.JPG
DSCN1821.JPG
DSCN1822.JPG
DSCN1824.JPG
DSCN1825.JPG
DSCN1826.JPG
DSCN1827.JPG
DSCN1828.JPG
DSCN1829.JPG
DSCN1832.JPG
DSCN1833.JPG
DSCN1834.JPG
DSCN1835.JPG
DSCN1836.JPG
DSCN1837.JPG
DSCN1838.JPG
DSCN1839.JPG
DSCN1841.JPG
DSCN1842.JPG
DSCN1844.JPG
DSCN1846.JPG
DSCN1847.JPG
DSCN1803.JPG
DSCN1804.JPG
DSCN1805.JPG
DSCN1806.JPG
DSCN1953.JPG
DSCN1807.JPG
DSCN1808.JPG
DSCN1809.JPG
DSCN1812.JPG
DSCN1813.JPG
DSCN1814.JPG
DSCN1818.JPG
DSCN1833.JPG
DSCN1834.JPG
DSCN1835.JPG
DSCN1836.JPG
DSCN1841.JPG
DSCN1830.JPG
DSCN1832.JPG
DSCN1833.JPG
DSCN1842.JPG
DSCN1840.JPG
DSCN1841.JPG
DSCN1835.JPG
DSCN1951.JPG
DSCN1956.JPG
DSCN1830.JPG
DSCN1832.JPG
DSCN1824.JPG
DSCN1954.JPG
DSCN1818.JPG
DSCN1967.JPG
DSCN1968.JPG
DSCN1969.JPG
DSCN1970.JPG
DSCN1971.JPG
DSCN1972.JPG
DSCN1973.JPG
DSCN1974.JPG
DSCN1975.JPG
DSCN1976.JPG
DSCN1933.JPG
DSCN1934.JPG
DSCN1935.JPG
DSCN1936.JPG
DSCN1937.JPG
DSCN1938.JPG
DSCN1939.JPG
DSCN1940.JPG
DSCN1941.JPG
DSCN1945.JPG
DSCN1946.JPG
DSCN1947.JPG
DSCN1957.JPG
DSCN1958.JPG
DSCN1959.JPG
DSCN1960.JPG
DSCN1967.JPG
DSCN1968.JPG
DSCN1969.JPG
DSCN1970.JPG
DSCN1971.JPG
DSCN1972.JPG
DSCN1973.JPG
DSCN1974.JPG
DSCN1975.JPG
DSCN1976.JPG
DSCN1960.JPG
DSCN1961.JPG
DSCN1962.JPG
DSCN1963.JPG
DSCN1964.JPG
DSCN1965.JPG
DSCN1966.JPG
Ultrasonic range finder schematic.png
Bluetooth wireless transciever schematic.png
Star-Wars X-Wing 2 Schematic.png
I've always liked star wars, recently I was watching a star wars movie on you tube and when I say the “X-wing fighter”, I liked it so much, that I decided that I had to make one for myself, it took me about a week to get the materials and the almost about 3 and a half weeks to get the project together. I wanted it to look a bit different and I wanted to add an enemy detection system, so I decided to make the
“X-wing fighter 2”. Its pretty similar to the “Original X-wing” but it has an enemy detection system(a servo and a blue LED on top of the servo)(I just added a picture with the LED turned on, you can see the blue LED which kinda looks weird in the first few pictures(Don't know why)and the servo is under the LED)) and it has a bit different looks.

Please vote for this instructable in the LED contest if you liked it --->>>(Thanks in advance) HERE


Here is a video of the finished model, in this video you can see the cool lighting effects!
I know that the video is a bit dark, but I wanted you to see how cool the lighting effects look when its in darkness, so hope you liked the light effects, I didn't show you the servo and the LED on top of it(Scanning device), because I forgot about it while shooting the video, and now my camera does not work, so I will add a video of that as soon as my camera starts working.


In this video I rotate the X-Wing in clockwise direction so that you can get a view of the X-Wing from all directions.
http://www.youtube.com/watch?v=RNe5d0CqsDY


And here is the video of the Star-Wars X-Wing I made out of Paris metro tickets as I had a lot of them after my visit to Paris, so I made an army of 15 of these X-Wings(May the force be with you)


So what on earth is an arduino??
It cannot be described in words, the arduino is a cheap, innovative and creative open source micro-controller which anyone can buy, and hacking this micro-controller is as easy as it could be, so this is one way anyone can start leaning about electronics.
For more info go to :
www.arduino.cc/

If you are new to LEDs etc then go to these links to learn about them

If you need more help on LEDs then just type in "LED guide" in instructables, and you will get a lot of help.

An LED has two leads one is the cathode and the other is the anode ( cathode is + anode is -)
Cathode is the longer end and anode is the shorter end.
Keep this in mind that different LEDs need different amounts of power supply and different types of resistors. The most common types of LEDs are 20 mA (20 milli amperes).
The color bands on resistors indicate what resistance they have.(For my project I used 1 K ohm resistors).If you want to learn more about this then just go on Google and type resistor codes and you can learn from the websites listed, but if you want it to be calculated for you go to this link :
http://www.dannyg.com/examples/res2/resistor.htm

Some LEDs work even without resistors, but to be on the safe side I added resistors even tough for me they were not required.

This is the simplest project that you can make because there are no ICs used in this project at all, only an arduino(Which has an Atmega on it)So some basic skills that you will learn as you go through this instructable will help you make this project in no time

The fighter has a total of 26 LEDs(As I added 1 more LED in each shooter to increase the brightness) 5 in each of the shooters so 16 in total and 4 for the boosters and 1 for the detection unit and one for the headlight, and it had 1 Servo with the detection unit LED on top of it.(It was a blue LED).I recently added a distance sensor on top of the servo and the LED was attached on top of the distance sensor, and it the distance sensor detects something coming close then the LED will scan the area and another LED right beside the scanner LED will blink(shoot).You can also add an infrared transmitter on top of the distance sensor and as soon as it senses an infrared receiver as there will be an LED right beside the infrared receiver, as soon as the light sensor detects the LED the infrared transmitter transmitted data to the infrared receiver and the opponent loses.(You can also play this gave with your friend if you have 2 ships).
Confused??
Ok basically a whole lot of electronics are wired up to act as a targeting device to target the infrared transmitter of the other ship and send data to it, to win the game.(Basically like shooting it with the infrared transmitter,
(Its a self targeting device in simple language.)

The making of this isn't really hard if you are making a second model or you are experienced at these kind of stuff. My first one was “kind of” bad, but my second one was a success, I took it to my school for a talent show and I won a certificate for the most creative electrical/craft creation. I was really happy that day and then when I come home I see that there is an LED contest so I quickly decide that I will post this instructable in the contest.

I started off making the base with a deodorant can for the center base and 4 PVC pipes for the shooters and some bigger PVC pipes for the boosters and some cardboard for the wings, it was a really hard job cutting the PVC into size because all I had was a candle and a knife so I had to heat the knife and cut it because I had no drill press or anything.

And then I gave it the first coat of spray paint, and waited it to dry and then gave it another layer of spray paint. I then added details like the shooters top parts(near the LEDs) and some white spray painted cardboard for more detail on the wings.

Then I carved a block of styrofome in to shape with a lot of effort for the front part of the spaceship and it looked quite nice, but then when I spray painted it the pressure of the spray paint was too high so it made dents all over the thing somewhat similar to asteroids hitting the moon and making all sorts of dents, or somewhat like a shower spray on a handful of shampoo, so I advice you never to spray paint on styrofome.

So then I had to re-sand the styrofome into shape and covered it with some cardboard and then spray painted the cardboard. And by doing this I was finished doing the craft part of this model..

The next step was to insert the electronics inside the model, and I faced another problem at this point as the LEDs would not fit in some areas etc, and the wires were too short for some and the breadboard would not fit into the compartment, so I had to do some more cutting and pasting of cardboard and plastic and then I was able to fit the electrics in.So I strongly recommend that you make all the correct measurements and glue the LEDs in the tube before covering up the tubes etc.

The next step was to program the entire thing.
I used putty on windows as the terminal program(a program that runs the arduino like the arduino's serial monitor)I used it because you do not have to click enter after inputting each and every command.
This was the code I used :

#include <Servo.h>

int LedPin1 = 12;
int LedPin2 = 10;
int LedPin3 = 9;
int LedPin4 = 13;
Servo myservo;

void setup()
{
pinMode(LedPin1, OUTPUT);
pinMode(LedPin2, OUTPUT);
pinMode(LedPin3, OUTPUT);
pinMode(LedPin4, OUTPUT);
myservo.attach(11);
Serial.begin(9600);
}

void loop()
{
while (Serial.available() == 0);
int val = Serial.read() - '0';

if (val == 5)
{
Serial.println("Shoot");
digitalWrite(LedPin1, HIGH);
delay(500);
digitalWrite(LedPin1, LOW);
}

if (val == 6)
{
Serial.println("Boosters On");
digitalWrite(LedPin2, HIGH);
}
if (val == 4)
{
Serial.println("Boosters Off");
digitalWrite(LedPin2, LOW);
}

if (val == 7)
{
Serial.println("Shoot"1);
digitalWrite(LedPin3, HIGH);
}

if (val == 1)
{
Serial.println("Shoot1");
digitalWrite(LedPin3, LOW);
}
if (val == 3)
{
Serial.println("Scannign for enemies");
digitalWrite(LedPin4, HIGH);
for (int i =0; i <=180; i =i+20)
{
myservo.write(i);
delay (100);
}
for (int i =180; i <=0; i =i-20)
{
myservo.write(i);
delay (100);
}
digitalWrite(LedPin4, LOW);
}
}

Now I am going to explain what the code does in brief
The first part is adding the servo library to control the servo easily, then it tells which LEDs are connected to which pins on the arduino, then it sets the pins as outputs and in the void loop it basically checks with the computer to see if any key on the keyboard has been pressed, if it has then it checks if the key that was pressed was defined in the code eg : if (val == 9) then it checks if 9 has been pressed, if yes then it performs the action under that part of the code, if not then it just skips that part.
So this is how I control my 22 LEDs and 1 servo.

Just today, I found a laser for 10zl at my local store(3$), and I plopped it open and used the laser instead of the blue LED on top of the servo, and in the dark, it looks really cool.

The electrical parts I used are
  • An arduino
     
  • A breadboard
     
  • Some jumper cables
     
  • 2 NPN transistors
     
  • A couple of resistors
     
  • 22 LEDs
     
  • A 9 V battery
     
  • A servo
     
  • Lots of wire
     
  • Wire glue (because I do not have a soldering gun)
     
  • Heat Shrink tubing
     
  • An Arduino to USB communication cable ( You can use a blue-tooth transceiver to make it wireless, but I couldn't because I did not have enough space and due to some power problems.

If you want to post tweets on twitter do it by using this code in processing(Its a program just like the arduino IDE but for the computer)
When you use that code anything that is written like serial.println in the code will be posted onto twitter.
The Code for Processing :

/*************
* based on: http://processing.org/reference/libraries/serial/serialEvent_.html
*************/

import processing.serial.*;

Serial myPort; // The serial port
PFont myFont; // The display font
String inString; // Input string from serial port
int lf = 10; // ASCII linefeed

Twitter twitter; // Twitter

//Going to get oAuth working instead of this, but this will do for now
String username = "YOUR-TWITTER-USERNAME"; // you Twitter Username Here
String password = "YOUR-TWITTER-PASSWORD"; // your Twitter Password Here

void setup() {
size(400,200);
twitter = new Twitter(username,password);
myFont = loadFont("AppleGothic-48.vlw");
textFont(myFont, 18);
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
myPort.bufferUntil(lf); //wiat for line feed to specify end of serial buffer
}

void draw() {
background(100);
text("color selected: " + inString, 10,50);
}

void serialEvent(Serial p) {
inString = p.readString();//read serial string
//For some reason this only wanted to work in a try catch
try
{
Status status1 = twitter.updateStatus("Arduino's favorite color is "+inString);//update twitter status
}
catch( TwitterException e) {
println(e.getStatusCode());
}
}

Change username and password with your twitter username and password, I tried it and it works perfectly.
If you want to post updates to an application on twitter go to my other instructable :
https://www.instructables.com/id/Touch-Me-NotWithout-Ethernet-Sheild/

I had so ships, the first one which was OK and the second one that you see in the pictures,my friend asked me if I could add some infrared transmitters and receivers and I said yes and after adding 4 receivers to each and 1 transmitter, we went into our garden maze and had a star wars infrared light battle, my friend won because he was better than me at playing these sorta games :(  then We decided that we wanted to make something even better, so we removed the infrared receivers and senders and added a tilt sensor to each of the ships and then I also hooked up a tilt sensor in the other direction, and I made a game with java which is basically a game between two computers, and I used these sensors as input values.So one sensor is for turning and the other is for shooting, and we had lots of fun, and in this game I won :) .

If you want to use the ultrasonic range finder, then use this code and swap the pins and make some adjustments in the code to use it however you want, this is not the code I used, but its an example code from the seller, I did not give you the original code, because I would like you to take on a challenge and write the code for yourself.

int blinkLed=13; // Where the led will blink
int sensorPin=0; // Analog Pin In
int sum=0; // Variable to calculate SUM
int avgrange=50; // Quantity of values to average
int sensorValue; // Value for te average
int i,media,d; // Variables
float cm,inch; // Converted to cm


void setup()
{
Serial.begin(9600); // To check what is being read on the Serial Port
}

void loop() {

d=analogRead(sensorPin); // Read the analog value
digitalWrite(blinkLed,HIGH); // Turn on LED
delay(d); // Delay changes with the analogread
digitalWrite(13,LOW); // Turn off LED
delay(d); // Another delay

cm = (d / 2) * 2.4; // Convert the value to centimeters
inch = d/2; // Value in inches

Serial.println(cm); //Print average of all measured values

// This is the code if you want to make an average of the read values

/*

for(i = 0; i < avgrange ; i++) {
sum+=analogRead(sensorPin);
delay(10);
}

media = sum/avgrange;
Serial.println(media); //Print average of all measured values

sum=0;
media=0;

*/

}

And of course you can expand upon these ideas and make something even more awesome, if you do post a picture or a video in the comments section of this project.

The last few pictures show my mini X-Wing model I made, as I went to Paris a month ago and I had so many metro tickets that I decided to make the X-Wing with Paris metro tickets and here it is, I just gave the base and the ship(Both made of Paris metro tickets) a coat of white spray paint for the base and a coat of silver spray paint for the X-Wing.
If you want an instructable on the mini X-Wing made from Paris metro tickets then please comment and I might make an instructable.

There weren't many materials used in the craft part of the project,
Only some mechanical screws, bolts etc, Some cardboard, some spray paint, some cardboard and PVC tubes(PVC tubes were really hard to cut) and some duct tape, as you see some white colored cardboard and white colored duct tape, eg in the head of the x-wing the white decoration is made from duct tape.

This is a perfect project for anyone who likes star-wars and it does not matter if you are new to DIY as you can definitely make this project to start your DIY career.

Learning reference :

Where to buy :

LEDs :
http://cgi.ebay.com/100PCS-Ultra-Bright-R-G-B-W-y-LEDs-3mm-dia-5000mcd-/260578287502?pt=LH_DefaultDomain_0&hash=item3cabad1f8e

Micro controller :
http://cgi.ebay.com/Arduino-UNO-ATMEGA328P-ATMEGA8U2-FREE-USB-Cable-/320707209315?pt=LH_DefaultDomain_0&hash=item4aaba3a863

Servo :
http://cgi.ebay.com/4x-Genuine-SG90-Micro-Servo-9g-Trex-450-V2-Car-Heli-/270751143069?pt=Radio_Control_Parts_Accessories&hash=item3f0a06949d

Transistors and Resistors :
http://cgi.ebay.com/Ultimate-Assorted-Resistors-and-Transistors-Kit-1-/320562723193?pt=LH_DefaultDomain_2&hash=item4aa306f979

Breadboard :
http://cgi.ebay.com/Half-size-Solderless-Breadboard-Tie-Point-400-/220784853584?pt=LH_DefaultDomain_0&hash=item3367cd8250

Voltage Regulator :
http://cgi.ebay.com/10-x-LM1084-LM1084IT-12-Voltage-Regulator-12V-5A-TO-220-/310254906945?pt=LH_DefaultDomain_0&hash=item483ca22e41

When I bought these items, I got them from different sellers on ebay for way cheaper, but if you search on ebay, I'm pretty sure that you could get stuff for cheaper, and I also had some stuff lying around in my house, so that is why my project was completed in only 30 dollars, even tough I bought myself another arduino uno.

If you have any questions regarding the making of this project or the code or if you want the schematic on how I connected everything, you can just comment and I will try and help you as quickly as possible.

I thank everyone who helped me with this project and the forums of arduino.cc as I received all my electronic help from there.I got my inspiration from the star- wars movie and from this instructable :
https://www.instructables.com/id/X-Wing-Fighter-from-Office-Supplies/

The schematics for everything are in the last few pictures, I drew the schematics on a program called "Eagle", and they show you how to connect the whole thing, and then how to connect the wireless blue-tooth transceiver and how to connect the ultrasonic range finder for the scanning unit, I added all these to my project and its great now.

Any ideas will be appreciated, as I would like to improve this a lot!

The files ending with .sch(last 3 pictures) can be opened with Eagle(A program which is used to make schematics) and there are images of those schematics in the second last 3 pictures.

Please comment, rate, vote and subscribe.

MAY THE FORCE BE WITH YOU