Project: Marching quad drum lights- My 1st Arduino project!

Hello fellow nerds! This is my first post inn this forum, so please go easy on me if I've forgotten something. This is my first project into Arduino, so basic, workable solutions will go a long way.

I've tried to outline where my questions are in the text with (#'s), so they'll be easier to find.

As you can see from the subject line, I am making a portable, triggered drum light for each drum of my son's quad (4) drum kit for his marching band.

THE PERCEIVED GOAL:

When the drum is hit, I want the LED strands inside the drum to light up for a short period (some fraction of a second) before turning off. I want a different, distinguishable color for each of the four drums.

THE GRAND VIEW OF THE SETUP:

A piezo is mounted in contact with the drum head, and through some over-voltage regulating circuit,(1) sending an analog signal to the Arduino Due I'm using.

Once the signal is processed using a variant of the "Knock" script, the Arduino Due will then send a resultant output signal to a thyristor or 4 channel SSR relay, (2) that will then light up the LED strips, which vary in length. Ideally they will be in a different color for each drum, so individually addressable LEDs aren't necessary. I'm thinking white, red, blue, and green to keep things less complicated.

I plan to power the Arduino with a small battery setup, and the lights.

Since there are 4 standard quad drums, 10", 12", 13", and 14", the LED length for the circumference of each will be 80cm, 96cm, 103cm, and 112cm, approximmately. here will be a total of approximately 4m of them, split into those lengths. There's a possibility they could all be lit at once, but only momentarily.

I am planning on powering the lights- LED RGB Strip - Sealed (5m) - COM-12024 - SparkFun Electronics, with a computer backup battery, an SLA 12v 3.5A battery he'll carry on his harness. He'll have two switches, one to turn on the Arduino, and one to power up the battery to the lights.

Since I've never worked with an Arduino before and am learning most of what I think from Youtube and here, it's time to ask you guys, the experts before I dive in. The hardware, attaching lights, incorporating the sensor, making a case and wiring, those are skills I can manage. It's the electrical that I initially have an issue with and I'm hoping you can answer the q's before I go and buy the wrong parts.
(3)

THE QUESTIONS:

(1) I have read that the piezo can emit very high voltage. I've also read that the Due can only handle a max of 3.3v, so something has to limit that. Thus far, I've seen two methods to do that. One, using a crowbar circuit with a Zener diode at 3v, and another with a thyristor that only allows voltage up to 3v. Someon in the forum said the Zener has "weak knees", telling me that it could easily fail. Is there a better or best way to manage this input?

I wondered if there was a way to increase or decrease the sensitivity of the input using a potentiomoter on the input, as well. I have heard the piezo can be fiddly and over or undersensitive.

The piezo I'm planning on is this one: Piezo Vibration Sensor - Small Horizontal - SEN-09198 - SparkFun Electronics... looks sensitive, yet strong, like me.

(2) Is a thyristor or 4 channel SSR relay better for the lights emission? Never having worked with thyristors, I'm a tad wary about frying it all, and the SSR relay seems more... mechanical, even though I know it's not.

(3) I am sure someone else has done this project before, and I'm hoping you may share your advice with the me, the noob.

There is no mad rush on response, as I'm waiting for the necessary parts to arrive.

A piezo not only produces high voltages, it produces AC, so you need to take care of that as well.

Paul

I thought the Zener diode shut off the AC reverse flow, and only allow current to to flow in one direction?

Does that mean I have to have to make or buy some rectifier? Again, I'm a noob here. Thanks for the quick response already!

The first thing you need to do is to either measure the piezo voltage or find the specification for it that shows the voltage/vibration graph. Otherwise you are either guessing or working blind.

What does your reference source say about Zener diodes?

Paul

So I ordered the piezo above, and here's the datasheet for it: https://www.sparkfun.com/datasheets/Sensors/Flex/MiniSense_100.pdf

I'm not seeing what it's max output in voltage would be, not sure if that's even a thing.

In response to the Zener diode Q: this https://www.ebay.com/itm/1-2W-5-Watt-Zener-Diode-2V-47V-DO-35-DO35-10PC-USA/123792220755?ssPageName=STRK%3AMEBIDX%3AIT&var=424459215479&_trksid=p2057872.m2749.l2649

in the 3.3v diode is what I purchased.

Hope that helps.

The Zener will give you some "extra protection" but with the 3.3V Zener you are proportionally reducing the 0-5V ADC range (0-1023) to 0-3.3V (0-675). Still, you should get usable results. EDIT - I missed the "Due". :-[

The first thing you need to do is to either measure the piezo voltage or find the specification for it that shows the voltage/vibration graph. Otherwise you are either guessing or working blind

Well... Practically speaking, you can't measure the peak voltage without an oscilloscope and even then a drummer could easily strike the drum 20% harder or softer...

But you can run the [u]Analog Read Serial Example[/u] (but take-out the delay) to see what kind of readings you're getting. I'd say this is the most important first step. If you can watch the readings and see the drum hit, you're on your way and you'll know where to set your thresholds.

You are "sampling" the signal at a fairly-slow loop-rate (in relation to normal audio sample rates) so you won't always "catch" the exact peak voltage. (But your loop will run faster after get the needed information and remove the serialPrint() statements.)

I have to sign-off now, but I'll be back... (BTW - A thyristor/SCR/TRIAC won't work with DC.)


...I'm back!

(1) I have read that the piezo can emit very high voltage. I've also read that the Due can only handle a max of 3.3v, so something has to limit that. Thus far, I've seen two methods to do that. One, using a crowbar circuit with a Zener diode at 3v, and another with a thyristor that only allows voltage up to 3v. Someon in the forum said the Zener has "weak knees", telling me that it could easily fail. Is there a better or best way to manage this input?

The "knee" can allow the voltage to go slightly over 3.3V so there is a slight chance of damaging the Arduino but the Zener will be OK.

I don't know how the Thyristor protection circuit works. [u]Here are some protection circuits[/u].

BTW - I don't know if the chip used in the Due has those "little protection diodes", like the regular Arduino.

I wondered if there was a way to increase or decrease the sensitivity of the input using a potentiomoter on the input, as well. I have heard the piezo can be fiddly and over or undersensitive.

Let's get some measurements first... A pot won't increase the signal but it can attenuate it. If you use add a pot it should be about 1M. A low-value pot will attenuate the signal from a piezo sensor even when set to maximum.

A fixed resistor in parallel with the piezo can also attenuate the signal. i.e. Replace the 1M resistor from the Knock project with a lower value. Again, that's just something you can experiment with. You might end-up using a resistor and a pot to fine-tune the signal.

Note that attenuation isn't necessarily "protection" because he might hit the drum harder.

Also, you can adjust the threshold in software. I don't know much about the Due, but the regular Arduino has an optional-external ADC reference and you could use that with a pot to decrease re reference in order to increase the sensitivity.

When used as a microphone (picking-up sound waves from the air) a piezo puts-out a low signal (so does a regular microphone) but with a direct physical connection as a vibration sensor you'll get a better signal... Maybe that 90V... But there's just no way of knowing 'till you try it...

(2) Is a thyristor or 4 channel SSR relay better for the lights emission? Never having worked with thyristors, I'm a tad wary about frying it all, and the SSR relay seems more... mechanical, even though I know it's not.

Like I said, a thyristor won't work. Once turned-on they latch-on until current drops to zero. (A TRIAC works on AC because current drops to zero every half-cycle.)

A MOSFET is the "standard method", but I'm not sure if you can turn-on a MOSFET with only 3.3V. (A "standard" MOSFET requires more than 5V, but a "logic MOSFET" can be turned fully-on with 5V.) An SSR is "easier" as long as you have one that works with 3.3V control signal. There are SSRs that work that low. I used SSRs in a similar project because I wasn't super familiar with MOSFETs and it was just easier, requiring zero additional components. (If I was doing it again I'd probably use MOSFETs.)

Seattlearduino:
So I ordered the piezo above, and here's the datasheet for it: https://www.sparkfun.com/datasheets/Sensors/Flex/MiniSense_100.pdf

I'm not seeing what it's max output in voltage would be, not sure if that's even a thing.

Will this specification cause you a problem?

Upper Limiting Frequency (+3 dB) 42 Hz

Paul

Paul_KD7HB:
Will this specification cause you a problem?

Upper Limiting Frequency (+3 dB) 42 Hz

Paul

I don't think it will. Being in contact with the drumhead itself, it'll definitely register a hit. I watched this video on YouTube SUPER SLOW MOTION DRUMS - Adventure Drums! - YouTube, to see what the deviation would be with a stick hit, and I'm pretty darned certain it'll register.

@DVD: Thanks for the long reply... you were right about going public with the thought process.

I'm having trouble finding 3v SSR Relays for the lights, and wondering if I was silly for starting with the Due version. I think my reasoning was that I would need 8 inputs, with four two sensor wires coming in, and I read that the Due has more inputs than the standard Uno having 6 analog inputs.

Now it turns out I since I'm going to use the Zener diode protection for voltage control, its the "triggering" the lights on the back side of the circuit may be the issue. I bought a 4 channel SSR relay, but lookinig at it realized that it takes 5v to open them. Grr.

Since this is all in the theoretical for now, I'm planning on adding a pot to attenuate the signal from the piezo. It'll be cool to have a knob to play with, as well. I just got my starter kit of resistors in the mail today, there's like 300 of them in there! Woot woot!

As for adjusting the signal in the software, I checked what I could but didn't find info about an ADC on the Due. I don't physically have the Arduino yet.

So i found this 3v low input voltage , 4 channel SSR relay at Amazon: https://www.amazon.com/Channel-High-Low-Trigger-Arduino-Aug-26/dp/B07PXL555K?SubscriptionId=AKIAILSHYYTFIVPWUY6Q&tag=duckduckgo-d-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07PXL555K

and I think that'll be my winner in the meantime. That means my board will trip the relays, and the juice gets to the lights after all. I'm starting to get excited about the hardware, and soon dreading the software part.

Be really cool if you could tell how hard they were hit and attenuate the brightness accordingly. That way you could do a slow low drum roll and barely turn them on and then build them up as you go.

This could be a lot of fun. I'm in if there's going to be a video posted at the end.

Someon in the forum said the Zener has "weak knees", telling me that it could easily fail.

So pay attention to the current rating and give yourself lots of safety room. And when you're looking at them and one of them is really cheap and you think about all the money you could save... don't.

As for adjusting the signal in the software,

Adjusting the signal in software doesn't really gain you anything. (That would be done by multiplying by a factor greater than 1 for amplification or a factor less than one for attenuation.)

But, you' will have an if-statement that checks if the analog signal is greater than X, and you can change the value of "X" to adjust the sensitivity (within reason).

It may be easier to experiment, and work on some of your software development, using regular LEDs that you can drive directly from the Arduino. It's almost always a good idea to work on the input & output separately before putting everything together. Similarly, you may want to test your LEDs & SSRs with a variation of the Blink Example independently from the trigger-inputs.

And... This is something that you can play with, but you might want to add some "timing". You'll probably want to hold the LEDs on for a minimum of about 1/10th of a second (100ms) or longer. If the "flash" is too short it may not be seen, or it may be perceived as dim. 1/10th of second seems to be about right for your eyes to see full brightness (if that's what you want). It's easy to experiment with software changes like that once the hardware is working. Except, you can't use delay() or you'll miss some drum hits so you'll have to use the millis() timing method and that may require a bit of study before you understand how it works (and you'd obviously need 4 timers).

I checked what I could but didn't find info about an ADC on the Due.

I can't help with that at the moment because my Internet connection is barely working and I can't open the Arduino Due information page. Hopefully this little text message will get sent.

P.S.
The Due only has the default 3.3V ADC reference so you can't adjust the sensitivity by changing the reference.

But, the ADC is 12-bits which means 4096 steps between zero and 3.3V, allowing you to read down-to 0.8 millivolts. That should be plenty of sensitivity. (in reality, you'll have noise greater than that so you'll need a higher signal but I'm still saying plenty of sensitivity.)

Delta_G:
Be really cool if you could tell how hard they were hit and attenuate the brightness accordingly. That way you could do a slow low drum roll and barely turn them on and then build them up as you go.

This could be a lot of fun. I’m in if there’s going to be a video posted at the end.

I think that WOULD be cool! Right now I’m looking for a “max” output, and then based on the results will get fancier if it 1. all comes together, and 2. I can gradiate (if that’s a word) the input signal.

@DVD- I agree with your timing concept... if the drum hits come close enough that there's more than one every tenth of a second, it'd look weird. Better to have a light that just stays on in case the hits come too fast to keep up with at the sampling rate I choose.

I posted earlier on here that I found a premade product for this application and they have the sketch already. How about this for a rookie question... I could download the sketch from the web in zip format, but couldn't get that code into the IDE editor. I'm working from memory here, but one was a .pde format, and I'm pretty sure the other was an .ide format.

Here's the premade kit, there are various degrees of 'finished' on their site. Drum Kit - Kit [SPL-007001] - $18.95 : SpikenzieLabs, Great electronics kits

I posted earlier on here that I found a premade product for this application and they have the sketch already. How about this for a rookie question... I could download the sketch...

The hardware is probably OK but the software WRONG! It's for [u]MIDI[/u]. The drum kit sends a MIDI message to the computer (vial USB or a special MIDI interface) telling the computer which drum was hit and how hard, then it's up to the computer (with the appropriate software) to generate the drum sounds.

...I'm working from memory here, but one was a .pde format, and I'm pretty sure the other was an .ide format.

Weird... An Arduino sketch should be a .INO file but it's just a text file. The .PDE file was also a text file and I opened it with Notepad. It could be re-named or you can copy-and-paste from Notepad into the IDE but it's wrong anyway...

.pde was the extension used for Arduino sketches before version 1.0. Back in the old days they were not .ino files but .pde files.

BUMP Aww yeah... the parts are starting to arrive. Got the breadboard and Arduino, as well as some LEDs, jumper wires, and a power sourcing for the Arduino. Already can't wait to take it home and experiment a little with it! As the Zener diode and piezos arrive, I'll start to post pix of progress and start asking the harder questions...

Woo Hoo! I have all the necessary parts, plus some more.... I might have bought some s**t I didn't need. :slight_smile: Sorry for the verbosity, but I'd rather overdo the details than go back and forth.

So I am copied the code from sparkfun :

https://www.sparkfun.com/tutorials/330

It's pretty straightforward, and was recommended over the "knock" sketch, as apparently that sketch doesn't tolerate multiple inputs well.

I'm more testing my first foray into Arduino, so a small victory here would probably make me more excited to continue.

I downloaded the most recent drivers for the Arduino Due, loaded the sketch into the Arduinio IDE, and I'm getting this error message when I attempt uploading it to the Arduino:

"avrdude-stk500 get sync-not-in-sync"... so I'm not in sync, apparently, which is a little ironic since I'm doing drums So I looked at this page for solutions,

...but I checked all those as best as I could. I changed Preferences to "verbose output on upload"... didn't notice a difference.

Do you brainiacs have any advice?

I'm using a Windows 10 laptop, have the latest driver for the Due, 1.6.12, have a new USB cable, and the code compiled without error. Again, I'm not freestyling in the code, and it checked out in the IDE before upload. Thanks for any ideas on how to get the sketch onto the Arduino board.

Doing some Googlin' I found this:

I know this is an old post, but there is some voodoo-talk in the answers around here amongst good ideas, let's try to be a bit more real about what's happening and sum up the good stuff to check:
Basically, when that happens, it is a good idea to enable verbose mode for avrdude, to get a better idea of what's happening. To do so, you only need to go in the preferences and check the verbose mode box. It's also a good idea to move away from the arduino IDE, and launch a console to be more comfortable on reading avrdude's output, that you'll get on clicking on the upload button.
What's important here to put 3 or 4 -v to the command call. Here's how looks like such avrdude commands, with made up parameters as they are totally dependent on how the Arduino has been installed:
avrdude -v -v -v -v -C /path/to/avrdude.conf -patmega328 -P/dev/usbport -U flash:w:/path/to/firmware.hex
A good way to get the correct command line to use is to copy it from the verbose output of the Arduino IDE output log when verbosity has been enabled.
When you get avrdude: stk500_recv(): programmer is not responding, it basically means that something wrong is happening, before the flashing actually begins. Basically you have to check (from hardware to software, low level to high level):
if the cable and/or connectors does not have microcuts ;
if no solder points are short circuiting (i.e. touching something metallic around), that means:
if there is no short circuit on the PCB between Rx and Tx (usually pins 1 and 0) ;
if there is no contact with a metallic element below the board, or tiny bits between a component's legs (like the FTDI, the atmega chip or any other) ;
if the atmega chip is not out of power (GND/VCC shortcut or cut or VCC input being dead…) ;
if the 1 and 0 pins of the Arduino are not being used by some shield or custom design (/!\ does not apply to the leonardo as it has independent USB handling) ;
if the USB to UART converter does not have a problem (FTDI on older duemilanove or Atmega16U2 on newer Unos) ;
if the Atmega328 chip is fried or wrongly installed ;
if the bootloader has been overwritten or is failing ;
if the right baudrate is applied for entering the bootloader ;
if the right settings are set for the target MCU and Board

Okay, so maybe I am just talking to myself, but thought I’d share.

The SAM chip I’m using has a totally different bootloader setup. Erasing the chip via the erase button will erase everything, including any code you were using to run the USB connection.

I’m pretty sure I pressed that button. Why? Because I’m an idiot and noone told me not to. My options now look like either trying to program through the “native” USB , which is again new territory for me, or I’m going to try uploading the “Arduino as ISP.” sketch, and see if that works. Ifit doesn’t, i don’t have much use for a tiny brick. Grr.