Arduino Lightsaber

very cool (y) :D . though , you could make those sound effects with some math and the PWM outputs , or if you want some specific sounds you can use interrups , an 8bit DAC and an SD card (lower quality but it will work well) . that way you would not need a chip . though as it is the project is really cool (y)

JakeSoft: This sounds interesting. It seems like you've really only got two options to make the system space efficient: 1) Make it long and as flat as possible, so you could possibly mount the circuits on top of a battery 2) Make it short and fat by stacking the modules on top of each other

That was pretty much the scenario until hilt diameters were discussed. I always thought saber hilts were approx 1.25" OD but that appears to be smaller than some of the IDs mentioned so will need to reassess my build strategy and materials. Gives a lot more room in terms of PCB space though so I may not have to keep trying to make them as small as I originally thought.

JakeSoft: Do keep in mind though, that you'll want to keep these as accessible as possible for hobbyists if you intend others to assemble them. Many are operating with $20 soldering irons and so-so soldering skills. One reason one might be interested in building their own sound board is that $100+ commercial sound boards are too expensive for them. If they need a $100 soldering station to build the board, then they aren't really ahead of the game unless they plan to build a lot of If you intend to sell completed boards, however, go for it and use all the tricks you have at your disposal to make it small as possible.

My aim has always been to make the PCBs as simple and easy to work with as possible and not just for the unskilled either as I happen to be one of those people that use a cheap £20 iron. I even fabricate my boards using home contructed equipment.

My pride and joy is a mini PCB drill press I built from scrap A/C inverter drive heatsinks and other reclaimed parts I got from work:

|500x375 |500x500 |500x375

JakeSoft: I think I can work with this pin arrangement. I'll experiment on my breadboard when i can get the time. I don't currently have a dedicated FOC LED, just the 3 for R/Gr/B, but I could add one easily enough. I don't have a second accent LED either, but it's OK if that output doesn't do anything for now, right?

Cool :)

The second accent LED is only really a suggestion. I broke out the unused pin in case someone writing their own code for the board had a reason to use it as it could also be used for other PWM type shenanigans.

JakeSoft: Is that true? What LED are you assuming people will use for FOC? Cree and Luxeon have different specs. What battery source voltage are you assuming? What if somebody wants to use a different color LED for dedicated FOC?

My apologies, my asperger's can sometimes make my thinking a little black and white and does indeed fill the gaps with all sorts of assumptions so I've amended the layout. All four channels are now resistor free.

Here's a smaller lower res pic of the board:

|500x250

Dropbox link to high res image (it's quite big though):

https://www.dropbox.com/s/0uoptk965n55yl0/WrenagadeTech%E2%97%8F%C2%B0_%20Saber%20fx%20PCB%20%28ADXL%20varient%29.jpg?dl=0

JakeSoft: @Canobi: Check this out and confirm it looks right to you.

/*
 * Pins_Canobi.h : Defines pinout for Canobi's 3-channel PCB.
 *
 *  Created on: Jan 8, 2016
 *      Author: JakeSoft
 */

ifndef PINS_CANOBI_H_

define PINS_CANOBI_H_

//General I/O Pins

define CLASH_PIN 2 //Clash sensor interrupt pin

define LED_RED_PIN 3 //PWM output for RED LED

define LED_GREEN_PIN 5 //PWM output for GREEN LED

define LED_BLUE_PIN 6 //PWM output for BLUE LED

define ACTIVATE_PIN 7 //Activation switch

define AUX_PIN 8 //Aux switch

define LED_FOC_PIN 9 //Flash-on-clash LED (not implemented by JakeSoft SW)

define ACCENT1_PIN 10 //Accent LED

define ACCENT2_PIN 11 //Secondary Accent LED (not implemented by JakeSoft SW)

//Serial pins for WT588d Sound board

define WT588D_BUSY 12 //Module pin "LED/BUSY"

define WT588D_SDA 13 //Module pin for DATA

//Accelerometer Pins

define AXDL335_X_PIN A0 //X axis

define AXDL335_Y_PIN A1 //Y axis

define AXDL335_Z_PIN A2 //Z axis

define AXDL335_VCC_PIN A3 //Accel power (not used by Canobi's PCB)

define AXDL335_GND_PIN A4 //Accel ground (not used by Canobi's PCB)

endif /* PINS_CANOBI_H_ */

Looks a OK :)

I still need to finish updating the identifier silk to reflect the new changes, so ignore the labals in the pic(s) for the LED output array as they will change (as will one or two other minor details no doubt).

On second thought, perhaps the only change I'd make would be to rename "second accent led" to "PWM output" as it's more generic.

Canobi: That was pretty much the scenario until hilt diameters were discussed. I always thought saber hilts were approx 1.25" OD but that appears to be smaller than some of the IDs mentioned so will need to reassess my build strategy and materials. Gives a lot more room in terms of PCB space though so I may not have to keep trying to make them as small as I originally thought.

I think a good design target is to not make the board any wider than 1". That way it'll fit inside PVC that is commonly used to make lightsabers. The 1" PVC electrical conduit is also commonly used to make sleds and chassis for lightsabers, so fitting inside those would be a boon. 1" will easily fit inside MHS parts which typically have in ID of 1.25".

Canobi: My pride and joy is a mini PCB drill press I built from scrap A/C inverter drive heatsinks and other reclaimed parts I got from work:

Cool setup. You're quite handy! I can drill and tap holes and cut things with a rotary tool. That's about the extent of my metal-working skills. (I told you I hate fabricating!)

Canobi: My apologies, my asperger's can sometimes make my thinking a little black and white and does indeed fill the gaps with all sorts of assumptions so I've amended the layout. All four channels are now resistor free.

No worries. That's the advantage of working collaboratively, many ideas make for better product.

Canobi: Here's a smaller lower res pic of the board:

|500x250

This looks pretty good. If you are still including the LP2992 LDO as an SMD component? If so, I'd suggest just routing power from that to the VCC on the arduino for the 3.3V version if you can. The drop out voltage on that part is going to be better than anything you'll get from the on-board regulator on the Arduino, especially some of the clones. In fact, I've had some bad experiences with Arduino Pro Mini 3.3V clones using sub-spec onboard regulators that cut out at 5 volts! That won't fly when you're running a 3.7V battery.

I have taken a hard look at the drawing you posted. I have a few comments and suggestions. Do with them what you will. There is really only one error that I noticed, the rest are just ideas for improvement.

1) The mappings for the Busy and VCC (3.3V) pins on the WT588D are each off by one pin. The Busy pin is right next to the VDD pin and the VCC pin is right after that. (VDD, BUSY, VCC, with no skipped pins). 2) You may not need to leave room for the clash sensor. They work best when placed as close to the blade as possible, but people often mount their soundboards close to the pommel. This means that folks will likely run wires from the board up the hilt toward the blade anyway for their clash sensor. It's OK to leave it as is, I'm just pointing out that the space may not be used often. It's an opportunity to make the board smaller, maybe. 3) If you still plan to include the LP2992 LDO, just run power from that to the VCC pin on the arduino (at least for the 3.3V version) and the VCC pin of the WT588D as well. It makes the entire part a 3.3V device with the option to add an LDO or buck to boost power to the VDD on the WT588D for more performance if desired. Otherwise, just bridge the WT588D's VDD to 3.3v as well and call it a day. 4) Why not route pins 2, 3, 5, 6, and 9 toward the inside of the board and take pins 7 (Activation Switch) and 8 (Aux Switch) out to the edge of the board? That way nobody has to solder wires for their switches to the middle of the board. I can see that becoming a big pain, especially if there is a PRO-Mini sitting on the other side and you can't thread the wire through to solder it in through-hole fashion after the MCU is mounted. The signals from the other pins never leave the board, so they don't need that premium edge real estate.

That's all for my notes. Don't take that laundry list to mean I'm not impressed; I really am. I'm excited and look forward to working out a way to combine your board with my software.

anyone get PWM LED fading working from an LED driver?

i cant get it to wrk.

the driver wont allow me to put the MOSFET at the 8.4v source,.. so i have to put it at the 3.4v output. i can get to set the voltage,. but not turn off or do any triggering,..

analogWrite(LEDPWM, 255); equals the full 3.4v

analogWrite(LEDPWM, 220); equals about full 3.25v

i can't measure a analogWrite 0, because the thing has never shut off. i have to pull the fet, or a wire.

I noticed Canobi's PCB has 10kohm resistors on the MOSFET section. My primary mosfet works,.. the one that uses digitalWrite,. and it also uses a common ground with everything else and NO resistor. is that what i am missing? a common ground for the PWM mosfet? i am hesitant to mix the 5v arduino ground and the 3.4v power from the Buck Step down driver.

The 10k resistors pull the pins to ground when not in use as I've been told they can sometimes float causing miss readings.

billpealer: I noticed Canobi's PCB has 10kohm resistors on the MOSFET section. My primary mosfet works,.. the one that uses digitalWrite,. and it also uses a common ground with everything else and NO resistor. is that what i am missing? a common ground for the PWM mosfet? i am hesitant to mix the 5v arduino ground and the 3.4v power from the Buck Step down driver.

As Canobi said, he added pull-down resistors for the MOSFET gates to stop them from floating. This is sort of a standard thing to do. The reason your application works without them is that when you do a digitalWrite(LOW) in code, the Arduino will pull the pin to ground so it's not left floating. So in practice you don't technically need them. I've done it both ways.

Canobi: The 10k resistors pull the pins to ground when not in use as I've been told they can sometimes float causing miss readings.

they are not needed on my 3.7v set up. have you got a working set up?

have you tried with and with out resistors?

JakeSoft: I think a good design target is to not make the board any wider than 1". That way it'll fit inside PVC that is commonly used to make lightsabers. The 1" PVC electrical conduit is also commonly used to make sleds and chassis for lightsabers, so fitting inside those would be a boon. 1" will easily fit inside MHS parts which typically have in ID of 1.25".

Not to worry, the board stands at 24.42mm which accommodates many different routing options so there's actually no need to make it any wider.

JakeSoft: Cool setup. You're quite handy! I can drill and tap holes and cut things with a rotary tool. That's about the extent of my metal-working skills. (I told you I hate fabricating!)

Necessity is the mother of invention. I got so perplexed with snapped wires during "on the fly" installments that I came to the decision to make my own PCBs to avoid all that crap.

After finding out what was need to put a lab together, I winged the whole lot following any tutorials I could find that were relevent as I've no formal education in engineering, chemistry, or electronics for that matter but if a colourblind dyslexic like myself can do it, anyone can.

JakeSoft: This looks pretty good. If you are still including the LP2992 LDO as an SMD component? If so, I'd suggest just routing power from that to the VCC on the arduino for the 3.3V version if you can. The drop out voltage on that part is going to be better than anything you'll get from the on-board regulator on the Arduino, especially some of the clones. In fact, I've had some bad experiences with Arduino Pro Mini 3.3V clones using sub-spec onboard regulators that cut out at 5 volts! That won't fly when you're running a 3.7V battery.

I was going for system voltage flexibility so combinations like 3v mini, 5v WT setups were possible but if the LDOs on the pro mimis are less than reliable I'll take another look at the power rail setup.

JakeSoft: I have taken a hard look at the drawing you posted. I have a few comments and suggestions. Do with them what you will. There is really only one error that I noticed, the rest are just ideas for improvement.

1) The mappings for the Busy and VCC (3.3V) pins on the WT588D are each off by one pin. The Busy pin is right next to the VDD pin and the VCC pin is right after that. (VDD, BUSY, VCC, with no skipped pins).

Oops, my bad. Will correct that post haste.

JakeSoft: 2) You may not need to leave room for the clash sensor. They work best when placed as close to the blade as possible, but people often mount their soundboards close to the pommel. This means that folks will likely run wires from the board up the hilt toward the blade anyway for their clash sensor. It's OK to leave it as is, I'm just pointing out that the space may not be used often. It's an opportunity to make the board smaller, maybe.

I had considered that which is why I put it up front with the accelerometer and made sure the pads were under an open spot so wires could be traces from there easily if necessary. Other than that, it's position is non critical to the boards dims, although I noticed I can still shave off about 4mm from the overall length anyway.

JakeSoft: 3) If you still plan to include the LP2992 LDO, just run power from that to the VCC pin on the arduino (at least for the 3.3V version) and the VCC pin of the WT588D as well. It makes the entire part a 3.3V device with the option to add an LDO or buck to boost power to the VDD on the WT588D for more performance if desired. Otherwise, just bridge the WT588D's VDD to 3.3v as well and call it a day.

That's pretty much how the power rails work right now, the only difference is that the pro mini rail is unregulated for 3v setups but it wouldn't take much to address that issue.

JakeSoft: 4) Why not route pins 2, 3, 5, 6, and 9 toward the inside of the board and take pins 7 (Activation Switch) and 8 (Aux Switch) out to the edge of the board? That way nobody has to solder wires for their switches to the middle of the board. I can see that becoming a big pain, especially if there is a PRO-Mini sitting on the other side and you can't thread the wire through to solder it in through-hole fashion after the MCU is mounted. The signals from the other pins never leave the board, so they don't need that premium edge real estate.

Ah, that'll take a lot more to rework than the power rail but the idea with that setup was to solder in the buttons/accent LED/PWM wires first, then mount the modules after as the header pins allow just enough room to trace them out from underneath. But your right, there's no way you'd solder wires in after the module have been mounted and the comms lines should indeed be on the inside. I'll need a couple days for that one.

JakeSoft: That's all for my notes. Don't take that laundry list to mean I'm not impressed; I really am. I'm excited and look forward to working out a way to combine your board with my software.

I'll PM you ;)

JakeSoft: As Canobi said, he added pull-down resistors for the MOSFET gates to stop them from floating. This is sort of a standard thing to do. The reason your application works without them is that when you do a digitalWrite(LOW) in code, the Arduino will pull the pin to ground so it's not left floating. So in practice you don't technically need them. I've done it both ways.

I put the 10k gate resistors on as a precaution but if they're not essential then I'll ditch those as well it'll help to simplify hand soldering.

Canobi: I put the 10k gate resistors on as a precaution but if they're not essential then I'll ditch those as well it'll help to simplify hand soldering.

You could leave the traces there then people could choose to put the resistor if they really wanted to. Otherwise, they could put nothing there and it would just be an open circuit.

I'm curious, what software are you using to generate your images? Looking at your layouts has me kind of eager to learn enough to play with my own designs, but I'm not sure where to start. I tried Fritzing, but it's pretty terrible if there is no part library for everything you want to use, and there doesn't appear to be one for WT588D. Adding your own is a big pain too. Yuck.

I have not found a tool that doesn't want you to start with a schematic first. All I want to do is make some simple mapping boards with vias and manual traces, I'm not sure why that's so difficult.

Well the resistors are less than pennies each but having tried it, it was a pain to solder them so close to the fet so it would make populating the board quicker and simpler to leave them off.

As to what I use, I design my layouts on my android phone. I found a couple of apps called DriodPCB and PCB design companion, both of which are totally free, totally awesome and have very little to no adds.

Design companion has a ruck of useful calculators needed for working out trace widths and the like while DriodPCB is where all the fun happens as you literally "draw" the circuit using a variety of tools (some of which can't actually be used yet but the devs are working on those).

Canobi: Well the resistors are less than pennies each but having tried it, it was a pain to solder them so close to the fet so it would make populating the board quicker and simpler to leave them off.

Yeah, anything you can do to make it easy will make it better IMO. Maybe even a version with all though-hole components. If you use the I-PAK packaged FETs, you can fit them three-wide on a 1 inch board. I personally lack the dexterity to solder SMD components properly. Soldering the pin headers on the Arduino is about as small as I go.

Canobi: As to what I use, I design my layouts on my android phone. I found a couple of apps called DriodPCB and PCB design companion, both of which are totally free, totally awesome and have very little to no adds.

Design companion has a ruck of useful calculators needed for working out trace widths and the like while DriodPCB is where all the fun happens as you literally "draw" the circuit using a variety of tools (some of which can't actually be used yet but the devs are working on those).

Oh, that sounds cool. I don't have an Android device, but maybe I could get an emulator and try it out. Too much setup for me to get into right now. I'll let you have all the "fun" in the meantime.

Found it!!

"Now I needed to power each LED (Red, Green, and Blue) individually. This is what I came up with: Three MOSFETs wired like so: Gate goes to Arduino Nano output. Source goes to ground. Drain goes to LED negative with current limiting resistor for each LED. "

|500x375

Jake's been holdin out on us!!! >:(

Lol only kidding, found that post on CSS forums where they said take Arduino elswhere!! :grin:

The Pertinax MkII is all I need!!! And that is what this thread is showing how to build.

http://forums.thecustomsabershop.com/showthread.php?16950-Pertinax&s=35f9001cb72b6a1df3147c4f507752fd&highlight=ARDUINO

http://forums.thecustomsabershop.com/showthread.php?15366-Novus-Animus

I took the dive and ordered all the parts, guess I still have to figure out the resistors and buy them too. I understand the smaller brown resistors limiting the voltage for the RGB led's, but what are the grey resistors doing? Sorry my newbness drags your guys brilliance down. :fearful:

stinky1: Found it!!

"Now I needed to power each LED (Red, Green, and Blue) individually. This is what I came up with: Three MOSFETs wired like so: Gate goes to Arduino Nano output. Source goes to ground. Drain goes to LED negative with current limiting resistor for each LED. "

|500x375

Jake's been holdin out on us!!! >:(

Lol only kidding, found that post on CSS forums where they said take Arduino elswhere!! :grin:

The Pertinax MkII is all I need!!! I took the dive and ordered all the parts, guess I still have to figure out the resistors and buy them too. I understand the smaller brown resistors limiting the voltage for the RGB led's, but what are the grey resistors doing? Sorry my newbness drags your guys brilliance down. :fearful:

LOL. Now there's a blast from the past. That's from a post about my first ever Arduino saber right there. I used a sound board from a toy on that one because I hadn't learned about WT588D yet! Yeah, the mod over there doesn't like Arduino talk for whatever reason.

The fat blue-gray resistors are actually the ones for the LEDs. The smaller ones were probably pull-down resistors for the gate pins, I think.

billpealer: they are not needed on my 3.7v set up. have you got a working set up?

have you tried with and with out resistors?

Yes, I tried both ways. It works without the resistors.

JakeSoft: Yes, I tried both ways. It works without the resistors.

I figured.

I was actually asking Canobi? Or is he just working for you? ;) he posts a lot of flour and eggs, i was wondering if he had some cake.

i got the bind lock on impact working. .. sort of.

if i orient the sw sensor on a perpendicular axis and wait for a strike,.. it will do it. sometimes. i used the same code i gave as an example. it works,.. 25% of the time. so many sensors are trying to step on each other,. but it works. or has the potential to.

it also got me thinking. Isn't a clash merely a 1/2 second of lock up, with another half sec of decay? so, maybe there shouldn't be clash sound.

just swing and lock up. every clash plays lock up, and it plays till there is a swing to break it up.

i am going to try that out. it makes too much logical sense. like adding hum to all the sounds.

So then the voltage is controlled through the PWM pins, and the voltage controls in the Arduino programming? With the Mosfets. I'm guessing.

JakeSoft: Yes, I tried both ways. It works without the resistors.

try PWM with mosfet with a buck booster? or just direct off hot DC with resistors or a linear regulator?

from what i understand from buck step/up down,. they push power at a frequency. they talk about ripple, and what not in their cut sheets. i am now savoy in PWM and arduino and LEDs.. yet if I put a mosfet tween the buck and the LED,.. no dice. i can use the mosfet tween the v+ and the buck to turn it on and off. i can use the mosfet with pwm direct to the 3.7v batt with effect. But not with the buck step down. grrrrr.

anyone have a story on that?

billpealer: try PWM with mosfet with a buck booster? or just direct off hot DC with resistors or a linear regulator?

from what i understand from buck step/up down,. they push power at a frequency. they talk about ripple, and what not in their cut sheets. i am now savoy in PWM and arduino and LEDs.. yet if I put a mosfet tween the buck and the LED,.. no dice. i can use the mosfet tween the v+ and the buck to turn it on and off. i can use the mosfet with pwm direct to the 3.7v batt with effect. But not with the buck step down. grrrrr.

anyone have a story on that?

Well don't quote me as Im really newb, but from what I read the buckboosters are for single color LED's. At least that is what I have read in my researching of all this, when I found out I didn't need one i was like phew cause they aint cheap. I was thinking one for each LED, 3 of them, OW dollas! :money_mouth_face: