Mandalorian Mercs Costume Club

Mandalorian Armor => Equipment & Accessories => Electronics => Topic started by: Celtkhan on Dec 08, 2020, 05:59 PM

Title: Blaster sound/light tutorials?
Post by: Celtkhan on Dec 08, 2020, 05:59 PM
Iím looking for some tutorials on adding sounds and lights to a blaster, but a lot of what Iím finding is out of date or has a bunch of extras I donít need. The most recent article I can find is on the Adafruit site for Lucioís blaster, but it has an accelerometer for secondary sound effects I donít need. Whitearmor has an E11 blaster sound tutorial using an Arduino, but itís nearly a decade old.

Iíd like to set up a blaster to fire sounds and light up an LED on a trigger pull, a secondary button to switch between lethal and stun settings, and preferably, an ďammo counterĒ LED bar that depletes as itís fired.

Iím mostly looking for advice on which modules would be most cost-effective (Arduino, Adafruit, Featherwing?) and where I can find code tutorials to figure out the programming commands myself?
Title: Re: Blaster sound/light tutorials?
Post by: LightningLion on Dec 09, 2020, 04:54 AM
Take a look at this Facebook group:

FX Blaster Arduino (https://www.facebook.com/groups/fxblaster)
Title: Re: Blaster sound/light tutorials?
Post by: Celtkhan on Dec 09, 2020, 01:25 PM
Alas, my hatred of Facebook is immeasurable. Iíd rather fail entirely than give it a single scrap of information about myself. Even false information.

I do appreciate the effort, though.
Title: Re: Blaster sound/light tutorials?
Post by: Jarek Tahl-Tracyn on Dec 10, 2020, 03:27 AM
20 seconds on a common search engine, looking for "arduino blaster sound", gave several interesting results, with from sites related to storm troopers to the arduino build forums.

For example
https://www.whitearmor.net/forum/topic/19322-arduino-a-cheap-board-for-e11-blaster-effects/

https://forum.arduino.cc/index.php?topic=109432.0

(Both are build logs from the same project.)

Feel free to give it a try.  :D
Title: Re: Blaster sound/light tutorials?
Post by: rlobrecht on Dec 10, 2020, 10:12 AM
Take a look at the Blaster Core (http://www.plecterlabs.com/shop/product_info.php?products_id=69) by Plecter Labs.
Title: Re: Blaster sound/light tutorials?
Post by: Celtkhan on Dec 17, 2020, 09:11 PM
I've been looking at Adafruit boards for sound and light, but I've hit a bit of a snag.

My idea is this: I want code to play a blaster sound WAV file and light up a barrel LED on triggerpull, which is pretty straightforward. I was also hoping to have a bar LED graph to function as an ammo counter, and that's where my issue is coming in. I can declare a couple variables, one to function as an ammo counter, and one to function as a timer. I like the idea of an auto-recharge function, so the ammo recharges one round every ~6 seconds or so. I'd also like the highest LED on the bar graph to blink once per second until the ammo has fully recharged.

The problem I've encountered is that CircuitPython (apparently) only has "time.sleep" as its time-regulation function, and you have to use that function to regulate how fast the ammo counter increments and how fast the LED blinks. I've figured out that portion of the code, but having a one-second wait during each code cycle prevents the board from playing the blaster sound/light unless you hold the trigger down for up to a second. I'd rather have it be a bit more responsive than that, so I'm hoping someone knows another way to increment a timer in CircuitPy (or Arduino, I'm willing to learn that one, too) without interfering with a more responsive blaster sound effect.

Help?
Title: Re: Blaster sound/light tutorials?
Post by: Fi-8015 on Dec 18, 2020, 03:08 AM
I think that sounds like
Code: [Select]
delay(); in Arduino. That way you pause the code for the given milliseconds. If you want to have multiple tasks running parallel, you have to link them to
Code: [Select]
millis();, which returns a value, counting the time the code is running.

At least that's, what I know.
I have no experience with CircuitPython though.
Title: Re: Blaster sound/light tutorials?
Post by: Celtkhan on Dec 18, 2020, 02:11 PM
I think that sounds like
Code: [Select]
delay(); in Arduino. That way you pause the code for the given milliseconds. If you want to have multiple tasks running parallel, you have to link them to
Code: [Select]
millis();, which returns a value, counting the time the code is running.

Looks like ďdelay()Ē is the same as ďtime.sleep()Ē and ďmillis()Ē is the same as ďtime.monotonic()Ē. Thanks, that was exactly what I needed; I ran into a tutorial for non-blocking timers in Arduino that I can directly translate into Circuitpy. Itíll take some fiddling and testing, but I think I can get exactly what I wanted now.
Title: Re: Blaster sound/light tutorials?
Post by: Vorpal on Dec 23, 2020, 02:28 PM
I have looked into these. They are cheap, easy to use and if wired right can run a led for the blaster effect.

WT588C re programmable electronic music sound chip

https://www.instructables.com/Getting-the-Most-Out-of-a-WT588D-Sound-Module/  (https://www.instructables.com/Getting-the-Most-Out-of-a-WT588D-Sound-Module/)
Title: Re: Blaster sound/light tutorials?
Post by: Celtkhan on Dec 26, 2020, 10:59 PM
I actually learned just enough CircuitPython to do what I want, and I am exceptionally pleased with the result. I haven’t soldered all the LEDs in place or the selector switch, but if it does work the way I’ve designed it, then the code should do the following:

At full charge, the blaster has 30 rounds. (Tested and confirmed).
Each trigger pull on the Lethal setting plays the blaster sound effect in Mp3 format, lights a red LED in the barrel, and decrements the ammo counter by 1. (Tested and confirmed)
Each trigger pull on the Stun setting plays the Stun sound effect, lights a red LED in the barrel, and decrements the ammo counter by 3. (Not yet tested; I wanted to differentiate the Stun setting function, so decided it consumes 3 charges instead of 1).
Ammo is represented by a bar graph LED with 10 bars; each bar represents 3 rounds. When a particular bar’s complement of rounds is recharging, it blinks. When the full complement is charged, it shines solid. (Not yet tested).
1 round recharges for every 6 seconds that the trigger is not pulled (tested and confirmed).
A momentary selector switch will transition between Lethal and Stun settings. When Stun is active, an LED will light up.
A power LED shines solid when the battery pack is showing a good charge. As the voltage drops, it will begin flashing and then go dark.

I’m hoping to run a full test tomorrow. I’ll be more than happy to share the code if anyone is interested.
Title: Re: Blaster sound/light tutorials?
Post by: brizzlebot on Jan 16, 2021, 02:56 PM
I started working on that FX blaster project mentioned...

Depending on how much you want it to do, even just using an arduino and a dfplayer mini and a low powered LED could get the job done.

The hardest part so far has been trying to fit everything into my blaster build...

While that TK8177 blaster project is complicated, it is quite louder with the stereo sound.  If (when!) I make another blaster, I would probably stick to justusing a round 28mm speaker and appropriate length of pipe as a resonance  chamber to increase volume.  The RGB LED is something else altogether, but adds another level to stun setting with blue LED, or green.


I do think the code could be cleaned up a bit, and have noticed that the library used for the player is an outdated version. I'm procrastinating doing the soldering before I get all components onto a breadboard...  I'll try to remember to update with how it goes.
Title: Re: Blaster sound/light tutorials?
Post by: Celtkhan on Jan 16, 2021, 05:35 PM
Iíd love to see it.

Iím hoping to finish up mine soon; Iím installing the switches and LEDs in the control plate now. The body of the blaster still needs work, and I actually regret installing the headers because it adds so much volume on the Z axis; if Iíd just soldered the connections directly to the board, Iíd only have to deal with the X and Y axis dimensions. Plus I could have mounted the audio boards separately. Now I have to make sure thereís enough volume for the duplex prototyping board, the headers, AND the wiring in the electronics chamber. Since Iím using a 10-LED bar graph, itís a lot of wires.
Title: Re: Blaster sound/light tutorials?
Post by: nashandra on Feb 25, 2021, 05:39 AM
Lol, the idea is really cool and a like it. I guess you can find everything on youtube but I don't know what to say about the quality of the sound. Because when you download the sound, the quality can lower and it will not be that cool as you expected. The best idea is to download the sound from a specialized platform like https://depositphotos.com/music.html (https://depositphotos.com/music.html) and the quality will be the best of the best. I also used sound for a few toys and sometimes it seems like they are real because of the sound.