Taiko-Nijiiro-Analog-IOBoard/README.md

92 lines
5.0 KiB
Markdown
Raw Permalink Normal View History

# Analog Taiko IO Board - ESP32 S3 DevkitC1
2023-12-22 03:22:52 +01:00
Open-source project to make your own Taiko no Tatsujin IO Board for PC use or SD cabs converted to Nijiiro.
It emulates an analog joystick to enable force sensing, just like how you would play on an official arcade machine.
2023-12-22 03:22:52 +01:00
2024-04-30 17:15:36 +02:00
![Taiko Drum Controller](Images/banner-taiko.png)
2016-10-12 12:05:46 +02:00
## Table of content
- [Analog Taiko IO Board - ESP32 S3 DevkitC1](#analog-taiko-io-board---esp32-s3-devkitc1)
- [Table of content](#table-of-content)
- [About this Project](#about-this-project)
- [Components needed](#components-needed)
- [Parameters tuning](#parameters-tuning)
- [Player Selection](#player-selection)
- [Sensitivity](#sensitivity)
- [Additional Notes](#additional-notes)
- [Why bridge rectifiers](#why-bridge-rectifiers)
- [TaikoArcadeLoader](#taikoarcadeloader)
2023-12-22 02:54:39 +01:00
## About this Project
2016-03-28 16:03:42 +02:00
This is a hard fork of [ShikyC's](https://github.com/ShikyC/Taiko-Drum-Controller-Arduino) taiko controller project with some QOL improvements.
It's aim is to provide accurate-enough arcade drum support for converted SD cabs or bootlegs running Taiko Nijiiro.
2024-04-30 17:15:36 +02:00
![Converted bootleg cab](Images/bootleg_cab.png)
2023-12-25 03:40:11 +01:00
**This program is for personal and non-commercial use only.**
2016-03-28 17:57:21 +02:00
## Components needed
2016-03-28 16:03:42 +02:00
* An [ESP32 S3 DevKitC-1](https://docs.espressif.com/projects/esp-idf/en/stable/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html) board.
* 4 [JST PH 2.0](https://fr.aliexpress.com/item/1005004067623293.html) connectors (i'm using 90° ones but straight ones work too).
* 4 [1206 LEDs](https://fr.aliexpress.com/item/1005005975741298.html) (2 Blue and 2 Red).
* 8 1206 100kΩ resistors.
* 4 bridge rectifier chips. This project uses [DB107S](https://www.rectron.com/public/product_datasheets/db101s-db107s.pdf) (see the Additional Notes section for details).
* 4 10k variable resistors. This project uses [3362P-1-103](https://www.mouser.fr/datasheet/2/54/3362-776956.pdf)
2016-03-28 16:03:42 +02:00
All of those parts can be found for next to nothing on aliexpress.
2023-12-25 03:40:11 +01:00
2024-04-30 17:15:36 +02:00
You'll also need an IO Board PCB (you can find the gerber files in [here](PCB/Export/)).
I've used [JLCPCB](https://jlcpcb.com/) to order mine.
2016-03-28 16:03:42 +02:00
## Parameters tuning
2016-03-28 16:03:42 +02:00
2024-04-30 17:15:36 +02:00
All the parameters are located in [params.h](Firmware/params.h).
2016-03-28 17:57:21 +02:00
### Player Selection
2016-03-28 17:57:21 +02:00
By setting `#define PLAYER_SELECT` to either `1` or `2`, you can set what player the board will act as. If you're using two of these, make sure that they each are set to a different player to avoid issues.
2016-03-28 17:57:21 +02:00
The buildin led of the ESP32 S3 DevKitC1 will be either red or blue depending on that value !
2016-03-28 16:03:42 +02:00
### Sensitivity
2023-12-25 03:40:11 +01:00
Not all piezoelectric sensors are the same, and thus the captured signals from the 4 sensors may vary significantly. The sensitivity adjust trims are used to normalize those differences.
2023-12-25 03:40:11 +01:00
To facilitate setting those trims up, set `DEBUG` to `1`, flash the firmware, roll on one of the 4 areas of the drum, and visualize the graph from the output of the Serial Plotter.
2023-12-25 03:40:11 +01:00
In the following example, the right-don area generates a much higher value than other 3, so you can adjust the `sensitivity` by turning the R_DON potentiometer to eliminate the issue.
2023-12-25 03:40:11 +01:00
2024-04-30 17:15:36 +02:00
![Setting sensitivity values](Images/tune_sensitivities.png)
2024-01-05 05:47:25 +01:00
Note that the installation of the sensors is critical. You should make sure that the sensors are firmly attached on the wood and located properly, as seen on the picture below.
2024-01-05 05:47:25 +01:00
2024-04-30 17:15:36 +02:00
![Piezo locations](Images/piezo_locations.png)
2024-01-05 05:47:25 +01:00
## Additional Notes
2024-01-05 05:47:25 +01:00
### Why bridge rectifiers
2024-01-05 05:47:25 +01:00
Without biasing the voltage of the piezoelectric sensors, their output voltage range is about -5V to +5V. However, the ESP32 ADCs only accept positive voltage values from 0 to 3.3V. When they receive a negative voltage, it's simply truncated to 0.
2024-01-05 05:47:25 +01:00
In a taiko drum, all the 4 vibrating pieces are connected together, meaning that if you hit left-don, the processor also receives signals from left-kat, right-don, and right-kat. If the left-don piezoelectric sensor generates a negative voltage at the beginning and is truncated by the ADC, it will cause a minor "delay" of about 3 to 4 milliseconds, and the processor could incorrectly treat this hit as a right-don, a left-kat, or even a right-kat, whichever sends a highest positive value.
2024-01-05 05:47:25 +01:00
Using a bridge rectifier, all negative values are converted to positive. In other words, it's acting like a mathematical `abs()` function, ensuring that we don't miss any negative voltages.
2024-01-05 05:47:25 +01:00
2024-04-30 17:15:36 +02:00
![Why using bridge rectifiers](Images/bridge_signal.png)
2024-01-05 05:47:25 +01:00
### TaikoArcadeLoader
2024-01-05 05:47:25 +01:00
You'll need to use a recent version of esuo1198's fork of [TaikoArcadeLoader](https://github.com/esuo1198/TaikoArcadeLoader) (Commit [945e104](https://github.com/esuo1198/TaikoArcadeLoader/commit/945e104) and up).
2024-01-05 05:47:25 +01:00
Open `config.toml` and enable analog input like so :
2024-01-05 05:47:25 +01:00
```toml
[controller]
analog = true
```
2024-01-05 05:47:25 +01:00
If the IO Board is detected but your game doesn't register any inputs, check in `gamecontrollerdb.txt` that you have the following entry under `#Windows`:
2024-01-05 05:47:25 +01:00
`030052a8694800006948000000000000,Nijiiro Analog IO Board,-leftx:-a0,+leftx:+a0,-lefty:-a1,+lefty:+a1,-rightx:-a2,+rightx:+a2,-righty:-a3,+righty:+a3,platform:Windows,`