Go Down

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

purgedsoul

Thanks I'll definitely use the vibration sensor for clash detection, how difficult is it to detect only swings with the adxl345? Could I use the accelerometer for swing detection then?


I've tried it with mine after several experimentation, you can either use the activity/inactivity/tap/double tap special feature of the adxl345 or you can just read the raw XYZ data and do a comparison

if x > swing sensitivity then swing

something like that.

billpealer

Can anyone testify for or against the ADXL335  vs the ADXL345?

I am happy to report that removing Clash sound was a success.  In its place is simply lock up sound. and when you clash, it plays lock up, if you clash and trigger a swing, it ends the lock up sound, and resolves a swing, and of course a swing decays to hum.  I think the rollerball switches are firing too many false positives for swings, and limits the positions that will allow a sustained lock up.  The accelerometer should reduce false positives for swings me thinks.

the cool part is that you now have a fairly reliable lock up, wit no 2nd button.

JakeSoft

#407
Jan 13, 2016, 02:36 am Last Edit: Jan 13, 2016, 02:36 am by JakeSoft
Can anyone testify for or against the ADXL335  vs the ADXL345?

I am happy to report that removing Clash sound was a success.  In its place is simply lock up sound. and when you clash, it plays lock up, if you clash and trigger a swing, it ends the lock up sound, and resolves a swing, and of course a swing decays to hum.  I think the rollerball switches are firing too many false positives for swings, and limits the positions that will allow a sustained lock up.  The accelerometer should reduce false positives for swings me thinks.

the cool part is that you now have a fairly reliable lock up, wit no 2nd button.
I've only used the 335, but I looked at the 345. 335 seems much more straight forward because you just have to connect it to power and then you can do analog reads of X, Y, Z. Easy-peaszy. 345 seems like a much bigger pain to get into with a two-way 3-line serial interface or SPI and a library that you need. I may experiment with it eventually, but the 335 seems a lot more user friendly to me.

T_R_O_N

That's interesting JakeSoft, thanks.

I'm glad that I have not ordered my parts yet, I was under the impression that the adxl345 is just a newer version if the 335. But if the adxl335 is more user friendly, then I think that I will rather use that one.

Protonerd

I've only used the 335, but I looked at the 345. 335 seems much more straight forward because you just have to connect it to power and then you can do analog reads of X, Y, Z. Easy-peaszy. 345 seems like a much bigger pain to get into with a two-way 3-line serial interface or SPI and a library that you need. I may experiment with it eventually, but the 335 seems a lot more user friendly to me.
I saw that you connect the ADXL335 X/Y/Z outputs to the Arduino. Do you keep polling these outputs in each loop? How are the data arriving? Do you get a digital value or is it more like an analog value from 0 to rail? Is it possible to scale to different acceleration ranges?

For my build I use the MPU-6050 breakout board, it has a 2-line interface (DO/DI), Vcc and GND, so far I'm happy with the results for both swings and clashes, but I'm looking out for a 2nd option.

Jantje

Hi
I want to do something very similar but for a fake metal sword.
The accelerometer you are using is what I had in mind. I don't understand why you have an extra "impact switch" as this should be visible from the accelerometer as well.
Can you elaborate on this?
Thanks
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

jshaw

Hi
I want to do something very similar but for a fake metal sword.
The accelerometer you are using is what I had in mind. I don't understand why you have an extra "impact switch" as this should be visible from the accelerometer as well.
Can you elaborate on this?
Thanks
Jantje
The impact switch, or as it's otherwise known the Flash-on-Clash switch, is used because until recently, accelerometers were not used in lightsabers. They used two switches, the FoC switch and a swing switch.  Nowadays, accelerometers seem to be gaining traction but are significantly more difficult to program than the two simple switches.

Canobi

tasty.

 i had a happy accident last night. 2x CR123A in series.. I epoxied 2 batt holders together, and realized.. For TCSS (not 1"pvc.  maybe 1 1/4" pvc tho)  i can rest the nano and WT on the back side of it. add some 3d printed fins (tie fighter) with and extension platform to hold the Mosfets, and sensors to keep it central, and then epoxy the Speaker holder to the other side,..


3d render coming.
You can make it even shorter by chopping off the two ends in the centre to make a duel cell holder.

Here's a pic showing one I put together last year for a cosplayer's prop weapon:






actually, Canobi the board making jedi,..  the batt holders have pcb pins.  you could mount your little board doohicky to the back of the batt holders. i think 7.4v is Jake approved if you are hoping to clone his setup. if you need a compact batt system. it may be the one!
I have some of those and tried that but the board width has to be restricted to 20mm wide or the assembly won't fit 1" IDs. There's a pic of my board on page 3 as it was when I first found Jakes thread. The routing is nowhere near as tidy as it is now and the board measured 146mm long without the accelerometer which adds another 15mm to the overall length.

I'm working on ways to bring a cell back into the mix for the smaller hilts somehow but mounting it isnt the way. Not such a problem for the wider fraternity so may look into doing one for those while I look for an answer to the other.

Canobi, can you send, or post me a high-con (high contrast black and white image) of your PCB board and its dimensions.  I'd like to make a 3D model of it, and then create a visualization of how it could be applied directly to a battery system. i think i can make a Hi-Con,.  if you could tell me the lxwxh, that would be sufficient.
I'll send you a high res PDF as soon as the board has been reworked but for now....

PCB substrate:

L= 97.2mm
W=24.42mm
H=1.6mm

Header pin chassis (the plastic bit) :

W = 1.27mm
H = 1.27mm

I think the pro mini and WT PCB is only .9~1.1mm thick but haven't got good enough calipers to get an exact measurement.



image attached.  the white paper would be the cake.
Here's one I mounted on a slightly different kind of cake I made for a stunt saber:



Lithium charging was the first thing on my list to tackle when I decided to make my saber fx system, took me the best part of a year to learn what I needed so I could confidently make and try the circuit without quite so much risk of blowing batteries or myself up. Luckily (though frustratingly) they've been duds and didn't do anything, a much preferable outcome for a failure when dealing with lithuim but I think I've finally worked out where I'm going wrong so making another proto.

The circuit is also now smaller than the cell it charges which makes for some intersting ways to include it. I have three ideas I'm toying with. Two of them were inspired by some S1 flex PCB I bought to play with. It's normally used for making ribbon connectors or 12v flexible LED light strips and is only 4mils (0.1016mm) thick so is super bendy.


1. Battery wrap



Advantages:

•The NTC thermistor that tells the ic how hot the cell is getting during the fast charge cycle will get a much more accurate temp reading sat on the battery.
•No increase in space requirements.

Disadvantages

• it will need to be put in a cradle or supported in some way so the components don't get knocked off.
• ic will run hotter when the battery gets warm during fast charge cycle


2. Hilt lining

This is the reverse to the battery wrap as this time the PCB is fixed to the hilt wall (sorry, no pic for this one)

Advantages:

• the ic will run a lot cooler as the metal of the hilt woll act as a heat sink.
•No increase in space requirements.

Disadvantages

•The NTC thermistor that tells the ic how hot the cell is getting during the fast charge cycle will get a much less accurate temp reading sat on metal hilts.
• the wire leads will need to be longer and the PCB could get a bit complicated to fit properly without risk of damage.


3. The hitchhiker (this is my favorite so far as it's simple and doesn't actually rely on being flexible)

The circuit is just small enough to fit between the pro mini pins so could easily just be glued to the underside of the fx PCB in an open spot and wired to the fx board from there.

JakeSoft

I saw that you connect the ADXL335 X/Y/Z outputs to the Arduino. Do you keep polling these outputs in each loop? How are the data arriving? Do you get a digital value or is it more like an analog value from 0 to rail? Is it possible to scale to different acceleration ranges?

For my build I use the MPU-6050 breakout board, it has a 2-line interface (DO/DI), Vcc and GND, so far I'm happy with the results for both swings and clashes, but I'm looking out for a 2nd option.
Your MPU is more sophisticated (and portly ;-) ) . I do like the reduced I/O required to operate it. That's on my list of things to try as well as the sound module you  used in your project. I like the bulit-in 3W amplifier, but I'm not keen on the SD card because of compatibility issue that always seem to pop up with those.

The short answer to your question is that I'm polling for accelerometer data every 10 ms to detect the swings. You just have to do an analog read of X, Y, and Z. The ADXL335 unit measures a fixed +/-3G. It's supposed to give an analog reading of 0 to 1024 (0V to 3V), but in reality I never see values outside of a much narrower range than that.

Dizzyua

Someone say cake?



Shame the routing is off but at least I know they come out ok.
Do you have pcb project file for any software? :)

Canobi

Do you have pcb project file for any software? :)
Hi Dizzyua, I don't use PCB CAD, just my android phone to make PDFs.

billpealer

#416
Jan 13, 2016, 09:15 pm Last Edit: Jan 13, 2016, 09:21 pm by billpealer
You can make it even shorter by chopping off the two ends in the centre to make a duel cell holder.

but then you have to have something now like a sleeve clip or retention clip to hold the center of the 2 batts tight together. No?

that will save a cm or so tho. i thought about it. i also thought about printing a custom holder with retension tabs for both batts, and just rape the metal connections parts from the batt holders to epoxt into the ends. that is a RAD costume by the way! Sweet. plus a good looking lady can sell water in a rain storm!

I understand it will not work in PVC.  i am a 1" PVC hater.  if you are gonna go cheap, then do it all the way and buy a walmart lightsaber $9 clearance, and pull its guts for the speaker, sound and LED button.  add a mosfet, and LED, and 3 1.2v NiMH and your fave LED,..  done.  cheap done cheap, and done cheap right. Cheaper than an arduino and WT buy about $25 me thinks.

All this arduino WT talk for PVC, im my mind is like slamming a Corvette Engine into a Cobalt. sure, you can talk about it, and maybe even do it...  but you could just buy the corvette. Do saber builders really not have the $95 to buy the TCSS parts? If not?  then it is by far cheaper, and VERY VIABLE to use the Hasbro method.

there is also 1 1/4" PVC,  how come no one uses that?  too fat on the OD?

Kamensky

I saw that you connect the ADXL335 X/Y/Z outputs to the Arduino. Do you keep polling these outputs in each loop? How are the data arriving? Do you get a digital value or is it more like an analog value from 0 to rail? Is it possible to scale to different acceleration ranges?

For my build I use the MPU-6050 breakout board, it has a 2-line interface (DO/DI), Vcc and GND, so far I'm happy with the results for both swings and clashes, but I'm looking out for a 2nd option.
OMG, SIR! Excuse me, but i rly need ur help if it's possible ofc. Same as u do - i use MPU-6050, but i'm sooo nooby with code. This model is xtrmly difficult for me. Could you share the code, please?

JakeSoft

I understand it will not work in PVC.  i am a 1" PVC hater.  if you are gonna go cheap, then do it all the way and buy a walmart lightsaber $9 clearance, and pull its guts for the speaker, sound and LED button.  add a mosfet, and LED, and 3 1.2v NiMH and your fave LED,..  done.  cheap done cheap, and done cheap right. Cheaper than an arduino and WT buy about $25 me thinks.

All this arduino WT talk for PVC, im my mind is like slamming a Corvette Engine into a Cobalt. sure, you can talk about it, and maybe even do it...  but you could just buy the corvette. Do saber builders really not have the $95 to buy the TCSS parts? If not?  then it is by far cheaper, and VERY VIABLE to use the Hasbro method.

there is also 1 1/4" PVC,  how come no one uses that?  too fat on the OD?
I get what you're saying, but in my mind anyone who has put in the time to build their own board can put it in whatever they want. They've earned the right. If Canobi provides a viable PCB, you could probably build one of these things in an hour, once your WT and Arduino programming are done anyway. Still, probably not many will do pure PVC with this setup. The 1" PVC and Poly pipe is great for make-shift chassis and sleds though, so probably lots of people will do that.

I do find the 1 ¼" PVC to be to thick for comfort.

Dizzyua

Hi Dizzyua, I don't use PCB CAD, just my android phone to make PDFs.
You are design board on android phone? :) I thinks what you create design project in some software and after create real board :)

Go Up