Go Down

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

nom_smile

This question comes up once in a while. As far as I know there is no way to make it work on a Mac without a virtual machine.

I know, I'm just as shocked as you; I thought everything "just worked" on a Mac. (I couldn't resist).
@nom_smile, I think you were talking to me. That only refers to the arduino itself. I have that working already as I've used it to upload sketches for my multiwii multi rotors. What I am referring to is the wt855 sound module which is not an arduino piece of hardware.
This is from the post that jakesoft referenced about the arduino code to work with the module:
"There is a shared Google drive with the control software to upload wav files to the devices, the user manuals, and schematics , they are well written for this type product: https://docs.google.com/open?id=0B2_rhDNAxM4sbmRtM2dXM2ZxWUE"
The software is only pc compatible.
JakeSoft.. So the software needs a virtual audio interface? for it to work in a mac setting? (sorry been a bit busy)

purgedsoul

JakeSoft.. So the software needs a virtual audio interface? for it to work in a mac setting? (sorry been a bit busy)
No, the WT588D uploader/programmer software (This is the software that compiles the bin file to be uploaded to the WT588D module) works only on Windows.

darkside

hey i am guessing that when you used the accelerometer that it eliminated the use of the motion sensor. is this correct?

kingale

Dear Friends just a couple of questions.

Im trying to do the same build as Jakesoft using an accelerometer and the clash sensor.
First of all, is there a way to include the "play command" to reproduce the boot up just once sound by including it in the void setup?

Is it possible to play the hum sound in the background and interrupt it as a swing is detected by the accelerometer? Then resume it and continue playing it in a loop.

Im trying to accomplish this without using any delay functions in the main loop to avoid lag.

Currently using the wt588d, an arduino nano and a mm8452 accelerometer.  So far i have accomplished to run the functions "power on and power off" (including led and corresponding sound) with an attach interrupt function, a hardware debounce with an inverse Schmitt trigger and the 1 line serial mode.

DJWing79

hey billpealer, do you have the completed code that you can share with us? I've been working hard on mine and it works but could always use tweaking. I have a suggestion for the changing of the swing and clash sounds, use the CASE SELECT option in Arduino. Here's the working part of my code that does this. Note, i'm still using 3-line serial mode and am hoping to look at your completed code to modify mine for 1-line.
Code: [Select]


int clashValue;
int swooshValue;
int clashSound;
int swooshSound

(under loop)

switch (clashValue) {
    case 1:
      clashSound = 0x03;
      break;
    case 2:
      clashSound = 0x04;
      break;
    case 3:
      clashSound = 0x05;
    case 4:
      clashSound = 0x06;
      break;
  }
 switch (swooshValue) {
    case 1:
      swooshSound = 0x08;
      break;
    case 2:
      swooshSound = 0x09;
      break;
    case 3:
      swooshSound = 0x0a;
    case 4:
      swooshSound = 0x0b;
      break;
  }
clashValue = random(4);
  swooshValue = random(4);

(outside loop)

void swoosh() {               //am using a ADXL335 accelerometer and had to create values so the
  calibrated = false;         //vibration from the clash didn't trigger the swing sound
  if (canSwing = true) {
  if (isclashing == false) {
      sendcommand(swooshSound);
      delay(5);
    }
  }
  canSwing = false;
  delay (5);
}

void clash() {
  if (isOn) {
    digitalWrite(clashLed, HIGH);
    isclashing = true;
    sendcommand(clashSound);
    delayMicroseconds(2000);
    digitalWrite(clashLed, LOW);

    isclashing = false;

  }
}


raphax

Hello, to program the wt588d-16p i need use this arduino scheme? or the scheme is only to play the sounds with arduino sensing the messagens? i didnt understand this...

Thanks

JakeSoft

hey i am guessing that when you used the accelerometer that it eliminated the use of the motion sensor. is this correct?
Yeah, the tilt sensor would have been kind of redundant, so I removed it in my Mk. III system when I added the accelerometer. I'm still not totally satisfied with how that's working, I've got to come up with a better swing detect algorithm.

darkside

thanks JakeSoft for the info i am still waiting on the rest of the parts. so as of now i am just getting the feel for how it should come together. any tips on the programming would be useful. and i also checked out your videos to better understand the setup. i say job well done. PS. the programming is rather new to me, i understand how to get into it its just the code writing that i am leery about. one line three line is new to me. first time trying this in any case.

JakeSoft

Im trying to do the same build as Jakesoft using an accelerometer and the clash sensor.
First of all, is there a way to include the "play command" to reproduce the boot up just once sound by including it in the void setup?
Yes, that would work.

Is it possible to play the hum sound in the background and interrupt it as a swing is detected by the accelerometer? Then resume it and continue playing it in a loop.

Im trying to accomplish this without using any delay functions in the main loop to avoid lag.
Yes, if you read the rest of this thread you'll see several ways to do exactly that. One caveat is that your hum sounds need to play from the start each time, you can't interrupt them and then start playing again from where you left off.

billpealer

hey billpealer, do you have the completed code that you can share with us? I've been working hard on mine and it works but could always use tweaking. I have a suggestion for the changing of the swing and clash sounds, use the CASE SELECT option in Arduino. Here's the working part of my code that does this. Note, i'm still using 3-line serial mode and am hoping to look at your completed code to modify mine for 1-line.
i am not using a accelerometer so i can't say what will work for your set up.  can you tell me what ISNT working, and maybe we can sort it out.

this is the working code for 1 line serial.  i think others have said they have reduced the below delay times.

void WT588D_Send_Command(byte addr) {
    digitalWrite(WT588D_SDA, LOW);
    delay(5);

    for(int i = 0; i < 8; i++)  {
        digitalWrite(WT588D_SDA, HIGH);
        if(bitRead(addr, i)) {
            delayMicroseconds(600);
            digitalWrite(WT588D_SDA, LOW);
            delayMicroseconds(200);
        } else {
            delayMicroseconds(200);
            digitalWrite(WT588D_SDA, LOW);
            delayMicroseconds(600);
        }
    }

    digitalWrite(WT588D_SDA, HIGH);
    delay(100);
} //end WT588D_Send_Command

DJWing79

What happens is when I tell it to play the hum sound it gets distorted and then starts clicking even when i put a long enough delay in for the sound to play.

darkside

ok i am guessing that the +5V in #6 indicates the 5V regulator which connects to both boards in the diagram. and the led mossfet gates i think i have figured out.

darkside

hey just checking things out on amazon for next build when i have mastered this one and found a WTV020-SD-16P sound board there. have anyone hear good things about it or what. it can either be a 5V or 3.3V.

purgedsoul

#133
Dec 03, 2015, 08:32 am Last Edit: Dec 03, 2015, 08:38 am by purgedsoul
hey just checking things out on amazon for next build when i have mastered this one and found a WTV020-SD-16P sound board there. have anyone hear good things about it or what. it can either be a 5V or 3.3V.
Check out this thread on that particular module:

http://forum.arduino.cc/index.php?topic=117009.0

- older modules are 3.3V check if you have newer one that can accept 5V.
- you need to look for a compatible micro SD card 1GB (newer higher capacity cards will not be accepted)
- you need to convert your audio file so that it can be recognized by the module.
- SD card needs to be formatted so that memory spaces are contiguous.
- noticeable delay during playback between sound files (so no gapless playback).


JakeSoft

Check out this thread on that particular module:

http://forum.arduino.cc/index.php?topic=117009.0

- older modules are 3.3V check if you have newer one that can accept 5V.
- you need to look for a compatible micro SD card 1GB (newer higher capacity cards will not be accepted)
- you need to convert your audio file so that it can be recognized by the module.
- SD card needs to be formatted so that memory spaces are contiguous.
- noticeable delay during playback between sound files (so no gapless playback).


This is consistent with everything I have read about them. I looked into it as a candidate but rejected it for some of the above reasons. Obi1 even said that he tried it for his saber sound board project and it flunked out pretty much for the failure to do gap-less playback. I'm sure it's fine for some things, but for this application it's not up to the task.

Go Up