Go Down

Topic: Arduino Lightsaber (Read 415688 times) previous topic - next topic

Canobi

#330
Jan 07, 2016, 01:20 pm Last Edit: Jan 07, 2016, 01:35 pm by Canobi
Wish I could code, I'd have been way down that path of investigation  long ago lol.

According to the data sheet, like normal resistors there are different values that have different pressure ranges (up to 50kg) so one would need to be found that would work for the lockup (something like 12~20kg would be ok, I don't think anyone wants to risk breaking a poly blade even if they are pretty robust).

Widening the voltage threshold range would help deal with the strips response inaccuracies but a hunch tells me the key to the lockup working is the time thresholds.

but a ring would negate the need to have the hilt oriented as it would be able to sense pressure from the whole 360° radius.

I suppose you could line the hilt with multiple strips in parallel but in order to avoid gaps you'd need 10x the length in total and a slew of extra wiring to achive the same sense raduis.

Canobi

Here is a the Arduino pinout of my Mk. IV system.


To make routing on a one sided PCB a little more straightforward I may have to shuffle the pin list a bit.

As a small precaution I'm going to stick to the power rail setup as it is so the WT's GND reference won't need accounting for in code as it could be a pitfall for the unwary adventurer.

Out of interst, is the accent LED you're term for the FoC LED? I couldn't see a reference to it in the diagram and only count 3 fets.

jshaw

Wish I could code, I'd have been way down that path of investigation  long ago lol.

According to the data sheet, like normal resistors there are different values that have different pressure ranges (up to 50kg) so one would need to be found that would work for the lockup (something like 12~20kg would be ok, I don't think anyone wants to risk breaking a poly blade even if they are pretty robust).

Widening the voltage threshold range would help deal with the strips response inaccuracies but a hunch tells me the key to the lockup working is the time thresholds.

but a ring would negate the need to have the hilt oriented as it would be able to sense pressure from the whole 360° radius.

I suppose you could line the hilt with multiple strips in parallel but in order to avoid gaps you'd need 10x the length in total and a slew of extra wiring to achive the same sense raduis.
My issues with the strip are
1. It's really long, far too long to fit in the hilt
2. Running them up the blade would affect the lighting

 Finding the proper combination of timing and amount of pressure would be tricky. Once I have the basics working, I might experiment with this.

billpealer

My issues with the strip are
1. It's really long, far too long to fit in the hilt
2. Running them up the blade would affect the lighting

 Finding the proper combination of timing and amount of pressure would be tricky. Once I have the basics working, I might experiment with this.
plus the blade tension screw puts as much if not more force on the side wall of the blade holder (emmitter) than smacking it.

depending on how you tighten that screw could/would give false positives.

i think i can do it with the analog switches and specific parries if the sensors are oriented properly.

anyone have any base button code for procedural events?  i am thinking something like this

so:
Code: [Select]

int CL_sensor = 9  //sensor button pin
int SW_Sensor = 10 // swing sensor pin
long time = 0  //time of nothing
long debounce = 150 //150ms is the margin of error to determine a legit clash or false positive
bool lock_sound

setup
digitalWtite(CL_sensor,HIGH);
digitalWtite(SW_sensor,HIGH);
lock_sound = false;

void loop()
{

  // if the clash sensor was toggled and not just held at a state for less than 150ms
 
 if (digitalRead(CL_sensor) == HIGH && digitalRead(CL_sensor) == LOW && millis() - time > debounce && (digitalRead(SW_sensor) == HIGH   // the clash sensor was triggered AND the swing sensor is at rest in the closed state, such that the blade is horizontal aka saber parry 5
{   
 
   if (lock_sound)

     lock_sound = false;
     delay(5);  // do nothing.  get coffee but be back in 5 ms
 else
      lock_sound = true;
      WT_send_command(6); // clash sound followed by 3 seconds of lock up sound then hum sound
      delay(800);  // enough time for the clash to play thru to lock up but allow for additional input there after

    time = millis();   
  }
}

i haven't even begun to test that kind of logic.  i am waiting for some hardware.

JakeSoft

#334
Jan 07, 2016, 03:55 pm Last Edit: Jan 07, 2016, 04:03 pm by JakeSoft
To make routing on a one sided PCB a little more straightforward I may have to shuffle the pin list a bit.

As a small precaution I'm going to stick to the power rail setup as it is so the WT's GND reference won't need accounting for in code as it could be a pitfall for the unwary adventurer.
That's fine. I can shuffle the pins around somewhat without much effort. There are just a few limitations that have to be adhered to:

1) The 4 LEDs must be on PWM capable pins (they have little white circles around them on the silk screen in the picture I posted)
2) The X, Y, and Z accelerometer inputs must go to analog inputs (A1, A2, etc.).
3) Clash sensor must be in pin 2.

If you make the PCB just ignore the AXDL335 VDD and VCC pins on the arduino, that's fine; my software will still work if it's powered more directly by a 3.3V power rail. If the accelerometer pins are left as is, you could just map the X, Y, and Z inputs to the module and ignore the ones I'm using as power pins, don't give them a trace at all. That way the module could either be piggy-backed on the arduino or use your board's mapping. It also opens the door to  making a shorter, simpler version of your PCB with no mapping for the accelerometer pins at all, assuming it would be piggybacked.

Out of interst, is the accent LED you're term for the FoC LED? I couldn't see a reference to it in the diagram and only count 3 fets.
The accent LED is for lighted switches or indicator lights. In my videos, that is the output that is controlling the blinking of the LED in the ring switches that I use. It's an optional indicator light.

Protonerd

I missed the part of the discussion focusing on the sound module, so maybe it is somewhere there in this thread...

My current build focuses on another MP3 player chip, which does the job wonderfully, but needs a micro SD. Not bad, but I'm lately looking at a solution which can (re)-use the micro USB of the Arduino to upload the files to the MP3 chip. Can the WT588d in cooperation with the Arduino Nano somehow handle it? That would be a great solution, which would even top the commercially available saber boards, which currently also have an micro SD.

So what I want:
- changing sound files using USB from PC directly

What I do not want:
- micro SD card
- programmer module
- 2 USD connectors

JakeSoft

I missed the part of the discussion focusing on the sound module, so maybe it is somewhere there in this thread...

My current build focuses on another MP3 player chip, which does the job wonderfully, but needs a micro SD. Not bad, but I'm lately looking at a solution which can (re)-use the micro USB of the Arduino to upload the files to the MP3 chip. Can the WT588d in cooperation with the Arduino Nano somehow handle it? That would be a great solution, which would even top the commercially available saber boards, which currently also have an micro SD.

So what I want:
- changing sound files using USB from PC directly

What I do not want:
- micro SD card
- programmer module
- 2 USD connectors
I think the UltraSabers board does this already, but I agree it would be a nice feature.

You should get in touch with purgedsoul on this forum. He claims to have cracked programming the WT588D by directly connecting to the on board flash via SPI. He posted some code in this thread: http://forum.arduino.cc/index.php?topic=227435.15. I have been meaning to try it, but alas, only so much time to devote and I have not gotten to it yet.

I don't see a lot of details about wiring, so if you figure that out then please check back with us and let us know how to do it.

billpealer

#337
Jan 07, 2016, 06:52 pm Last Edit: Jan 07, 2016, 08:45 pm by billpealer
- 2 USD connectors
USD?
neither require connectors.  one off the shelf mini usb cable works. I wonder if you could fuse the 2 ports.....
i have the Nano and WT module on a stack  the USBs are right next to each other,  you just pull it out the chassis, plug in the USB for arduino, and if you need to make a change to the WT, stick it in the other hole. It's all SORTS of fun.  pull it out, put it back,..  repeat. :) (that part you laugh at Canobi)  What is the goal with one port?  Are you trying to seal the hilt? Make an un-tinkerable sellable thing-a-maroo? I like my hilt open-able. Swapping batts is better than charging IME.


Canobi

My issues with the strip are
1. It's really long, far too long to fit in the hilt
2. Running them up the blade would affect the lighting

 Finding the proper combination of timing and amount of pressure would be tricky. Once I have the basics working, I might experiment with this.
The strip can be cut to the correct length without issue and it's only 15.2mm wide so should fit above or below the retention screw.

Dizzyua

#339
Jan 07, 2016, 09:22 pm Last Edit: Jan 07, 2016, 11:41 pm by Dizzyua
Maybe someone know if I can programming arduino pro mini ATMEGA328 and sound module WT588D-16p via this device http://www.aliexpress.com/snapshot/7181287510.html?orderId=71709818091103 ?

And second question: If not maybe Arduino NANO V3.0 (with usb connector) and sound module WT588D-16p can help me with it? I can connect both boards and programming both about sensor reactions and write sound files for motions?

JakeSoft

#340
Jan 08, 2016, 03:27 am Last Edit: Jan 08, 2016, 03:34 am by JakeSoft
Lots of people have asked for parts lists. There are TONs of options, but here is a list of parts I've used for the Mk. III and Mk. IV systems.

1) Arduino Pro Mini:  3.3V/8MHz version
2) WT588D:            WT588D 16p (16-Pin version, with 8M or 16M flash)
3) 16-pin DIP socket: (Digikey PN ED3046-5-ND) (Link)
4) MOSFETS:           Farchild RFD14N05L (Link)
5) Clash Sensor:      SW-18020P (Link)
6) Accelerometer: GY-61 ADXL335 (Link)
 
Voltage regulator depends on intended power source. For lower voltage batteries, say 3.7 to 6 Volts, use

7a) 3.3V Regulator:    Digikey PN MCP1825S-3302E/AB-ND

For higher voltage batteries (like 7.4V) use:

7b) 5v Regulator:      Digikey PN 576-1143-ND (Link)

ryang

plus the blade tension screw puts as much if not more force on the side wall of the blade holder (emmitter) than smacking it.

depending on how you tighten that screw could/would give false positives.
The screw would be acting as a cantilever in this case, the force from the blade would be redirected to the bottom of the blade on the opposite side.  Again, you'd have to calibrate the sensor first after tightening the screw, but you'll still see an increase in the force on hit.

i think i can do it with the analog switches and specific parries if the sensors are oriented properly.

anyone have any base button code for procedural events?  i am thinking something like this
I don't think you'd even need a 2nd button.  Assuming you're only using the button for on/off (momentary press), you could program it to clash when the button is held before/during/after a hit.

stinky1

Wow great timing Jakesoft!  i have been reading about putting in resistors and how to figuring out
the Ohms for them.  I understand that now.

But you use the Mosfets to control the RGB LEDs.  So the Mosfet is like the resistor, limiting the voltage,   but allowing the dimming of the LED's through the Arduino coding.

I am planning on using this RGB star:  http://www.ebay.com/itm/1pcs-3W-RGB-LED-3-CHIP-6-Pin-Bead-Lamp-LED-Star-Light-/121149855858?hash=item1c35181872:g:xOgAAOxyYSJR8iHf

With these specs:
Forward Voltage VF (V) :  red (min 1.9, typ 2.2, max 3.1),Green/Blue (min 2.8, typ 3.5, max 4.0)
DC Forward Current (mA) :  red 385 ,Green/Blue 350
Average Forward Current (mA) : red 350, Green/Blue 350

People are using the Luxeon,  and I see them saying 700 to 1,000 mah.  So is that the total mah
combined from the 3 LED's  Or are the Luxeons more powerful?  
http://www.ledsupply.com/leds/luxeon-rebel-endor-star-rgb-high-power-led

           voltage          Min     TYP   MAX
Green LXML-PM01 2.55  2.90 3.51 -2.0 to -4.0 10
Blue LXML-PB01        2.55 3.03 3.51 -2.0 to -4.0 10
Red LXML-PD01        2.31 2.90 3.51 -2.0 to -4.0 12
Red LXM2-PD01 1.80 2.10 2.80 -2.0 to -4.0 8

So I guess they are comparable, and the Mosfets you specified above will work fine?

Sorry for the basic electronic questions,  I understand the coding better as I have
done BASIC programming.  

I have found some nice links today that explained it well for resistors:

http://electronics.stackexchange.com/questions/48522/what-resistor-to-use-with-this-rgb-led

http://forums.thecustomsabershop.com/showthread.php?14081-Tutorial-Calculating-Resistor-Values

Thanks I'm goin to play with the hotlinks on the parts list now  ;-)>

jshaw

Have any of you looked into in-hilt charging yet?  I know that battery swaps are much preferred as they should be fast and simple (assuming you design your sled/chassis appropriately), but I also like the idea of being able to charge the battery without pulling it.

I'm thinking that the SparkFun LiPoly Charger ( https://www.sparkfun.com/products/12711 ) should work? 

ryang

Have any of you looked into in-hilt charging yet?  I know that battery swaps are much preferred as they should be fast and simple (assuming you design your sled/chassis appropriately), but I also like the idea of being able to charge the battery without pulling it.
Looked at it and decided to just run removable battery packs.  I'm also being povo and running 4x AA Eneloops.. :)

Go Up