Go Down

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

purgedsoul

Hi, here's my code, it's a bit rough and needs improvements; but so far is working for me. Hey Jakesoft, if you don't mind, care to post a snippet of your accelerometer code (or pseudocode) on how to check for a swing event?

Canobi

The code is actually a little more complicated than that. I did get clash detection to work, but it was so temperamental I got sick of working on it and just stuck with the clash sensor. You see, sometimes a hard hard swing would trigger a clash. I have seen this happen in YouTube videos of the commercial sound boards, so I know it must be a common drawback of using the accelerometer as a clash detector. I really hate that; it bugs me so much when I see it. This false-triggering never seems to happen with the clash sensor, so I'm still using that for now. Plus, as you know, the code is so easy with the clash sensor.

I won't rant here, but the accelerometer part of the code took me way too long to get working right and I still think it could be better. Far be it from me to discourage anyone from trying new things, but know what you're in for. As this thread demonstrates, I'm pretty happy to help out others develop their code, but I'd rather stay out of giving advice on the accelerometer motion detection. Here's hoping someone else reads this thread and can offer a better solution.

Your 3D printed parts look really good. I like your tie-fighter sled. I've got to try stacking WT588D on top of the Arduino board for shorter hilts. Did you solder directly to the WT588D pins, or use some kind of socket? How to you route your wires from your Arduino board to the sound module?
Seasons greetings all, hope you all had a good Christmas :)


One of the software engineers at work mentioned an arduino function called "constraint" that sounds perfect for accelerometers.

From what I understand you can set min/max limits that only do something if generated values fall with the set limits, anything that falls outside the limits is ignored.


Canobi

This one is a heads up for anyone wanting to use an amp with the WT.

Here's a source for some super tiny 3w mono amplifier modules:

http://www.aliexpress.com/snapshot/7206812763.html?orderId=71837755517375

I've ordered some to play with so will report back once they've arrived.

JakeSoft

#273
Dec 28, 2015, 01:49 am Last Edit: Dec 28, 2015, 02:37 am by JakeSoft
This one is a heads up for anyone wanting to use an amp with the WT.

Here's a source for some super tiny 3w mono amplifier modules:

http://www.aliexpress.com/snapshot/7206812763.html?orderId=71837755517375

I've ordered some to play with so will report back once they've arrived.
Looks promising. When you are done experimenting, maybe you can post up how it is supposed to be wired. I can't find a datasheet for this thing anywhere.

purgedsoul

This one is a heads up for anyone wanting to use an amp with the WT.

Here's a source for some super tiny 3w mono amplifier modules:

http://www.aliexpress.com/snapshot/7206812763.html?orderId=71837755517375

I've ordered some to play with so will report back once they've arrived.
I used a PAM8403 since the PAM8302 is not available locally from where I'm from. As per WT588D application notes you need to connect 1.2k and a 104 capacitor to ground between the WT588 DAC pin (PIN 2 on 16P module) and your amplifier's input.

If using an amplifier we need to set the option in WT588D programmer to use the DAC output instead of PWM.

Canobi

Looks promising. When you are done experimenting, maybe you can post up how it is supposed to be wired. I can't find a datasheet for this thing anywhere.
Yeh, it's probably the most obscure product I've encountered. I emailed the manufacturer for more info but haven't heard back yet.

On a plus side, I've finally manage to decipher the mostly missing silk screen on this pic of the underside:


JakeSoft

Yeh, it's probably the most obscure product I've encountered. I emailed the manufacturer for more info but haven't heard back yet.

On a plus side, I've finally manage to decipher the mostly missing silk screen on this pic of the underside:


Now that's useful. Thanks. Maybe I'll pick one up myself after I get my Mk. IV system vetted.

I see inputs for Rin and Lin. I wonder if those should be shorted together for our purposes or if one should just be left unwired.

billpealer

I used a PAM8403 since the PAM8302 is not available locally from where I'm from. As per WT588D application notes you need to connect 1.2k and a 104 capacitor to ground between the WT588 DAC pin (PIN 2 on 16P module) and your amplifier's input.

If using an amplifier we need to set the option in WT588D programmer to use the DAC output instead of PWM.

Do you need to set it to DAC mode?  the amp won't take the PWM?

i am waiting for this, and it appears that it can take audio direct. PWM.
http://www.ebay.com/itm/331652536370?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Canobi

Now that's useful. Thanks. Maybe I'll pick one up myself after I get my Mk. IV system vetted.

I see inputs for Rin and Lin. I wonder if those should be shorted together for our purposes or if one should just be left unwired.
I've been pondering that myself, what throws things is the fact there's only one output channel. I'm beginning to think it can mix the two inputs to make a mono out so it might not matter whether we use Lin, Rin or both.


Canobi

Do you need to set it to DAC mode?  the amp won't take the PWM?

i am waiting for this, and it appears that it can take audio direct. PWM.
http://www.ebay.com/itm/331652536370?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT
Good find, may have pick one of those up an all. I like the flexibility it offers when it comes to speaker impedance,a bit of number crunching may be needed to get everything balanced correctly but I see more pro's than con's for this diddy amp though.

JakeSoft

I've been pondering that myself, what throws things is the fact there's only one output channel. I'm beginning to think it can mix the two inputs to make a mono out so it might not matter whether we use Lin, Rin or both.


If it can mix two channels into one then it might make for some interesting possibilities, like using two WT588d sound modules at the same time to play two sounds simultaneously through a common speaker.

billpealer

This one is a heads up for anyone wanting to use an amp with the WT.

Here's a source for some super tiny 3w mono amplifier modules:

http://www.aliexpress.com/snapshot/7206812763.html?orderId=71837755517375

I've ordered some to play with so will report back once they've arrived.
FYI  -  here is one based on the same chip with a dual speaker set up.

http://www.ebay.com/itm/2x-PAM8403-2-x-3W-Mini-Stereo-Class-D-Audio-Amplifier-Board-5V-Amp-Module-/301834046185?hash=item4646b60ae9:g:GfAAAOSwEetWBDws

i have to say,.  stereo in,..  but it looks like mixed mono out.  um,..  BOOOOOO!!!

at least the one in the link about has the mono and stereo wiring illustrated. dual speakers with 2 WTs is a neat idea Jake.  it's not true mixing,..  but rather..  a concert!

SoundTrix

If it can mix two channels into one then it might make for some interesting possibilities, like using two WT588d sound modules at the same time to play two sounds simultaneously through a common speaker.
Indeed, one on constant hum, the other playing effects...  Hmmmm... The possibilities are endless.

purgedsoul

Indeed, one on constant hum, the other playing effects...  Hmmmm... The possibilities are endless.
Aha! Now there's an idea...

purgedsoul

Do you need to set it to DAC mode?  the amp won't take the PWM?

i am waiting for this, and it appears that it can take audio direct. PWM.
http://www.ebay.com/itm/331652536370?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT
Not so sure, haven't tried it with mine, I'm just playing on the safe side since it took me years before I got my WT588. As stated in the application note:

"PWM audio output: Direct drive speaker, connect PWM+ and PWM- to speaker. PWM+ and PWM- can not short circuit and can not connect capacitor or resistor to GND. If necessary to connect to amplifier under this audio output mode, can apply difference mode output to amplifier."

aaaannnd i don't get it... might fry the PWM pins of the WT or might damage the amplifier input.



Go Up