FeralAI / GP2040

Gamepad firmware for Raspberry Pi Pico and other RP2040 microcontrollers supporting Nintendo Switch, XInput and DirectInput
https://gp2040.info
MIT License
558 stars 124 forks source link

Converting piezo sensor analog inputs into digital outputs for Taito no Tatsujin drum controller #51

Open pizzacatz opened 2 years ago

pizzacatz commented 2 years ago

So I'm looking into Taiko no Tatsujin (Drum Master game) after the PC/Xbox announcement, and I'm wondering, is there a way to convert analog piezo inputs to work with the GP2040?

Here are two existing arduino codes.

https://github.com/LuiCat/ArduinoTaikoController https://github.com/ShikyC/Sanro-Arduino

The problem with the first one is that it doesn't register simultaneous hits, only one at a time. The problem with the second one is that it uses microphones instead of piezo sensors. And the ultimate problem with both is that they emulate computer keyboards, not game controllers.

It'd be amazing to be able to build a diy tatacon that works with X-input(PC)/PS3/Switch/PS4(with converter).

tobiasbp commented 2 years ago

Hello @pizzacatz

I'm currently working on a board for that exact purpose (Piezo input to digital) for games like Taiko no Tatsujin and Rock Band etc. The 1st project you linked to constantly polls the pins with the piezos attached. That is a problem, since lag would be introduced (To some degree).

What I am working on, is a board that would convert the signal from the piezos (Like commercial e-drums) to a digital signal. Having done that, the controller software (Like GP2040) would be able to trigger on interrupts, so lag can be minimized.

What kind of drums were you thinking of as using for inputs? I have Yamaha e-drums that I would like to use, but I'm also playing around with a design for a Taiko no Tatsujin controller.

Let me know if you would like to be involved (In any way). It would be much more fun, if I was not doing it alone without feedback.

Regards, Tobias

pizzacatz commented 2 years ago

Hello @tobiasbp,

Thank you for sharing your findings with me. I didn't know that the first project would introduce lag, so I will have to continue my research. My current idea is to use 4 separate Arduinos that each simulate a pushbutton using a transistor. I do not have electrical engineering or circuitry experience, so I will continue my research.

Currently, I am thinking of a segmented design like this that would use a piezo on each segment. I believe this is how the commercially available Tatacons are designed.

I do not have a programming background, but I would love to be involved in your project!

Best, pizzacatz

tobiasbp commented 2 years ago

My current idea is to use 4 separate Arduinos that each simulate a pushbutton using a transistor.

You don't need that at all. You just need Pi Pico loaded with GP2040 (Or an Arduino set up as a USB device), and some circuitry to create a digital signal from the piezos (The project I'm working on).

Currently, I am thinking of a segmented design like this that would use a piezo on each segment. I believe this is how the commercially available Tatacons are designed.

I don't think they use piezos. I'm pretty sure the use a sandwiched design like the soft DDR pads. You can see the tatacon being modded here.

I do not have a programming background, but I would love to be involved in your project!

Sounds good. It would be nice with some moral support. I'll create a repository for the project, and we can continue creating a board that could be used to feed RP2040 (Or any other controller) with digital inputs from piezos.

guyman70718 commented 2 years ago

You don't need that at all. You just need Pi Pico loaded with GP2040 (Or an Arduino set up as a USB device), and some circuitry to create a digital signal from the piezos (The project I'm working on).

I am trying to do something similar to OP, but I am using an existing PS2 taiko drum. The PS2 taiko drum uses a resistive array. I currently have each section of the drum connected to a resistor divider, and the middle going into the pi pico analog input. Using the pi, I can read the analog inputs and detect the hits of the drum. I was planning to use circuitpython and the adafruit keyboard library for sending the hits to the computer, but it seems the library is not fast enough because although I can print a message when the drum is hit, the keystrokes aren't sent fast enough and only about a quarter of the hits are actually sent as keyboard messages.

Would your project be required for this too? I'm ok with some input lag sacrificed for similicity as long as its under about 10ms