Piezoelectric Sensor to Arduino to LED strip and audio out

Thread Starter

Sean Radke

Joined Sep 2, 2019
3
Hello!



I am a high schooler looking for some assistance with my project!

I have a prototype I'm building for a school project! I like to call it the Hurricane. It is 14 Roland PD-8 Drum Pads, which are pretty much practice drum pads with a piezoelectric sensor in it. If anyone reading this doesn't know what a piezoelectric sensor is, it just creates a small amount of voltage whenever it gets hit or tapped, the Arduino can read this signal in an analog port. Continuing on, these drum pads are mounted in a half hexagonal orientation ish around me about 2.5 feet in the air. Underneath them is an led screen made with neopixel led strips. Each drum pad has one set of neopixel led strips it controls. I have figured out and wired to an Arduino Mega the drum pad with a 6.5mm aux cable to a breadboard and led strip. I found code online that makes it so that when I hit the drum pad it creates a small strip of light that runs through the rest of the strip. The second part of the project though is making an audio file work with it. The idea is that when I hit a drum pad, the Arduino or a second Arduino recognizes I hit the pad with the signal given off by the pad and then plays an audio file. The complicated part is that I would like it to then afterward switch to the "next" audio file so that I could per say hit one pad and it makes one sound (for example: pshhhh) and then the next time I hit it, it would make a different sound (For example: pahhhh).... I have no idea how to really do this part of it, and I have almost no coding experience.

Sorry for the long paragraph!

So to summarize, I really need help with getting an Arduino to recognize a signal from a piezoelectric sensor, play an audio file, go to the next audio file, and play that file when I hit it, and repeat for as many times as I can.

And if possible, could I borrow the code from someone.... as far as I understand this may not be too hard to code from my experience on one of those basic block by block programming software, I just can't code it in Arduino.



I believe it would go like this maybe...

If signal received from pin (A0)

Play Track (1)

Move to next track

Repeat / Loop





In the end, this should be able to make a song with different sounds running on all 14 drum pads...

To clarify any questions before asking, I have up to 28 Arduino Megas that I can use, 2 per drum, 1 for the led strip and 1 for the audio file, if needed.

Any help I can get would be amazing guys! Thanks so much!!!!

If you have any questions I am happy to answer them on the current progress of this project! Any help would be appreciated!!!!
 

be80be

Joined Jul 5, 2008
1,928
piezoelectric sensor Can put out a lot of volts more then enough to kill your uno if not hooked up right.
https://programmingelectronics.com/how-to-make-a-secret-knock-detector-to-trigger-anything-with-only-an-arduino-and-a-few-cheap-components/

This is a really simple circuit to setup, below are step-by-step instructions and a breadboard diagram.

  1. Place the piezo transducer on the breadboard, with the positive lead and the negative lead on separate rails.
  2. Connect the positive lead to pin A0 on the Arduino and the other lead to ground.
  3. Finally, use the 1Mohm resistor to connect the leads of the piezo transducer.
  4. As an additional level of protection, you might consider adding a 5.1V zener diode between the leads to protect against high voltage spikes from frying your input pin – you might call it a cheap insurance policy.
 

danadak

Joined Mar 10, 2018
3,573
Is the sound to be played a short, secs long, wave file or a complete song ?

My instincts would be to use a PSOC 5LP for the following reasons -

1) It has a DAC onboard to generate audio out
2) It has a high G front end to its A/D to use in detecting drum hit
3) It has a DSP Filter that can aid in eliminating other extraneous noise from drum hit
and environment, to eliminate false triggers.
4) It has SDCARD read capability to retrieve short sounds from a library of short sounds
5) It has DMA to handle the streaming of the wave file to the DAC

To name a few.

But its a non trivial coding exercise. Not rocket science as all HW has a library
of APIs to control the respective HW internal unit like DAC, A/D, DMA....but
not a merry-go-round 5 minute code ride either.

As an alternative might be to get a bunch of cheap MP3 players to hold each
of the sounds and hack the play buttons. That then leaves you free to manage
the rest of the system. You might edit the sounds to burst a tone at end of play
to signal the host all done. For control purposes. You could use an OpAmp
filter to handle the false trigger noise environment problem.....


Regards, Dana.
 

Thread Starter

Sean Radke

Joined Sep 2, 2019
3
Is the sound to be played a short, secs long, wave file or a complete song ?

My instincts would be to use a PSOC 5LP for the following reasons -

1) It has a DAC onboard to generate audio out
2) It has a high G front end to its A/D to use in detecting drum hit
3) It has a DSP Filter that can aid in eliminating other extraneous noise from drum hit
and environment, to eliminate false triggers.
4) It has SDCARD read capability to retrieve short sounds from a library of short sounds
5) It has DMA to handle the streaming of the wave file to the DAC

To name a few.

But its a non trivial coding exercise. Not rocket science as all HW has a library
of APIs to control the respective HW internal unit like DAC, A/D, DMA....but
not a merry-go-round 5 minute code ride either.

As an alternative might be to get a bunch of cheap MP3 players to hold each
of the sounds and hack the play buttons. That then leaves you free to manage
the rest of the system. You might edit the sounds to burst a tone at end of play
to signal the host all done. For control purposes. You could use an OpAmp
filter to handle the false trigger noise environment problem.....


Regards, Dana.

Thanks for the reply Dana! The file will be at the most 2 seconds long each... most likely half a second normally.... Most of what ya said there kinda went past my head but I will do some research and see what you are talking about.. thanks!
 
Top