Arduino Lightsaber

Hi there
I'm trying to follow the circuit diagram for the homebrew pixel set up via the FX-saberOS on github, but am having no luck. I adjusted the code as per the config specs, and got a "successful" compile & upload to my nano, and loaded the sound fonts onto the sd properly, but my circuit doesn't do anything. The activation light doesn't even turn on. I've tried with batteries to Vin as well as power via the micro usb, but still nothing.

That was about a month ago. After a break, I'm back to it. This time, I thought I would try uploading the firmware via STREAM, and that hasn't worked either. First problem was my computer won't recognize the nano on any port if it's connected to the full homebrew circuit. So, I wired together a nano with the two switches and the speaker, which was recognized, but the handshake failed trying to connect it to STREAM.

I really don't know much about coding, so any help would be appreciated.

What does it say in serial when you boot up?

What does in serial mean in this context? And what do you mean boot up? (The saber activation button, saber power, or plugging the nano into the PC?) Again, I don't know much about coding and computer programming.

I've learned that the arduino nano clones I'm using utilize the old bootloader, and don't communicate at 115200 baud, which could be causing the connection issues with STREAM. Is Could that be what's happening? Is there a way to fix that?

Since the last post I think I got the firmware to upload to the nano. It needs two 3.7v 18650's in series to power Vin, but the blade actually turns on "properly". The audio doesn't really seam to work. I can hear slight sounds through the speaker, but not enough to hear the menu sounds.

I tried rewriting all the firmware on my nano's via stream, but no combination will take. Additionally, now I can't even get the activation switch to work again. However, when I give the circuit power, it'll play some odd sounds that sound like yoda and an old fashioned camera flash.

In case it's not clear, I'm completely lost.

Two 3.7v batteries in series would give you 7.4V. The nano and the DF Player are not happy if you drive them at higher than 5V. You may have fried something. If you meant parallel, then you're probably fine.

To try and answer your questions:

  1. The wiring for STREAM is identical to that of FX-SaberOS. If you followed the wiring diagrams exactly for that, then you should be fine.
  2. When uploading the firmware with the STREAM GUI, make sure to choose Baud Rate 57600 if you have an older Nano bootloader. (Choose the faster 115200 only if you have the Uno bootloader).
  3. When you set up the SD card, you have to do it in a very specific way. This video may be helpful to you: SirRawTunderman Explains SD Card Setup. This is for FX-SaberOS, but the hardware and setup concepts are the same. If you are hearing the Yoda voice at all, then it must be partially working. That voice is the FontID sound for the 4th sound font. It's one of 4 possible boot sounds you might hear when your saber first starts.
  4. The STREAM GUI operates at the same baud rate regardless of what bootloader you are using. If you are getting "handshake failed" it could be for a few reasons.
    4a) Check that your saber is in STREAM mode. When you first hit the "connect" button, the saber will reboot. After it reboots, hold in the activation switch until you hear the voice prompt "STREAM Mode". The blade (channel 1) will also start flashing at this time. Do NOT let off the button when you hear "Menu Mode", just keep holding it in until you see the blade turn on or you hear the "Menu Mode" voice prompt.
    4b) Make sure you have selected the right COM port. It should be the same as the one you used to upload the firmware.

I hope that helps. Check back in and let us know how it goes for you.

Ok, so I switched my wiring to reflect 1 battery to the 5V pin (exactly as it's shown on the fx-saber-os homebrew pixel wiring diagram), and it seemed like things worked for a fraction of a second, but I'm stuck again.

I installed the firmware for diyino prime V1 pixel @ 57600 baud onto one of the nano clones I have. When I give the circuit power, a neat saber effect plays, and then it sits idle (this is instead of one of the sound fontID's like last time). The LED ring on the button doesn't light up anymore. I think I mistakenly bought 6v buttons back when I ordered components, so perhaps I need to go back and get the 3v buttons. That's why the button worked with 2 18650's (now I'm using just one). If I press the activation button, I get about half an ignition sound effect before the speaker cuts out. Then, once the speaker is out, the blade starts to ignite as a pixel setup would, but it only gets about 5-10 pixels before the blade just "turns" on to a steady red color. Then the circuit becomes unresponsive. If I power down, and then back up, the same boot up sound happens, and if I hold down the aux button, it switches sound fonts properly. BUT, as soon as I hit the activation button, I get the same error (with the different font activation sound). Could this be caused by the activation button's LED voltage requirement?

With the same chip/ circuit, if I plug it into the computer before giving it power via battery, when I turn on the battery (to give the LED's, dfplayer, and mpu power) the speaker starts making clicking sounds. No boot up sound. Handshake still failed, but it's hard to know what's going on with the modes without the speaker, activation button, or lights working.

Lastly, I tried a few other chips to see if I had any luck. Two of my other nano clones (one the same brand as the first, the other different) didn't give any results, and the last (the same brand as the first chip that partially worked) yielded the same results as the first test.

Thanks in advance for your help.

Your description sounds like the Nano is loosing power mid-activation and rebooting. Try disconnecting everything except the switch contacts and the speaker. No blade. No accent LED. Removing these other power draws will simply your troubleshooting and reduce the power demands on the system.

Other possibilities:

  1. Make sure your battery is fully charged
  2. Make sure your battery can handle the current demands of a NeoPixel blade. It depends on how long your blade is, but generally you'd want a battery that can handle a maximum continuous current draw of ~15 amps to be safe. Most 18650's can't do that and have PCB's built into them that cut power if the current draw goes over their rated limit.

I disconnected the blade, and the sounds all worked normally. So, I wired another 18650 in parallel, and the blade turned on with the sound, buttons worked, etc, however the blade didn't "ignite" normally. It just "turned on" after the ignition sound played. Furthermore, when turned off, the blade (sometimes in sections, sometimes entirely) stayed on (with no sound). I was able to connect it to STREAM and fiddle with the color and blade settings, but I don't think whatever I did to the sound timing made any difference.

It seems the protection circuit in the batteries I have limits them to 600 mA. I should probably buy new batteries that have better power draw ratings, as I only have space for 1 cell in each hilt I'm making. In the mean time, I could remove the protection circuit to allow unfettered power draw. In this type of circuit, what are the main risks of an unprotected battery? I have a smart charger that I should theoretically be able to use to charge unprotected batteries (they'll be disconnected from the circuit for charging via latching switch), but I feel like it's worth asking here, too.

Silly question, but did you remember to click the Save icon on the main STREAM screen before disconnecting the USB cable or switching to a new font? Each sound font has it's own timing parameters, so you have to save after you adjust each profile. To adjust all profiles, you'd have to hit the save button a total of 4 times.

I think the problems you are seeing are mostly power related at this point. You'll want more than 1.2A. You can try adjusting your blade length in the Options screen to make the blade smaller. Less LEDs will light up and make the blade draw less power. You can maybe see if it starts working better with a shorter blade. Also try reducing the volume with the in-hilt menu. That will make the sound amp draw less power. If those things have a positive effect than it's almost certainly just your battery not being up to the task.

On the DIYino and Brewboard boards for which STREAM was designed to work, there are FETs that can cut power to the blade when it turns off. That would at least eliminate the problem you are seeing with the blade staying on, although it really shouldn't do that anyway.

I'm sure I hit save, but I went back and tested it today and there was no difference. I have 4 protected 18650's wired up in parallel (which should allow for 2.4 amps) , but I'm still having all the same errors. When I set the blade for 30 pixels, it kept lighting up the whole blade (all 60), but only doing the lockup and blaster bolt effects on the first 30 (still no turn on effect, just lights up the first pixel, then the next 59, as if it's trying to do the ignition effect, but falling quite short). I'm not sure what the bug is. Where in the homebrew pixel circuit should the FET's be? I hadn't included any in the first place, since the homebrew pixel circuit doesn't call for any. I have some NPN transistors laying around, would those work?

gdadourian:
I'm sure I hit save, but I went back and tested it today and there was no difference. I have 4 protected 18650's wired up in parallel (which should allow for 2.4 amps) , but I'm still having all the same errors. When I set the blade for 30 pixels, it kept lighting up the whole blade (all 60), but only doing the lockup and blaster bolt effects on the first 30 (still no turn on effect, just lights up the first pixel, then the next 59, as if it's trying to do the ignition effect, but falling quite short). I'm not sure what the bug is. Where in the homebrew pixel circuit should the FET's be? I hadn't included any in the first place, since the homebrew pixel circuit doesn't call for any. I have some NPN transistors laying around, would those work?

Your blade acts like it is dropping frames. Any signal integrity problems on the data line can cause strange behavior. What timing settings are you using for your blade ramp? What happens if you set the blade ramp time to be long, like 10 seconds (10000)? Also, did turning down the sound volume have any effect?

The N-Channel MOSFETs go on the negative side of your LED strip. Pins 3, 5, and 6 on the Nano will go LOW when the blade turns off and will go HIGH when the blade turns on. I'm pretty sure one of the FXSOS wiring diagrams shows this. NPN transistors probably won't work for this, but I never tried that. The MOSFETs are most convenient as they require very little current on the gate to drive huge loads.

I set the power on time to 10,000 (10 seconds) as well as the power off time. The preview played the power on sound, and showed no light. Then, at the end of the power off time (19 seconds or so in), the power off sound played, and the first 2 LED's turned on, followed by the rest of the strip, and then it just stayed on. Turning down the sound volume has had no effect.

The fxsos diagrams show MOSFETs for the star LED and string blade diagrams, but nothing for the pixel blade diagram (homebrew, not DIYino). Here's the link for the diagram I'm talking about:
Homebrew Pixel Saber (FXSOS)

I expect many of your issues come from your battery setup. If you are operating at their limits, the circuits might be triggering at different times. If they are really of such low capability, then they are probably sagging to a voltage below operational thresholds for the component.

If the batteries you are using are of such low quality that you need 4 to theoretically power your setup, they are entirely unsuited to the task. That they are limited to 600ma is not a good sign. Even a 14500 would typically have a higher rate.

The only reason to use a transistor is to let the mcu cut power to the blade to save power when the blade is connected and the power is on. In your current configuration this is probably pointless in any case.

I must recommend that you do not keep trying to use 4 batteries in parallel. With their low performance it seems highly unlikely they are of a good quality. If they aren't matched cells, when the system is idle they will be discharging to each other to balance the potential. Assuming they are actually protected this will help keep things from getting too thermal, but the larger the imbalance, the more extreme the discharge. If one cell is particularly weaker, all the other cells may dump into it at once.

The battery is the most important part of your saber and should be the last place you try to cut corners, especially with a pixel blade that is that much more demanding.

gdadourian:
I set the power on time to 10,000 (10 seconds) as well as the power off time. The preview played the power on sound, and showed no light. Then, at the end of the power off time (19 seconds or so in), the power off sound played, and the first 2 LED's turned on, followed by the rest of the strip, and then it just stayed on. Turning down the sound volume has had no effect.

The fxsos diagrams show MOSFETs for the star LED and string blade diagrams, but nothing for the pixel blade diagram (homebrew, not DIYino). Here's the link for the diagram I'm talking about:
Homebrew Pixel Saber (FXSOS)

You are right, they don't show the FETs in that diagram. They are optional, but save you some power when the blade is off.

I'd worry more about your battery setup for right now. As JBKuma explained in more detail, that's likely your biggest issue. JBKuma is much more of an expert working with Neopixel than I am, so I would heed his advice. In fact, he was one of my key advisors when I was developing NP support for STREAM in the first place. If your battery is not up to the task then all kinds of strange things can happen.

Alright, well I tried pulling the protection circuits off the batteries, and it didn't change any of my symptoms. Can someone send me a link for a recommended battery?

gdadourian:
Alright, well I tried pulling the protection circuits off the batteries, and it didn't change any of my symptoms. Can someone send me a link for a recommended battery?

Either of these should work:
Opiton 1
Option 2

I bought an 18650 with a 20 Amp continuous discharge rating, and after it finally arrived, I tried it out (it was shipped discharged, so I charged it). I was met with the same errors as I was having before. Power up didn't make the pixels turn on the way they were supposed to, the blade stayed on after power down, and the saber lock feature caused the speaker to emit a long static sound until reset. Unless it's the actual wires I'm using for this breadboard connection that are limiting power, I don't know what else it could be.

This is pretty bizarre behavior.

Does your pixel blade work if you try to drive it with a simple test sketch? I'm trying to remove variables here. The software has been stable for months and this is the first time I've heard anything this severe happening.

I made a really simple library that will drive the pixels and not do anything else.

Download and install that library. Then the example sketch should be available from:

Examples-->NRPixelStrip-->NRPixelDemo

You should just be able to build and run it with no changes since it defaults to use Pin13 as the data pin and that's the same as for STREAM. The example just cycles through colors. See if that works for you. If that fails, then you've got wiring or hardware issues.

If the whole strip is supposed to shift in unison (pixel 1 changes to the same color as pixel 60 at the same time and rate - as well as all the pixels in between), then yes the pixel blade works fine.

Do you need a components list? I've cycled out the various components over time and had no luck. Again, my circuit is identical to the fx-saber-OS homebrew pixel blade set up.

The only thing I can think of that's been hurting me is the fact that I have arduino nano clones, and they run an old bootloader. I think I can convert them to a modern bootloader manually, but I was hoping it would work with the old one first.

gdadourian:
The only thing I can think of that's been hurting me is the fact that I have arduino nano clones, and they run an old bootloader. I think I can convert them to a modern bootloader manually, but I was hoping it would work with the old one first.

I've installed almost exclusively on clones with "old bootloaders" the very popular Brewboard by Saber Republic alone has seen several dozens of installs on clones.

You are the chosen one.