Skip to content

Commit 85d0f9f

Browse files
authored
Merge pull request #632 from CoffeeCoder1/dawpad
Add DawPad
2 parents f5f1a0b + bb38480 commit 85d0f9f

File tree

23 files changed

+157176
-0
lines changed

23 files changed

+157176
-0
lines changed

.gitmodules

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212
path = hackpads/Ambrylight/firmware
1313
url = https://github.com/pmnlla/zmk-board-cfg
1414
branch = ambrylight
15+
[submodule "hackpads/bongopad/pcb/KiCad-SSD1306-128x64"]
16+
path = hackpads/bongopad/pcb/KiCad-SSD1306-128x64
17+
url = https://github.com/pforrmi/KiCad-SSD1306-128x64
18+
[submodule "hackpads/dawpad/pcb/libraries/MX_V2"]
19+
path = hackpads/dawpad/pcb/libraries/MX_V2
20+
url = https://github.com/ai03-2725/MX_V2
21+
[submodule "hackpads/dawpad/pcb/libraries/OPL_Kicad_Library"]
22+
path = hackpads/dawpad/pcb/libraries/OPL_Kicad_Library
23+
url = https://github.com/Seeed-Studio/OPL_Kicad_Library.git
24+
[submodule "hackpads/tabbyhack_k4/pcb/libraries/MX_V2"]
25+
path = hackpads/tabbyhack_k4/pcb/libraries/MX_V2
26+
url = https://github.com/ai03-2725/MX_V2
27+
[submodule "hackpads/tabbyhack_k4/pcb/libraries/OPL_Kicad_Library"]
28+
path = hackpads/tabbyhack_k4/pcb/libraries/OPL_Kicad_Library
29+
url = https://github.com/Seeed-Studio/OPL_Kicad_Library
1530
[submodule "hackpads/n16-remote"]
1631
path = hackpads/n16-remote
1732
url = https://github.com/DJ-Laser/n16-remot

hackpads/dawpad/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
StenoPad-backups
2+
*.lck

hackpads/dawpad/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# DawPad
2+
3+
![PCB Render](https://github.com/user-attachments/assets/7b59db36-3e2d-4628-bedd-b27dfa3b1bc2)
4+
5+
This is a small MIDI controller designed to make it a bit easier to control a DAW. It won't really do anything on its own, but with a good input map it will be a nice extenison of the DAW interface (I can see it being used as a controller for a few audio channels - the knobs could be used for gains, and the buttons could be channel parameters like mute, as well as a couple other things like playback controls).
6+
7+
## PCB
8+
9+
I'm pretty happy with how the PCB turned out for this. This is the first PCB that I'm actually getting made, and it's also the most complicated one that I've designed by far. I tried to keep things pretty neat, and I managed to keep everything reasonably compact while still keeping pretty much everything I could through-hole, which I'm much more comfortable with soldering.
10+
11+
![PCB Schematic](https://github.com/user-attachments/assets/5df3af07-ee74-4963-803d-1f5e063a1c76)
12+
13+
![PCB Layout](https://github.com/user-attachments/assets/08c3af90-4070-4fa1-94d4-e2376163b0e2)
14+
15+
## Firmware
16+
17+
The firmware for the DawPad is built in Arduino, using the [Control-Surface](https://tttapa.github.io/Control-Surface/Doxygen/index.html) library for MIDI functionality. At the moment, it likely doesn't really work at all, but a lot of the (likely) broken stuff is related to the I/O expander, which I can't really debug without the actual hardware. Some more detailed information about building this can be found in the firmware README.
18+
19+
## Case
20+
21+
The case for the DawPad is designed in Onshape (you can find a link to the document in the CAD README). I don't really know what I'm doing when it comes to CAD, so it's definitely a bit messy, but it should work. The case is designed to be 3D printed, and is bolted together with a couple M3 screws.
22+
23+
![image](https://github.com/user-attachments/assets/a7793793-4ef6-4b50-baef-528941c3cd3b)
24+
25+
## BOM
26+
27+
Here's the components needed to make this.
28+
29+
* 1x XIAO RP2040
30+
* 1x MCP23017
31+
* 12x 1N4148 DO-35 Diodes
32+
* 2x 4.7k THT Resistor
33+
* 12x Cherry MX switches
34+
* 4x EC11 Rotary Encoder (preferably one without detents and with a reasonably high resolution)
35+
* 4x SK6812 MINI (regular mount)
36+
* 12x SK6812 MINI-E (reverse mount)

hackpads/dawpad/cad/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# DawPad CAD
2+
3+
I designed the case for the DawPad in Onshape, which you can find [here](https://cad.onshape.com/documents/c7175c5f1a4ca0cb72624a5c/w/6e2b9db7ac4b4769267f0874/e/2397240a351e4ca483ae7554?renderMode=0&uiState=67bdc28b9c552b495ee51c69).

hackpads/dawpad/cad/components/pcb.step

Lines changed: 10831 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*.ino]
7+
indent_style = space
8+
indent_size = 2
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#include <Control_Surface.h>
2+
#include <AH/Arduino-Wrapper.h>
3+
#include <AH/Hardware/ExtendedInputOutput/ExtendedInputOutput.hpp>
4+
#include <AH/Hardware/RegisterEncoders.hpp>
5+
#include <Adafruit_MCP23X17.h>
6+
#include <Adafruit_NeoPixel.h>
7+
8+
// MCP configuration
9+
const int MCP_PIN_INTA = 7;
10+
const int MCP_PIN_INTB = 7;
11+
12+
// Encoder pins [A, B]
13+
const int ENCODER_COUNT = 4;
14+
const int ENCODER_PINS[ENCODER_COUNT][2] = {
15+
{0, 1},
16+
{2, 3},
17+
{4, 5},
18+
{6, 7},
19+
};
20+
21+
// Key matrix
22+
const int MATRIX_ROW_COUNT = 3;
23+
const int MATRIX_COL_COUNT = 4;
24+
const int MATRIX_ROWS[MATRIX_ROW_COUNT] = {
25+
8,
26+
9,
27+
10,
28+
};
29+
const int MATRIX_COLS[MATRIX_COL_COUNT] = {
30+
11,
31+
12,
32+
13,
33+
14,
34+
};
35+
const MIDIAddress BUTTON_ADDRESSES[3][4] {
36+
{
37+
{MIDI_Notes::A[0], Channel_1},
38+
{MIDI_Notes::B[0], Channel_1},
39+
{MIDI_Notes::C[0], Channel_1},
40+
{MIDI_Notes::D[0], Channel_1},
41+
},
42+
{
43+
{MIDI_Notes::E[0], Channel_1},
44+
{MIDI_Notes::F[0], Channel_1},
45+
{MIDI_Notes::G[0], Channel_1},
46+
{MIDI_Notes::A[1], Channel_1},
47+
},
48+
{
49+
{MIDI_Notes::B[1], Channel_1},
50+
{MIDI_Notes::C[1], Channel_1},
51+
{MIDI_Notes::D[1], Channel_1},
52+
{MIDI_Notes::E[1], Channel_1},
53+
},
54+
};
55+
56+
// Encoder switch pins
57+
const int ENCODER_SW_PINS[4] = {
58+
0,
59+
1,
60+
2,
61+
3,
62+
};
63+
64+
// LED configuration
65+
const int LED_COUNT = 16;
66+
const int LED_PIN = 6;
67+
68+
//////////
69+
70+
// MIDI interface
71+
USBMIDI_Interface midi;
72+
73+
// Hardware objects
74+
Adafruit_MCP23X17 mcp;
75+
Adafruit_NeoPixel pixels(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
76+
77+
// Encoders
78+
using RegisterEncoderType = RegisterEncoders<uint16_t, 4, int32_t, false>;
79+
80+
RegisterEncoderType encs;
81+
82+
void setup() {
83+
// Set up LEDs
84+
pixels.begin();
85+
86+
// Set up the MCP
87+
if (!mcp.begin_I2C()) {
88+
// If I2C setup failed, flash the first knob red forever.
89+
while (true) {
90+
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
91+
pixels.show();
92+
delay(1000);
93+
94+
pixels.setPixelColor(0, pixels.Color(0, 0, 0));
95+
pixels.show();
96+
delay(1000);
97+
}
98+
}
99+
100+
mcp.setupInterrupts(false, false, LOW);
101+
102+
// Set up the MCP interrupt pins
103+
pinMode(MCP_PIN_INTA, INPUT);
104+
pinMode(MCP_PIN_INTB, INPUT);
105+
106+
// Set up the encoder pins
107+
for (int encoderIndex = 0; encoderIndex < ENCODER_COUNT; encoderIndex++) {
108+
for (int pinIndex = 0; pinIndex <= 1; pinIndex++) {
109+
int pin = ENCODER_PINS[encoderIndex][pinIndex];
110+
mcp.pinMode(pin, INPUT_PULLUP);
111+
mcp.setupInterruptPin(pin, CHANGE);
112+
}
113+
}
114+
}
115+
116+
void loop() {
117+
// Read from encoders
118+
if (!digitalRead(MCP_PIN_INTA)) {
119+
encs.update(mcp.getCapturedInterrupt());
120+
delay(100); // Debounce
121+
mcp.clearInterrupts();
122+
}
123+
124+
for (uint8_t row = 0; row < MATRIX_ROW_COUNT; row++) {
125+
mcp.digitalWrite(MATRIX_ROWS[row], HIGH);
126+
127+
if (!digitalRead(MCP_PIN_INTB)) {
128+
uint16_t pins = mcp.getCapturedInterrupt();
129+
130+
for (uint8_t col = 0; col < MATRIX_COL_COUNT; col++) {
131+
if (pins & (1 << MATRIX_COLS[col])) {
132+
midi.sendNoteOn(BUTTON_ADDRESSES[row][col], 0x7F);
133+
}
134+
}
135+
}
136+
137+
mcp.digitalWrite(row, LOW);
138+
mcp.clearInterrupts();
139+
}
140+
}

hackpads/dawpad/firmware/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# DawPad Firmware
2+
3+
The firmware for the DawPad is built in Arduino, using the [Control-Surface](https://tttapa.github.io/Control-Surface/Doxygen/index.html) library for MIDI functionality.
4+
5+
Dependencies
6+
7+
* [Control-Surface](https://tttapa.github.io/Control-Surface/Doxygen/index.html)
8+
* [Adafruit Neopixel](https://github.com/adafruit/Adafruit_NeoPixel)
9+
* [Adafruit MCP23017](https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library)

0 commit comments

Comments
 (0)