INTRO
How we use the sword portrays our principle and discipline. Based on the Star Wars film, it is believed that The Force was an energy field that connected all living things in the galaxy. Jedis channels this force and use a powerful weapon called a lightsaber. However, there are Dark Jedi that wields the same weapon but uses it differently. Jedi uses the light side of the force where it aligns to calmness and is used for knowledge and defense while the Dark Jedi drew their power from darker emotions such as fear, anger, hatred, and aggression. Which side will you choose?
Concept
The way we handle objects may say something about us. The faster we strike or the gentle the swing of the blade shows motive. Some people may choose to wield a blade to conquer and attack. This is the Dark Side of what I am trying to broadcast. While some may choose to defend others and be selfless. This is the Light Side where Justice takes place and resolves issue without using violence. I was inspired by Jedis in Star Wars film where by channeling ‘The Force’, there is a good and evil side. These side uses the same weapon but uses it differently from one another. I want to project this in the lightsaber I created. By starting in a good side, one can join the dark side by slashing rapidly as it changes from a green light to red light. This resemble the change of sides like a hint that one may fall towards the Dark Side.
Process
Originally, I wanted to create a game that was inspired by fruit ninja and explore the chopping motion movement. While ideating, I came up with a Fruit Jedi concept where instead of a ninja, you are a Jedi slashing fruits. This led me in exploring the light and the dark side of The Force and highlighting the emotion and motives we may have while wielding a blade like object.
 
I used a Smart Neopixel LED strip inside a polycarbonate plastic tube to light up the blade. Did a Strand test and it was successful by using alligator clips to quickly check the connections. Using alligators clip again, I also tested out the Accelerometer data gathered by the sensor and see how I can make use of these data. With these data, I created an algorithm that checks the old position and finds the difference. Depending on this difference of speed from the accelerometer, if it's greater than 2, then change the state of the LED to Red. Then it would revert back to a color Green.

I used a plastic container to encapsulate the circuit. This became helpful for me to open and close the container easily. Making it upside down locks the cap onto the handle to secure it. I had to create a hole onto the lid and the container so I can place the tube through the container and put excess inside the handle to give more sturdiness to it. I melted a hole onto the tube to compensate for the battery back. This allowed me to fit it inside the container while the plastic tube is within the container. It was a challenge to make it compact and as clean as possible but it was manageable. The components were inside the container but it wasnt completely locked into place. I sanded the plastic tube to make the light diffuse instead of its original clear property. This allows for the light to be more solid.
 
Technical
 
/*
  Kelvin Gonzales
  IAT320 Assignment 3
  Reference:
  http://www.geeetech.com/wiki/index.php/LilyPad_Accelerometer_ADXL335 
  Adafruit Example NeoPixel
*/
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif
#define PIN 6  // Pin for my LED Strip
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(40, PIN, NEO_GRB + NEO_KHZ800);

// these constants describe the pins. They won't change:
const int xpin = A9;                  // x-axis of the accelerometer
const int ypin = A10;                  // y-axis
const int zpin = A11;                  // z-axis (only on 3-axis models)
//
int sampleDelay = 1000;   //number of milliseconds between readings
float oldCalcX = 0;
float oldCalcY = 0;
float oldCalcZ = 0;
boolean firstcheck = false;
void setup()
{
   // initialize the serial communications:
   Serial.begin(9600);
   
   // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
  #if defined (__AVR_ATtiny85__)
    if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  #endif
   
   //
   //Make sure the analog-to-digital converter takes its reference voltage from
   // the AREF pin
   pinMode(xpin, INPUT);
   pinMode(ypin, INPUT);
   pinMode(zpin, INPUT);
   
   strip.begin();
   strip.show(); // Initialize all pixels to 'off'
}
void loop()
{
  
   colorWipe(strip.Color(0, 255, 0)); // Green LED Strip
  
   int x = analogRead(xpin);
   //
   //add a small delay between pin readings.  I read that you should
   //do this but haven't tested the importance
     delay(1); 
   //
   int y = analogRead(ypin);
   //
   //add a small delay between pin readings.  I read that you should
   //do this but haven't tested the importance
     delay(1); 
   //
   int z = analogRead(zpin);
   //
   //zero_G is the reading we expect from the sensor when it detects
   //no acceleration.  Subtract this value from the sensor reading to
   //get a shifted sensor reading.
   float zero_G =512; 
   //
   //scale is the number of units we expect the sensor reading to
   //change when the acceleration along an axis changes by 1G.
   //Divide the shifted sensor reading by scale to get acceleration in Gs.
   float scale =102.3;
   //
   
   float calcX,calcY,calcZ;
   
   calcX = ((float)x - zero_G)/scale;
   calcY = ((float)y - zero_G)/scale;
   calcZ = ((float)z - zero_G)/scale;
    
   // Save the position for the next check
   Serial.println(firstcheck);
   
   if(firstcheck == false){
     oldCalcX = calcX;
     oldCalcY = calcY;
     oldCalcZ = calcZ;
     colorWipe(strip.Color(0, 255, 0));
     Serial.println("huh");
     firstcheck = true;
   }
   else{
     // Check for negatives
     Serial.println("huh2");
   float CalcXdiff = calcX-oldCalcX;
   float CalcYdiff = calcY-oldCalcY;
   float CalcZdiff = calcZ-oldCalcZ;
   
   Serial.print(CalcXdiff);
   Serial.print("\t");
   //
   Serial.print(CalcYdiff);
   Serial.print("\t");
   //
   Serial.print(CalcZdiff);
   Serial.print("\n");
     
     //colorWipe(strip.Color(0, 255, 0));
     //delay(500);
     
     if( CalcXdiff > 1 || CalcYdiff > 1 || CalcZdiff > 1){
      Serial.print("Darkside"); 
      colorWipe(strip.Color(255, 0, 0)); // Red
      //delay(500);
       
     }
     else{
       colorWipe(strip.Color(0, 255, 0));
       //delay(500);
       // nothing
     }
     
     oldCalcX = calcX;
     oldCalcY = calcY;
     oldCalcZ = calcZ;
   
    }
   
   delay(sampleDelay);
   
}
// Fill the dots one after the other with a color
void colorWipe(uint32_t c) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
  }
}
Future
Create a digital interface that user may interact with. Make the Fruit Jedi come true by having a digital display to show fruits and if user slashes with the right amount of speed, the the fruit will be cut. Its not as simple as drawing a stroke but more into how hard one may swing the lightsaber to cut the fruit. This will challenge the players physical attributes like strength into a digital game by using the lightsaber
 
Demo
IAT320: SIAT Jedi
Published:

IAT320: SIAT Jedi

IAT320 Assignment 3

Published:

Creative Fields