1
\$\begingroup\$

I feel like this is a bit of an unusual request so I'm having a hard time figuring out how to research it. My question is: is there some way that I can use an Arduino to programmatically generate a signal that very closely resembles the voltage generated when you hit a piezo? Here's some background as to why I want to be able to do that:

As a fun project while I have some time off I decided to try to connect my Alesis electronic drum kit to the video game Rock Band. There is an official solution for connecting a MIDI drum kit to the game, but unfortunately I'm playing on XBox One, where you need an adapter that was produced in extremely small quantities and is now ridiculously expensive. So then I started looking into how I might modify the stock drum controller to get an unofficial solution to the problem.

The drum triggers on the controller are extremely simple. It's just a piezo where the two wires coming off of it are connected directly to the main circuit board with a JST connector. Because there's already a connector there, that's the easiest point for me to connect my homebrew adapter. What I'd like to do is connect an Arduino to each of the JST connectors on the main controller board to allow me to trigger each drum pad programmatically. This would ultimately allow me to convert the MIDI signal from the e-kit into drum hits in-game.

The problem is, the spiky analog signal that's generated when you hit the piezo is very different from the clean digital output of an Arduino pin. The stock drum triggers have two wires: white and colored. As an initial test I tried just connecting the white wire from the JST connector on the controller board to ground on the Arduino and the colored wire to one of the digital outputs. I wrote a quick program that pulls that pin high for a few milliseconds and then pulls it low again, and to my amazement that actually worked to trigger a drum hit in the game!

I tried increasing the frequency of the hits though and quickly ran into a problem. The game is applying some kind of filtering to the signal that causes it to treat a very quick double pulse as a single hit. I can get up to about 10 hits/second with just a dumb 5v square wave, but trying to go faster than that causes it to drop hits like crazy. This makes sense because the piezo will generate a series of diminishing pulses when you hit it a single time so it has to filter that out somehow, but many songs in the game require faster hits than the ~10hz speed limit of my current solution. The stock drum pad has no problem registering hits faster than that so I know there's nothing wrong with the controller board itself. Because I don't have any way to identify the method of filtering they're using my best idea for how to proceed is just to try to reproduce the input signal generated by the piezo as closely as possible. I'm happy to acquire other electrical components but I don't have any ideas for what would let me generate the same kind of high-impedance alternating voltage that you get out of a piezo.

EDIT:

I took a picture of the piezo from the Rock Band stock kit. There are no identifying marks on it that I can see so I can't say exactly what type it is, other than it's one suitable for use as a vibration sensor.

the piezo from the stock Rock Band drum kit

\$\endgroup\$
11
  • 2
    \$\begingroup\$ Got an oscilloscope? \$\endgroup\$
    – bobflux
    Commented Dec 26, 2019 at 16:56
  • \$\begingroup\$ The piezo is probably generating more than 5V, and the detector circuit may be tuned to the piezo's ring-down frequency -- which is why you're being asked if you have an O-scope. \$\endgroup\$
    – TimWescott
    Commented Dec 26, 2019 at 17:09
  • 1
    \$\begingroup\$ There are piezo's of different types: (piezo audio buzzer, piezo barbeque lighter). Which type do you have? \$\endgroup\$
    – glen_geek
    Commented Dec 26, 2019 at 17:49
  • \$\begingroup\$ How do you know the Xbox reacts faster than 10Hz with real piezo sensor? It may be that the sound effect is non-retriggerable and has a 1/10th of a second sound effect or do you remember going faster? \$\endgroup\$
    – D.A.S.
    Commented Dec 26, 2019 at 19:13
  • \$\begingroup\$ Have you tried a square wave with a longer off than on time? A hit on a piezo may well just be producing a very narrow spike. If 50ms on 50off works, try dropping to 25on 50off, 10on 50off etc... Without setting the circuitry it's using, or exactly what the original piezo produces, the best you'll get is guesses... \$\endgroup\$ Commented Dec 26, 2019 at 20:39

1 Answer 1

1
\$\begingroup\$

This is not a complete answer to your original question, but I hope it'll help you make some progress.

I've done a similar project on the PS4 version of this peripheral. In that process, I've tried to reverse-engineer the piezo input-stage. You'll be able to find a circuit diagram as well as pictures of that circuit at How does this piezo input circuit work?. The answers and comments also explain the function of the various components, but do note that my original measurements of the capacitors were wrong, so the time constants in some of the responses are off.

I also captured a few waveforms of strikes on the trigger pads. You can have a look at them at https://gist.github.com/rafl/c1f08aadad87f96bc741237a8c46b30d. CH1 is the voltage of the piezo relative to the controller's ground as measured at the connectors you mention, and CH2 is the voltage at the output of the piezo input-stage, which is accessible with test points. The file names indicate the time base and sometimes some details about the hit. You can use sigrok to visualise the data.

For the basic four pads, I've been able to reliably trigger the game with square pulses of 1ms width, and and a hold-off period of 40ms between pulses to avoid accidental double-triggering. With the input being AC-coupled, I guess the amplitude of the pulses doesn't really matter, but I've used 3.3V as that turned out to be most convenient for the micro-controller I was using. The actual logic signal level of the controller is 2.8V.

For the 3 cymbal trigger inputs, I've been able to reliably trigger the game with square pulses of 25ms width, and a hold-off period of 40ms between pulses. I used 3.3V again. These inputs differ in that they have no input-stage comparable to the one discussed in the other StackExchange question mentioned earlier. They might contain that circuitry within the cymbals, or be constructed differently. I don't have a set, so I can't check.

For the kick trigger, I've been able to reliably trigger the game with square pulses of 60ms in width, and with a 50ms hold-off period. Same signal level. There's no AC-coupled input circuitry either. I'm not sure why this input needs pulses so much wider than all the others with my current approach. I haven't checked how quickly one would be able to re-trigger the original kick drum pedal in the game. I believe the original pedals use a reed switch, so perhaps that behaviour is intentional to account for some inherent bounce from that. I'm also not sure if perhaps the maximum frequency of repeated kick drum hits in the game might be lower than the maximum for some other pads so perhaps this doesn't matter.

I've also been triggering the other "standard" buttons in much the same way as the real drum triggers described above. 1ms pulses work well again, and it appears like latency from those inputs all the way to the game is lower than when using the other trigger inputs. If you don't care about cymbals, these might be a better way to go than the piezo inputs.

I also think that reliably re-triggering at 10Hz is probably good enough to enjoy the game. You can see what drumming at 20Hz looks like at https://www.youtube.com/watch?v=Q9FrW-Wr-ds, and I don't think there's a lot of passages anywhere near to half that speed on a single pad in the game.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.