diff --git a/NOTES.md b/NOTES.md index 6d1ac42..c3ea4d7 100644 --- a/NOTES.md +++ b/NOTES.md @@ -1,11 +1,3 @@ -I did some performance testing. - -The Pro Micro runs an Atmel 32u4 at 8MHz. -If the code does nothing else, -I was able to poll all pins around 13 times every 1ms, -or 13kHz. - - Sample Rate ----------- @@ -39,6 +31,10 @@ I settled on a 40ms silence window as feeling pretty good. You can adjust this if you want to. + +USB Junk +======== + Gamepad Buttons --------------- @@ -46,28 +42,38 @@ The `buttons` struct member is a bitmap, each bit mapping to one of the 12 buttons reported through HID. Here's what each bit means: -* 0: Blue -* 1: Green -* 2: Red -* 3: Yellow -* 4: Orange -* 5: Tilt Switch / 2x kick -* 6: Solo modifier (second row of buttons on guitar) -* 7: ? -* 8: Minus -* 9: Plus -* 10: Drum pad modifier? -* 11: Cymbal modifier? -* 12: ? +* 0o00: Blue +* 0o01: Green +* 0o02: Red +* 0o03: Yellow +* 0o04: Orange +* 0o05: Tilt Switch / 2x kick +* 0o06: Solo modifier (second row of buttons on guitar) +* 0o07: ??? +* 0o10: Minus +* 0o11: Plus +* 0o12: Drum pad modifier +* 0o13: Cymbal modifier +* 0o14: Select hatAndConstant -------------- -I don't get this, but here's what the values mean: +Here's what the values mean: * 2: right * 6: left * 0: up * 4: down * 8: nothing + + +velocity +-------- + +I don't know how I can verify that I'm setting this right, +but the `rbdrum2midi` program looks at these bytes to detect hits. +I set them to 127 when a hit is detected on the digital pin. + +Sending these values does not seem to cause problems with my Wii games. \ No newline at end of file diff --git a/README.md b/README.md index f7dbce6..d9a48be 100644 --- a/README.md +++ b/README.md @@ -16,39 +16,154 @@ which are very quick! * A physical controller -## Sample controllers +# Controllers -I used the following: +## Guitar -* [MiniCaster](https://www.printables.com/model/479046-minicaster-mini-clone-heromidi-controller) - by Vlad the Inhaler: - it comes with full build instructions. +I 3D printed the +[MiniCaster](https://www.printables.com/model/479046-minicaster-mini-clone-heromidi-controller) +by Vlad the Inhaler. +It comes with full build instructions. -* [Cheap children's drum toy](https://www.amazon.com/Electronic-Sboet-Practice-Headphone-Christmas/dp/B0CHJMYCH9/), - each pad is a momentary switch. +## Drums + +I bought a [Cheap children's drum toy](https://www.amazon.com/Electronic-Sboet-Practice-Headphone-Christmas/dp/B0CHJMYCH9/) +from Amazon. +There are dozens of copies of this thing, +the one I got was on sale for $25. + +I had to unscrew the cover and remove the +logic board, battery, and speaker. +The pads were connected with +a sort of ribbon connector, +which I desoldered and removed, +then placed in my own perma-proto board. + +I also hooked up a 3.5mm TRS jack for the two pedals, +which I could have desoldered from the toy +(I already had these). + +I'm sorry I didn't photograph or record any of this, +but it was pretty straightforward. + + +# Compiling + +This compiles in the Arduino IDE. +It doesn't have any library dependencies. + +You need to make two edits to `boards.txt`. +Instructions for this are all over the place. + +Find your board, and edit the `build` lines. +Don't edit anything that doesn't say `build` on the line! I can't help you if you do this. + +In my examples, I'm editing the lines for the leonardo build. Yours might be different: +it should match the board you're using. + +## Build flags + +This disables serial communications on the board. + + leonardo.build.extra_flags={build.usb_flags} -DCDC_DISABLED + +Hat tip to Nicholas Angle for figuring this out +so I didn't have to. + +## VID and PID + +These set the USB identifiers. +VID is the Vendor ID, +and PID is the Product ID. + +`0x1bad` means "Harmonix Music", +at least, it does to the Linux kernel. + +### For guitar + +PID `0x004` means "Guitar controller". + + leonardo.build.vid=0x1bad + leonardo.build.pid=0x0004 + leonardo.build.usb_product="Mockband Guitar" + + +### For drums + +PID `0x3110` means "Rock Band 2 drums". +This works better with all versions of Rock Band on my wii, +even if you don't use the cymbal inputs. + + leonardo.build.vid=0x1bad + leonardo.build.pid=0x3110 + leonardo.build.usb_product="Mockband Drums" # Wiring -![see standard.hh for pin connections](wii-rb-std.png) +Both the guitar and drum kit I used +provide simple momentary switches: +nothing fancy like a piezo. +If you're using fancier types of inputs, +you'll need to modify the source code. + +## Guitar + +![guitar wiring](guitar.png) + +| silkscreen pin name | description | +| --- | --- | +| TX0 | strum up | +| RX1 | strum down | +| 2 | tilt switch | +| 3 | green | +| 4 | red | +| 5 | yellow | +| 6 | blue | +| 7 | orange | +| 8 | no connection | +| 9 | wammy bar (see note) | +| 10 | plus | +| 16 | minus | +| 14 | orange solo | +| 15 | blue solo | +| 18 | yello solo | +| 19 | red solo | +| 20 | green solo | +| 21 | no connection | + +The solo buttons and wammy bar are optional. +I don't use them. + +If you hook up a wammy bar, +be sure to uncomment the `#define WAMMY` +in the code! ## Drum Kit -On the drum kit, +![drum wiring](drums.png) -* Orange: kick pedal -* Solo Buttons: cymbals -* Red Solo: high hat -* Tilt: 2x kick - -I think. I haven't been able to test this yet, -but the Clone Hero wiki leads me to believe this is how it works. - -You can hook up a wammy bar for the drum kit, -and it will be sent the same way as the guitar. -I don't know why anyone would want this, -but I'm not going to tell you how to live your life. +| silkscreen pin name | description | +| --- | --- | +| TX0 | no connection | +| RX1 | no connection | +| 2 | 2x kick | +| 3 | green | +| 4 | red | +| 5 | yellow | +| 6 | blue | +| 7 | kick | +| 8 | no connection | +| 9 | no connection | +| 10 | plus | +| 16 | minus | +| 14 | no connection | +| 15 | blue cymbal | +| 18 | yellow cymbal | +| 19 | hi hat pedal | +| 20 | green cymbal | +| 21 | no connection | # Bugs / Not Yet Implemented @@ -61,3 +176,9 @@ Until that happens, just [email me](mailto:neale@woozle.org), and I'll open an issue. + + +# Need help? + +[Email me](mailto:neale@woozle.org), +I'm friendly :) diff --git a/drums.png b/drums.png new file mode 100644 index 0000000..aadd10b Binary files /dev/null and b/drums.png differ diff --git a/wii-rb-std.png b/guitar.png similarity index 84% rename from wii-rb-std.png rename to guitar.png index c51cf67..112e1dc 100644 Binary files a/wii-rb-std.png and b/guitar.png differ