Arduino Lightsaber

I've checked ports the way I have in the past, and it's being read clearly I believe (the arduino IDE worked at least). There is a light that's blinking when I hit install, and STREAM doesn't do or show anything to indicate that it didn't upload properly. But after the process finishes, the original blink function is still there.

gdadourian: I've checked ports the way I have in the past, and it's being read clearly I believe (the arduino IDE worked at least). There is a light that's blinking when I hit install, and STREAM doesn't do or show anything to indicate that it didn't upload properly. But after the process finishes, the original blink function is still there.

Well, you could try to upload with the batch script instead of using the GUI. That way you can see if anything is going wrong. https://github.com/JakeS0ft/STREAM/blob/master/UploadFirmware.bat I included this for just such an occasion. In the background, all the GUI is really doing is calling the same command as this script, but the output is hidden from the user. There are instructions for how to configure it at the top of the file. All you should have to change is the COM port, the Baud Rate, and the name of the firmware you want to upload (probably firmware/Brewboard_Pixel.hex). If there are any errors, you should be able to see them in the output from this command.

Howdy, Sorry it's taken me so long to respond, but I can only try this out on my work computer, and I've been quite swamped. So I pasted that sketch into the IDE, got my board hooked up and adjusted the -PCOMX- to the right com, but the code couldn't compile. First, it said there were stray @ symbols, so I tried removing those, then it said rem does not name a type, so I tried commenting that out, cause it just looked instructional, then it said expected constructor, destructor, or type conversion before 'Be'. Unfortunately, I don't know the arduino coding language, so I'm at a loss. What should I be doing here that I'm not doing properly?

gdadourian: First, it said there were stray @ symbols, so I tried removing those, then it said rem does not name a type, so I tried commenting that out, cause it just looked instructional, then it said expected constructor, destructor, or type conversion before 'Be'.

The .bat file is a file that runs on your computer, not something for Arduino. STREAM is a PC application that installs the firmware and controls the settings, it is pre-compiled and there is no way to edit it in the Arduino IDE. Just download the files to your computer and double click the bat file.

Ah. Thanks for the clarity. I edited the file, and ran it as instructed, and still nothing. Same 5 second blink file is still there. But, while I was just sitting and doing something else, it played a sound from the sd card for some reason.... Then went back to doing nothing but the blink function. Otherwise, the cmd window says "avrdude: stk500_getsync(): not in sync: resp=0x00" What's not happening?

One thing I did recently think about: When I'm using this nano clone in the IDE, it only likes to work if I tell the IDE that the board is an arduino uno. Could that have impact on the "patmega328p" callout?

That error usually means that the board is not what you think it is. For some reason, it's not registering as an ATMega328p. The fact that you can't program your "Nano" as a Nano is problematic. Even if it was a Nano which has the Uno's boot loader, the upload should still work. The Protowerkstatt DIYino Stardust V3 boards for which STREAM was originally developed used ATMega328p chips with Uno boot loaders and it was fine.

The binaries for STREAM are specifically compiled for 328, so if you have some other chip on the board, then all bets are off, I'm afraid. You need to know exactly what chip is actually on your board.

So I tinkered around with the IDE again, and I can program it as a nano with a ATmega328p selected for processor. I don't know why I thought I couldn't.... So the IDE is recognizing it appropriately and loading blinks without issue.... And by visual inspection, the chip says atmel mega328p, although I suppose that may not mean what I think it means.

REGARDLESS as I was typing this out, I changed the baud rate to the standard 11200 in the gui because I had a feeling I hadn't tried that, and it worked perfectly the first try. Sorry for all of this, I have not been using good engineering practices with this hobby project, and just get spacy when I try to work with electronics.....

Now to wire it together. Hopefully my recharging circuit doesn't explode. Thanks for the help!

Oooh, I thought you had already tried the other baud rate! Ok, well I'm glad it's working for you. I was out of ideas.

Obligatory annual post.

also,. DF Player No Library Code,
So you can trigger the DF like you would the Waytronic. with play track commands.

[iurl=https://www.youtube.com/channel/UCpzypxsbyPblxsvATKza_pg][/iurl]

[color=var(--yt-spec-text-primary)]//billpealer@gmail.com  Simple Blaster Core Arduino Nano and DFPlayer
// Disclaimer- you have been warned.

# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]
int trigger = 9;
int reload = 11;
bool isPlaying;
int LED = 13;

void setup () {

pinMode(trigger, INPUT);
digitalWrite(trigger, HIGH);
pinMode(reload, INPUT);
digitalWrite(reload, HIGH);
isPlaying = false;
Serial.begin(9600);
execute_CMD(0x3F, 0, 0); // Send request for initialization parameters
pinMode(LED, OUTPUT);

 while (Serial.available()<10) // Wait until initialization parameters are received (10 bytes)
 delay(50); // Pretty long delays between succesive commands needed (not always the same)
 // Initialize sound to medium volume. Adapt according used speaker and wanted volume
 execute_CMD(0x15, 0, 5); // Set the volume to medium (0x00~0x30)
delay(500);
}

void loop() {

//your code for on/off and sound triggers
 if (digitalRead(trigger) == LOW)
  {
    if(isPlaying)
    {
      execute_CMD(0x03, 0, 1);
      isPlaying = false;
      digitalWrite (LED, LOW);
      delay(150);
    }
    else
    {
      isPlaying = true;
      execute_CMD(0x03, 0, 1);
      digitalWrite (LED, HIGH);
      delay(150);
      digitalWrite (LED, LOW);
    }
  }
  if (digitalRead(reload) == LOW)
  {
    if(isPlaying)
    {
      execute_CMD(0x03, 0, 2);
      isPlaying = false;
      
      delay(150);
      
    }
    else
    {
      isPlaying = true;
      execute_CMD(0x03, 0, 2);
      
      delay(150);
    }
  }
}
// DF serial command code
void execute_CMD(byte CMD, byte Par1, byte Par2) // Excecute the command and parameters
{
 // Calculate the checksum (2 bytes)
 int16_t checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);

 // Build the command line
 byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge, Par1, Par2, checksum >> 8, checksum & 0xFF, End_Byte};

 //Send the command line to the module
 for (byte k=0; k<10; k++)
 {
  Serial.write( Command_line[k]);
 }
}[/color]

My next S.T.R.E.A.M. (XSTREAM) system is now live for open beta.

See it in action here: XSTREAM Demo Video Parts list here: https://github.com/JakeS0ft/XSTREAMOS/blob/v1_Beta/distro/doc/HomeBrewPartsList.txt Wiring diagram (NeoPixel) here: https://github.com/JakeS0ft/XSTREAMOS/blob/v1_Beta/distro/doc/HomeBrew_NeoPixel.jpg Use Guide: https://github.com/JakeS0ft/XSTREAMOS/blob/v1_Beta/distro/doc/XSTREAM_UserGuide.pdf

It's still got some rough edges, but it's serviceable as is. Up to 10 sound fonts can be loaded. NEC-style fonts should be drop-in compatible (we used the same file name conventions and sample rate). Just make sure you strip off any metadata from the wav files, as the user guide states.

It supports both RGB in-hilt LEDs and NeoPixel, but we just have not made an RGB wiring diagram yet. Expect that to be updated soon.

Hi. I am currently working on an Arduino lightsaber of my own and my only issue is detecting collision with my MPU6050. Can anyone help? I looked on google and I couldn't really find anything useful.

Sorry for the late reply. I made a library that can handle detecting swings and clashes with an MPU6050 (and a few other sensors too).

Check out the example here:

I am almost 100% sure im doing this wrong, but hi jake! big fan of your work, recently saw that Omni swing was a thing, would that work with the vanilla DIYino set up? meaning the nano, the motion detector and the mp player?

Thanks for your interest. Unfortunately, no; XSTREAM (with Omniswing) is designed for a totally different architecture based on nRF52 and won't work with the older DIYino setup. The 8-bit AVR chips just don't have the power required to do the audio processing and the MP3 chip isn't up to the task.