diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01f9cb9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +.vscode/ \ No newline at end of file diff --git a/Eagle/sanro_arduino/E14_Arduino_revB.lbr b/Eagle/sanro_arduino/E14_Arduino_revB.lbr deleted file mode 100644 index c7d410f..0000000 --- a/Eagle/sanro_arduino/E14_Arduino_revB.lbr +++ /dev/null @@ -1,4801 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Footprint for representing an Arduino Mega board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -24 -26 -28 -30 -32 -34 -36 -38 -40 -42 -44 -46 -50 -48 -52 -31 -33 -35 -37 -39 -41 -43 -45 -47 -49 -51 -53 -A0 -A1 -A2 -A3 -A4 -A5 -6 -A7 -A8 -A9 -A10 -A11 -A12 -A13 -A14 -A15 -GND -RESET -3.3V -5V -GND -GND -Vin -GND -AREF -5V - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO MEGA 2560 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Footprint for representing an Arduino Due board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -24 -26 -28 -30 -32 -34 -36 -38 -40 -42 -44 -46 -50 -48 -52 -31 -33 -35 -37 -39 -41 -43 -45 -47 -49 -51 -53 -A0 -A1 -A2 -A3 -A4 -A5 -6 -A7 -A8 -A9 -A10 -A11 -A12 -A13 -A14 -A15 -GND -RESET -3.3V -5V -GND -GND -Vin -GND -AREF -5V - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO DUE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SPI -ICSP -DEBUG - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Footprint for representing an Arduino Leonardo board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GND -AREF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -A0 -A1 -A2 -A3 -A4 -A5 -RESET -3.3V -5V -GND -GND -Vin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Arduino -Leonardo -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 - - -Footprint for representing an Arduino Uno board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GND -AREF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -A0 -A1 -A2 -A3 -A4 -A5 -RESET -3.3V -5V -GND -GND -Vin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Arduino -Uno -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 - - -Footprint for representing an Arduino Ethernet board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 -1 -2 -3 -SDCS -5 -6 -7 -8 -9 -ETHCS -MOSI -MISO -SCK -GND -AREF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -A0 -A1 -A2 -A3 -A4 -A5 -RESET -3.3V -5V -GND -GND -Vin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Arduino -Ethernet - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Footprint for representing an Arduino Micro board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Arduino -Micro -1 -2 -1 -1 -1 -0 -9 -8 -7 -6 -5 -4 -3 -2 -G -R -R -X -T -X -S -S -MOSI -S -C -K -M -I -V -I -G -R -S -5 -V -A -5 -A -4 -A -3 -A -2 -A -1 -A -0 -R -F -3 -V -1 -3 - - - - -Footprint for representing an Arduino Nano board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Arduino -Nano -DORX -RST -GND -D2 -D3 -D4 -D5 -D6 -D7 -D8 -D9 -D10 -D11 -D12 -GND -RST -+5V -A0 -A1 -A2 -A3 -A4 -A5 -A6 -A7 -AREF -3V3 -D13 -VIN -D1TX - - -Footprint for representing an Arduino Mini board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Arduino -Mini - - - - - -1 -2 -1 -1 -1 -0 -9 -8 -7 -6 -5 -4 -3 -2 -G -R -R -X -T -X -G -5 -V -A -5 -A -4 -A -3 -A -2 -A -1 -A -0 -1 -3 -G -5 -V -T -X -R -X -R -G -5 -V -A -6 -A -7 - - -Footprint for representing a Lilypad Arduino board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0/rx -a5 -a4 -a3 -a2 -a1 -a0 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1/tx -+ -- -Lilypad -Arduino - - - - -Schematic symbol for representing an Arduino Uno board in an EAGLE schematic. -Created by Dave Young for Element14. More EAGLE documentation at: -http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO UNO - - - - - - -ICSP - - - -Schematic symbol for representing an Arduino Leonardo board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO - - - - - - -ICSP -LEONARDO - - - - -Schematic symbol for representing an Arduino Due board in an EAGLE schematic. Created by Dave Young for Element14. -More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle -<note: No two pins can be named the same; in this drawing +5V is the same as +5V. and +5V.. and +5V_ etc...> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO DUE - - - - - - -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SPI - - - - - - - - - - - - - - -JTAG -DEBUG - - - - - - - - -Schematic symbol for representing an Arduino Mega board in an EAGLE schematic. Created by Dave Young for Element14. -More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle -<note: No two pins can be named the same; in this drawing +5V is the same as +5V. and +5V.. and +5V_ etc...> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO MEGA 2560 -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Schematic symbol for representing an Arduino Nano v3.0 board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO - - - - - - -ICSP - - -NANO - - - -Schematic symbol for representing an Arduino Micro R3 board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO - - - - - - -ICSP - - -MICRO - - - - - - - -Schematic symbol for representing an Arduino Mini R5 board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO - - - -MINI - - - - - - -Schematic symbol for representing an Arduino Ethernet R3 board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO - - - - - - -ICSP - -ETHERNET - - - - - - - - -Schematic symbol for representing an LilyPad Arduino board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - -ARDUINO -LILYPAD - - - - - - - - - - - - - - -ISP -B -G - - - - -Device for representing an Arduino Due board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - -Device for representing an Arduino Uno board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - -Device for representing an Arduino Nano board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - -Device for representing an Arduino Mini board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - -Device for representing an Arduino Micro board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - -Device for representing an Arduino Mega 2560 board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - -Device for representing a Lilypad Arduino board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - -Device for representing an Arduino Leonardo board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - -Device for representing an Arduino Ethernet board in an EAGLE design without the PCB footprint. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - -Device for representing an Arduino Mega 2560 board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Device for representing an Arduino Due board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Device for representing an Arduino Leonardo board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Device for representing an Arduino Uno board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Device for representing an Arduino Ethernet board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Device for representing an Arduino Micro board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Device for representing an Arduino Nano board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Device for representing an Arduino Mini board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Device for representing a Lilypad Arduino board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Since Version 6.2.2 text objects can contain more than one line, -which will not be processed correctly with this version. - - - diff --git a/Eagle/sanro_arduino/eagle.epf b/Eagle/sanro_arduino/eagle.epf deleted file mode 100644 index 5ef8218..0000000 --- a/Eagle/sanro_arduino/eagle.epf +++ /dev/null @@ -1,19 +0,0 @@ -[Eagle] -Version="07 05 00" -Platform="Mac OS X" -Serial="62191E841E-LSR-WLM-1EL" -Globals="Globals" -Desktop="Desktop" - -[Globals] -AutoSaveProject=1 - -[Win_1] -Type="Control Panel" -Loc="4 23 1439 899" -State=2 -Number=0 - -[Desktop] -Screen="1440 900" -Window="Win_1" diff --git a/Eagle/sanro_arduino/sanro.brd b/Eagle/sanro_arduino/sanro.brd deleted file mode 100644 index 3ffa9d2..0000000 --- a/Eagle/sanro_arduino/sanro.brd +++ /dev/null @@ -1,723 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Footprint for representing an Arduino Micro board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Arduino -Micro -1 -2 -1 -1 -1 -0 -9 -8 -7 -6 -5 -4 -3 -2 -G -R -R -X -T -X -S -S -MOSI -S -C -K -M -I -V -I -G -R -S -5 -V -A -5 -A -4 -A -3 -A -2 -A -1 -A -0 -R -F -3 -V -1 -3 - - - - - - -<b>Pin Headers</b><p> -Naming:<p> -MA = male<p> -# contacts - # rows<p> -W = angled<p> -<author>Created by librarian@cadsoft.de</author> - - -<b>PIN HEADER</b> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->NAME -1 ->VALUE -4 - - - - - - - - - - - - - - - - - -<b>EAGLE Design Rules</b> -<p> -Die Standard-Design-Rules sind so gewählt, dass sie für -die meisten Anwendungen passen. Sollte ihre Platine -besondere Anforderungen haben, treffen Sie die erforderlichen -Einstellungen hier und speichern die Design Rules unter -einem neuen Namen ab. -<b>EAGLE Design Rules</b> -<p> -The default Design Rules have been set to cover -a wide range of applications. Your particular design -may have different requirements, so please make the -necessary adjustments and save your customized -design rules under a new name. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Since Version 6.2.2 text objects can contain more than one line, -which will not be processed correctly with this version. - - - diff --git a/Eagle/sanro_arduino/sanro.eps b/Eagle/sanro_arduino/sanro.eps deleted file mode 100644 index 694e1c9..0000000 --- a/Eagle/sanro_arduino/sanro.eps +++ /dev/null @@ -1,347 +0,0 @@ -%!PS-Adobe-3.0 EPSF-3.0 -%%Title: EAGLE Drawing /Users/ShikyC/Documents/Eagle/sanro/sanro.brd -%%Creator: EAGLE -%%Pages: 1 -%%BoundingBox: 0 0 576 810 -%%EndComments - -% Coordinate transfer: - -/EU { 254 div 0.072 mul } def -/inch { 72 mul } def - -% Linestyle: - -1 setlinecap -1 setlinejoin - -% Drawing functions: - -/l { % draw a line - /lw exch def - /y2 exch def - /x2 exch def - /y1 exch def - /x1 exch def - newpath - x1 EU y1 EU moveto - x2 EU y2 EU lineto - lw EU setlinewidth - stroke - } def - -/h { % draw a hole - /d exch def - /y exch def - /x exch def - d 0 gt { - newpath - x EU y EU d 2 div EU 0 360 arc - currentgray dup - 1 exch sub setgray - fill - setgray - } if - } def - -/b { % draw a bar - /an exch def - /y2 exch def - /x2 exch def - /y1 exch def - /x1 exch def - /w2 x2 x1 sub 2 div EU def - /h2 y2 y1 sub 2 div EU def - gsave - x1 x2 add 2 div EU y1 y2 add 2 div EU translate - an rotate - newpath - w2 h2 moveto - w2 neg h2 lineto - w2 neg h2 neg lineto - w2 h2 neg lineto - closepath - fill - grestore - } def - -/c { % draw a circle - /lw exch def - /rd exch def - /y exch def - /x exch def - newpath - lw EU setlinewidth - x EU y EU rd EU 0 360 arc - stroke - } def - -/a { % draw an arc - /lc exch def - /ae exch def - /as exch def - /lw exch def - /rd exch def - /y exch def - /x exch def - lw rd 2 mul gt { - /rd rd lw 2 div add 2 div def - /lw rd 2 mul def - } if - currentlinecap currentlinejoin - lc setlinecap 0 setlinejoin - newpath - lw EU setlinewidth - x EU y EU rd EU as ae arc - stroke - setlinejoin setlinecap - } def - -/p { % draw a pie - /d exch def - /y exch def - /x exch def - newpath - x EU y EU d 2 div EU 0 360 arc - fill - } def - -/edge { 0.20710678119 mul } def - -/o { % draw an octagon - /an exch def - /dy exch def - /dx exch def - /y exch def - /x exch def - gsave - x EU y EU translate - an dx dy lt { 90 add /dx dy /dy dx def def } if rotate - newpath - 0 dx 2 div sub EU 0 dy edge add EU moveto - 0 dx dy sub 2 div sub dy edge sub EU 0 dy 2 div add EU lineto - 0 dx dy sub 2 div add dy edge add EU 0 dy 2 div add EU lineto - 0 dx 2 div add EU 0 dy edge add EU lineto - 0 dx 2 div add EU 0 dy edge sub EU lineto - 0 dx dy sub 2 div add dy edge add EU 0 dy 2 div sub EU lineto - 0 dx dy sub 2 div sub dy edge sub EU 0 dy 2 div sub EU lineto - 0 dx 2 div sub EU 0 dy edge sub EU lineto - closepath - fill - grestore - } def - -% the real drawing size: - -/MinDrawX -511810 EU def -/MinDrawY -8307 EU def -/MaxDrawX 3810 EU def -/MaxDrawY 346710 EU def - -% the usable page size: - -/LeftMargin 0.25 inch def % change these if drawing gets clipped! -/BotMargin 0.25 inch def -/PageWidth 7.7500 inch def -/PageHeight 11.0000 inch def - -% are we going to rotate?: - -/RotateDrawing 0 0 ne def - -% Media size functions: - -/AbortMessage { % Show a message in a box and stop printing - /h 100 def - /Courier findfont 12 scalefont setfont - mediawidth pagemargin sub h 1 setpage - newpath - 0 0 moveto - 0 h rlineto - mediawidth pagemargin sub 0 rlineto - 0 h neg rlineto - closepath - 5 setlinewidth - stroke - newpath 50 60 moveto (ERROR: Jobsize exceeds physical printing area!) show - newpath 50 40 moveto ( Job has been aborted!) show - showpage - stop - } def - -/SelectPage { % Select the page identified by Row and Column - /Column exch def - /Row exch def - - % the actually exposed area (if the machine knows these parameters!): - - /DrawX MaxDrawX MinDrawX sub def - /DrawY MaxDrawY MinDrawY sub def - statusdict /setpage known - statusdict /mediawidth known and - statusdict /medialength known and - statusdict /pagemargin known and { - % this is for machines that can tell the media size: - statusdict begin - /MediaW mediawidth pagemargin sub def - DrawX DrawY ge { - DrawX MediaW le DrawY medialength le and { - MediaW DrawY 1 setpage - MediaW DrawX sub 2 div 0 translate - }{ - DrawY MediaW le DrawX medialength le and { - MediaW DrawX 0 setpage - 0 MediaW DrawY sub 2 div translate - }{ - AbortMessage - } ifelse - } ifelse - }{ - DrawY MediaW le DrawX medialength le and { - MediaW DrawX 0 setpage - 0 MediaW DrawY sub 2 div translate - }{ - DrawX MediaW le DrawY medialength le and { - MediaW DrawY 1 setpage - MediaW DrawX sub 2 div 0 translate - }{ - AbortMessage - } ifelse - } ifelse - } ifelse - end - }{ - % this is for machines that can NOT tell the media size: - % (Ghostscript doesn't like this!) - /Product product length string def - /i 0 def - product { dup 97 lt { 32 add } if Product exch i exch put /i i 1 add def } forall - Product (ghostscript) search dup /IsGhostscript exch def - { pop pop } if - pop - IsGhostscript not { - statusdict /setpage known { - statusdict begin - RotateDrawing { - LeftMargin PageHeight add BotMargin DrawY add - }{ - BotMargin DrawY add LeftMargin DrawX add - } ifelse - 0 setpage - end - } if - } if - % set clipping boundary: - newpath - LeftMargin BotMargin moveto - 0 PageHeight rlineto - PageWidth 0 rlineto - 0 PageHeight neg rlineto - closepath - clip - % set the origin: - LeftMargin BotMargin translate - RotateDrawing { - 0 PageHeight translate - -90 rotate - PageHeight Column mul neg PageWidth Row mul neg translate - }{ - PageWidth Column mul neg PageHeight Row mul neg translate - } ifelse - } ifelse - % move the lower left corner of the drawing to the origin: - MinDrawX neg MinDrawY neg translate - - % Linestyle: - - 1 setlinecap - 1 setlinejoin - - } def - -% TheDrawing - -gsave 0 0 SelectPage --127000 165100 15748 p --152400 165100 15748 p --177800 165100 15748 p --203200 165100 15748 p --228600 165100 15748 p --254000 165100 15748 p --101600 165100 15748 p --76200 165100 15748 p --50800 165100 15748 p --330200 165100 15748 p --355600 165100 15748 p --381000 165100 15748 p --406400 165100 15748 p --431800 165100 15748 p --457200 165100 15748 p --304800 165100 15748 p --279400 165100 15748 p --127000 317500 15748 p --152400 317500 15748 p --177800 317500 15748 p --203200 317500 15748 p --228600 317500 15748 p --254000 317500 15748 p --101600 317500 15748 p --76200 317500 15748 p --50800 317500 15748 p --330200 317500 15748 p --355600 317500 15748 p --381000 317500 15748 p --406400 317500 15748 p --431800 317500 15748 p --457200 317500 15748 p --304800 317500 15748 p --279400 317500 15748 p --469900 217170 15748 15748 0.0 o --469900 191770 15748 15748 0.0 o --444500 217170 15748 15748 0.0 o --444500 191770 15748 15748 0.0 o --419100 217170 15748 15748 0.0 o --419100 191770 15748 15748 0.0 o --81280 101600 -96520 101600 15240 l --81280 76200 -96520 76200 15240 l --81280 50800 -96520 50800 15240 l --81280 25400 -96520 25400 15240 l --132080 101600 -147320 101600 15240 l --132080 76200 -147320 76200 15240 l --132080 50800 -147320 50800 15240 l --132080 25400 -147320 25400 15240 l --182880 101600 -198120 101600 15240 l --182880 76200 -198120 76200 15240 l --182880 50800 -198120 50800 15240 l --182880 25400 -198120 25400 15240 l --233680 101600 -248920 101600 15240 l --233680 76200 -248920 76200 15240 l --233680 50800 -248920 50800 15240 l --233680 25400 -248920 25400 15240 l --88900 101600 -127000 139700 10160 l --127000 139700 -127000 165100 10160 l --139700 101600 -152400 114300 10160 l --152400 114300 -152400 165100 10160 l --190500 101600 -177800 114300 10160 l --177800 114300 -177800 165100 10160 l --241300 101600 -203200 139700 10160 l --203200 139700 -203200 165100 10160 l --88900 76200 -139700 76200 10160 l --139700 76200 -190500 76200 10160 l --190500 76200 -241300 76200 10160 l --381000 165100 -292100 76200 10160 l --292100 76200 -241300 76200 10160 l --88900 50800 -139700 50800 10160 l --139700 50800 -190500 50800 10160 l --190500 50800 -241300 50800 10160 l --330200 165100 -304800 190500 10160 l --304800 190500 -50800 190500 10160 l --50800 190500 -25400 165100 10160 l --25400 165100 -25400 101600 10160 l --25400 101600 -76200 50800 10160 l --76200 50800 -88900 50800 10160 l -0 342900 -508000 342900 2540 l --508000 342900 -508000 0 2540 l --508000 0 0 0 2540 l -0 0 0 342900 2540 l -showpage grestore diff --git a/Eagle/sanro_arduino/sanro.sch b/Eagle/sanro_arduino/sanro.sch deleted file mode 100644 index 8451dd7..0000000 --- a/Eagle/sanro_arduino/sanro.sch +++ /dev/null @@ -1,629 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Footprint for representing an Arduino Micro board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ICSP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Arduino -Micro -1 -2 -1 -1 -1 -0 -9 -8 -7 -6 -5 -4 -3 -2 -G -R -R -X -T -X -S -S -MOSI -S -C -K -M -I -V -I -G -R -S -5 -V -A -5 -A -4 -A -3 -A -2 -A -1 -A -0 -R -F -3 -V -1 -3 - - - - - - -Schematic symbol for representing an Arduino Micro R3 board in an EAGLE schematic. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ARDUINO - - - - - - -ICSP - - -MICRO - - - - - - - - - -Device for representing an Arduino Micro board with a footprint in an EAGLE design. Created by Dave Young for Element14. More EAGLE documentation at: http://www.element14.com/community/community/knode/cadsoft_eagle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<b>Pin Headers</b><p> -Naming:<p> -MA = male<p> -# contacts - # rows<p> -W = angled<p> -<author>Created by librarian@cadsoft.de</author> - - -<b>PIN HEADER</b> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->NAME -1 ->VALUE -4 - - - - - - - - - - - - - - - - ->VALUE ->NAME - - - - - - - - -<b>PIN HEADER</b> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Since Version 6.2.2 text objects can contain more than one line, -which will not be processed correctly with this version. - - - diff --git a/README.md b/README.md index 0499093..3f485cf 100644 --- a/README.md +++ b/README.md @@ -1,136 +1,57 @@ -# Sanro - Arduino -(このREADME.mdは日本語訳版があります、README_JP.mdをご覧ください、訳は完璧には程遠いですが) -Hardware program of the game Taiko Sanro. +# Taiko Drum Controller - Arduino +Open-source hardware program to make your own Taiko no Tatsujin PC controller. -## What is This Program +## About this Project -Music game fans from East Asia countries are most probable to know a famous game called Taiko No Tatsujin ([太鼓の達人](http://taiko-ch.net/)), developed by [Bandai Namco Entertainment](http://bandainamcoent.co.jp/). +This project aims to help you develop your own **hardware taiko** at home. -This open-source program aims to help you develop your own **hardware taiko** at home, just like how you play taiko in arcade halls. +*This program is for personal and non-commercial use only.* -*This program is for personal and non-commercial use only. You may design your own taiko and have fun, but you may NOT distribute your product to the public.* +## What You Need -## Features +1. An Arduino Micro or Leonardo microcontroller (other compatible boards might work, but you need to verify that they support keyboard emulation); + +2. 4 Piezoelectric sensors; + +3. Necessary electronic components (breadboards, resistors, LEDs, jumper wires, etc.); + +4. Wood planks and cutting tools if you need to make your drum from scratch. If you have a aftermarket taiko or a Big Power Lv. 5 drum, you can use them directly. -* **Full support for the PC game Taiko-san Jiro (太鼓さん次郎).** Actually, any app/game/emulator using keyboards as input is supported. -* **Force-sensitive.** I am also developing a new open-source game called Taiko Sanro that can support this feature. -* **Supports dense inputs such as rolling.** +## Steps to Make the Controller -*In one word, your taiko will perform exactly the same as the arcade version if you configure the program well enough! :D* +1. Make the drum and firmly glue the 4 piezoelectric sensors to the drum. Refer to the image for preferred locations of the sensors. + + ![Controller scheme](./images/piezo_locations.png) -## Prerequisites +2. Connect the piezoelectric sensors and other components to the controller as follows (the polarity of the piezoelectric sensors don't matter); + + ![Controller scheme](./images/scheme.png) -Because this is a DIY project, you should have some basic electronic engineering knowledge about connecting microprocessors with jumper wires on a breadboard. **Soldering techniques, however, are NOT required.** +3. Flash the firmware to the board. + + You may need to fine-tune some parameters like `SAMPLE_CACHE_LENGTH`, `HIT_THRES`, `RESET_THRES`, and `sensitivity`. See the following section for details. -## Getting Started +4. Have fun! -It might take you a few days to assembly and configure your own taiko device. The microprocessor chips are cheap, though, you can buy them from wherever you want. +## Tuning the Parameters -### Preparation +1. Hit and reset threshold + + Set `DEBUG 1` (this disables the keyboard output and sends signal values from the serial port), flash the firmware, roll on one of the 4 areas of the drum, and visualize the graph from the output of the serial monitor. The hit threshold should be smaller than your heaviest hit on the drum, and the reset threshold should be greater than the "cave" between roll hits. The reset value should also below the hit value. + + Repeat the process for the rest 3 areas and find the best one that fits all. -Almost all of these things have alternatives, now I will show you what I used: + ![Controller scheme](./images/tune_hit_reset.png) -* [Arduino Micro](http://i.imgur.com/lXqnpJ9.jpg) module x 1 -* [KEYES K-036](http://i.imgur.com/gUWnUCc.png) microphone module x 4 -* Breadboard x 1 -* A few jumper wires -* Micro USB cable x 1 -* [Arduino IDE](https://www.arduino.cc/en/Main/Software) +2. Sampling length + + For maximum runtime speed, the `cache.h` library has been optimized to work with `SAMPLE_CACHE_LENGTH` window sizes of powers of 2. That means 2, 8, 16, and 32, etc. Practically 16 is the best value for Arduino, but if you have a powerful microcontroller that samples the input at the speed of at least 4000Hz or more, you can change the value to 32 for a smoother (in other words, less noisy) curve. -And miscellaneous stuffs like: +3. Sensitivities + + Not all piezoelectric sensors are the same, and due to installation errors, the captured signals from the 4 sensors may vary significantly. The sensitivity values are multipliers to normalize the differences. In the following example, the right-don area generates a much higher value than the rest 3, so you can adjust `sensitivity` to `{1.0, 1.0, 0.5, 1.0}` to eliminate the issue. -* Thick wood plank x 4, best to be [shaped like this](http://i.imgur.com/va20eVn.jpg) -* Foamed plastics to connect and fixate the wood -* Superglue -* Other electronical tools like screw drivers and multimeters, etc. + ![Controller scheme](./images/tune_sensitivities.png) -A few things to note: - -1. Any Arduino modules with ATmega32u4 chips or Due and Zero boards are supported. Arduino Micro is the cheapest one, though. -2. Using a breadboard is a low-cost option, but it is not the best/stablest choice. There is a PCB blueprint that allows you to print the integrated board and solder up. For details, please see "Making the PCB" part below. -3. You can also design and build your own microphones modules, just make sure you know how to connect them to your Arduino module. -4. Thick, solid, dense and heavy wood is the best choice, while plywood, particleboard and medium-density fiberboard (MDF) are fragile at their edges and can be easily damaged. For better experience, you should cut the planks with the shapes shown in [the picture](http://i.imgur.com/va20eVn.jpg). If you don't have the cutting tools and want it easier, just prepare 4 planks. - -### Connecting the Parts - -The scheme is quite simple. You don't even need any extra resistors or capacitors. **All you need are jumper wires.** - -Each microphone module has 4 pins, and we only need 3 of them (`A0`, `+`, and `G`). Connect their `A0` outputs to Arduino Micro's `A0`~`A3` inputs, then connect their `+` pins together with module's `5V` pin, then the `G` pins together to the ground. Use the following picture if you have any problems. - -(Picture to be uploaded) - -### (Optional) Making the PCB - -To make the PCB, you can either DIY or ask local PCB manufacturer for help. If you choose DIY, you should prepare a few more things, including: - -* 2.2 x 1.6 inches Empty PCB x 1 -* Thermal transfer paper x 1 -* Laser printer x 1 -* Standard 4-pin header x 4 -* Thermal transfer machine (or clothes iron) -* Etchant -* Soldering tools - -Detailed process to make the PCB is totally off-topic, and you may need [this video](https://www.youtube.com/watch?v=mv7Y0A9YeUc) to help you. I have included the required printable board file `sanro.eps` in the `Eagle/sanro-arduino` folder. You can also download the scheme and board files and edit them by yourself with the [Eagle Software](http://www.cadsoftusa.com/download-eagle/). - -### Uploading the Program to the Board - -1. Download and install [Arduino IDE](https://www.arduino.cc/en/Main/Software). -2. Create a folder and put the source files (`sanro.ino` and `cache.h`) into it. -3. Connect your Arduino Micro to your computer with a USB cable. The driver installation should be automatic, but if you have any questions about it, [check this official guide](https://www.arduino.cc/en/Guide/ArduinoLeonardoMicro#toc8). -4. Open the `sanro` project in Arduino IDE. -5. Select "Board" - "Arduino/Genuino Micro" from the menu. -6. Compile and upload the program. - -## Configuration - -***WARNING: Because of the deviations between the microphones and the installation of the planks, you will spend much time adjusting the hardware and the parameters in the program. Be patient, there are lots of tries-and-errors up ahead.*** - -### Hardware - -Literally there is only 2 things you need to do: - -1. Glue each microphone to the wood plank -2. Fixate the wood planks onto the foamed plastics - -However, the problem is how you do them. There are some major criteria when doing this job: - -* Attach the microphone to the plank as close/tight as possible -* Seal the microphone to isolate it from outside noises -* Don't let the planks contact each other - -To accomplish them, you can remove the filter cover of the microphone receiver, then attach the receiver face (the microphones are usually cylindrical, like [the ones that I used in this project](http://i.imgur.com/gUWnUCc.png)) tightly to the surface of the plank, and seal it with superglue. In this way, the soundwave from the plank can be directly transmitted to the microphone, loud and clear. Also, noises and soundwave from nearby planks can be reduced to the minimum. - -Also, please note that there is a potentiometer on the KEYES module, which is used to set the quiescent operating point (Q-point) of the microphone. Although I have implemented algorithms to eliminate the bias caused by unequal Q-point of each microphone, **it is better to adjust the potentiometer manually and keep the Q-points at approximately the same level.** To do this, you may need to contact your microphone provider. - -### Parameters in the Program - -All you need to change is the `LIGHT_THRES` and the `HEAVY_THRES`, according to your microphone configuration. - -The codes are short and self-explanatory, and if you need help understanding them, please refer to the "About the Algorithm" part. - -(To be completed) - -## About the Algorithm - -The algorithm in the program is simple, and there are still much more to be optimized. All pull requests are welcomed! - -In short, the signal processing job can be divided into 4 calculating steps after acquiring the samples from the analog inputs: - -1. Calculate the derivative -2. Calculate the power of the waveform -3. Calculate the convolution of the power -4. Find the peak of the power convolution and compare it with the thresholds to see if there is a light or heavy hit - -This picture shows the algorithm in a clearer way: - -(Picture to be uploaded) - -Step 1 is to elinimate the difference of Q-point, which makes it easier and more accurate to calculate the power of the waveform. - -Step 2, calculating the power of the waveform, can also enhance the signal to noise ratio (SNR), which can further eliminate the noises. `LIGHT_THRES` is also used here to cut the low-power noises out. - -Step 3 is to "polish" the power curve to make it more like a sequence of hit pulses, which makes it easier to find the power peak. - -For Arduino microprocessors, the executing time for each loop is not stable - the processor always executes the instructions as fast as it can. Onece the loop ends, it immediately starts the next loop. This is extremely bad for sampling sounds. Therefore, the program implements a simple sampling frequency control mechanism to restrict the sampling frequency to no more than 1,000Hz. + Note that the installation of the sensors is very critical. You should make sure that the sensors are firmly attached on the wood and located properly. \ No newline at end of file diff --git a/images/piezo_locations.png b/images/piezo_locations.png new file mode 100644 index 0000000..929d609 Binary files /dev/null and b/images/piezo_locations.png differ diff --git a/images/scheme.png b/images/scheme.png new file mode 100644 index 0000000..181a67d Binary files /dev/null and b/images/scheme.png differ diff --git a/images/tune_hit_reset.png b/images/tune_hit_reset.png new file mode 100644 index 0000000..37d26e4 Binary files /dev/null and b/images/tune_hit_reset.png differ diff --git a/images/tune_sensitivities.png b/images/tune_sensitivities.png new file mode 100644 index 0000000..f63f5a9 Binary files /dev/null and b/images/tune_sensitivities.png differ diff --git a/sanro/cache.h b/sanro/cache.h index 7912d6a..5d73956 100644 --- a/sanro/cache.h +++ b/sanro/cache.h @@ -14,32 +14,18 @@ template class Cache { public: - Cache (); - void put (T value); - T get (int offset = 0) const; + Cache() { memset(data_, 0, sizeof(data_)); } + inline void put(T value) { + current_ = (current_ + 1) & (L - 1); + data_[current_] = value; + } + inline T get(int offset = 0) const { + return data_[(current_ + offset) & (L - 1)]; + } private: - T data_ [L]; + T data_[L]; int current_ = 0; }; -template -Cache ::Cache () { - for (int i = 0; i < L; i++) { - data_ [i] = 0; - } -} - -template -void Cache ::put (T value) { - current_ = (current_ + 1) % L; - data_ [current_] = value; -} - -template -T Cache ::get (int offset) const { - int index = (current_ + offset) % L; - return data_ [index]; -} - -#endif // CACHE_H +#endif // CACHE_H \ No newline at end of file diff --git a/sanro/sanro.ino b/sanro/sanro.ino index 9f8dc52..609f68f 100644 --- a/sanro/sanro.ino +++ b/sanro/sanro.ino @@ -1,107 +1,80 @@ -/*************************************************************** - * * - * Taiko Sanro - Arduino * - * Support Arduino models with ATmega32u4 microprocessors * - * * - * Shiky Chang Chris * - * zhangxunpx@gmail.com wisaly@gmail.com * - * * - ***************************************************************/ +#define CHANNELS 4 +#define SAMPLE_CACHE_LENGTH 16 // Must be power of 2 (8, 16, etc.); See cache.h for implementation +#define HIT_THRES 750 // The thresholds are also dependent on SAMPLE_CACHE_LENGTH, if you +#define RESET_THRES 300 // changed SAMPLE_CACHE_LENGTH, you must adjust thresholds here -// New implementation using fast, stable and sensitive piezoelectric -// ceramic sensors (the same sensors used in electirc drum kit). -// No longer need microphones. +#define DEBUG 0 -#define CHANNELS 2 - -#define SAMPLE_CACHE_LENGTH 10 - -#define DON_SILENCE_THRES 1e4 -#define DON_LIGHT_THRES 3e4 -#define DON_HEAVY_THRES 1e5 - -#define KAT_SILENCE_THRES 4e3 -#define KAT_LIGHT_THRES 5e3 -#define KAT_HEAVY_THRES 1e4 - -#define FORCED_FREQ 1000 +#include +#include #include "cache.h" -unsigned long lastTime; +unsigned long int lastTime; -float channelSample[CHANNELS]; -Cache sampleCache[CHANNELS]; -float power[CHANNELS]; +Cache inputWindow[CHANNELS]; +unsigned long power[CHANNELS]; +unsigned long lastPower[CHANNELS]; bool triggered; -float light_thres[] = {DON_LIGHT_THRES, KAT_LIGHT_THRES}; -float heavy_thres[] = {DON_HEAVY_THRES, KAT_HEAVY_THRES}; -float silence_thres[] = {DON_SILENCE_THRES, KAT_SILENCE_THRES}; +unsigned long triggeredTime[CHANNELS]; -int input_pins[] = {A0, A1}; // Don, Kat -int output_pins[] = {A2, A3, A4, A5}; // Left Don, Left Kat, Right Don, Right Kat +const byte inPins[] = {A0, A1, A2, A3}; // L don, L kat, R don, R kat +const byte outPins[] = {5, 6, 7, 8}; // LED visualization (optional) +const char outKeys[] = {'f', 'd', 'j', 'k'}; // L don, L kat, R don, R kat -String debug_output[] = {"D", "K"}; +float sensitivity[] = {1.0, 1.0, 1.0, 1.0}; + +short maxIndex; +float maxPower; void setup() { - pinMode(A2, OUTPUT); - pinMode(A3, OUTPUT); - pinMode(A4, OUTPUT); - pinMode(A5, OUTPUT); - Serial.begin (115200); - for (short int i = 0; i < CHANNELS; i++) { - power [i] = 0; - } - triggered = false; - lastTime = 0; + Serial.begin(115200); + Keyboard.begin(); + analogReference(DEFAULT); + for (byte i = 0; i < CHANNELS; i++) { + power[i] = 0; + lastPower[i] = 0; + triggered = false; + } + lastTime = 0; + maxIndex = -1; + maxPower = 0; } void loop() { - lastTime = micros (); - for (short int i = 0; i < CHANNELS; i++) { - channelSample[i] = analogRead(input_pins[i]); - sampleCache[i].put(channelSample[i]); - - long int tempInt = sampleCache[i].get(1); - power[i] -= tempInt * tempInt; - tempInt = sampleCache[i].get(); - power[i] += tempInt * tempInt; - if (power[i] > light_thres[i]) { - if (!triggered) { - digitalWrite(output_pins[i], LOW); - if (power[i] >= heavy_thres[i]) { - digitalWrite(output_pins[i] + 2, LOW); + if (maxIndex != -1 && lastPower[maxIndex] < RESET_THRES) { + triggered = false; + digitalWrite(outPins[maxIndex], LOW); + maxIndex = -1; + maxPower = 0; + } + + for (byte i = 0; i < CHANNELS; i++) { + + inputWindow[i].put(analogRead(inPins[i])); + power[i] = sensitivity[i] * (power[i] - inputWindow[i].get(1) + inputWindow[i].get()); + + if (lastPower[i] > maxPower && power[i] < lastPower[i]) { + maxPower = lastPower[i]; + maxIndex = i; } - digitalWrite(LED_BUILTIN, HIGH); - Serial.println(debug_output[i]); - } - triggered = true; + lastPower[i] = power[i]; +#if DEBUG + Serial.print(power[i]); + Serial.print(" "); +#endif } - } - - for (short int i = 0; i < CHANNELS; i++) { - triggered = false; - digitalWrite(output_pins[i], HIGH); - digitalWrite(output_pins[i] + 2, HIGH); - if (power[i] > silence_thres[i]) { - digitalWrite(LED_BUILTIN, LOW); - triggered = true; - break; - } - } - -// Serial.println(power[0]); - float delayTime = 1e6 / FORCED_FREQ - (micros() - lastTime); - if (delayTime > 0) { - longMicroDelay(delayTime); - } else { -// digitalWrite(LED_BUILTIN, HIGH); - } -} -void longMicroDelay (float microTime) { - delay (microTime / 1000); - delayMicroseconds (microTime - floor(microTime / 1000) * 1000); + if (!triggered && maxPower >= HIT_THRES) { + triggered = true; + digitalWrite(outPins[maxIndex], HIGH); +#if !DEBUG + Keyboard.print(outKeys[maxIndex]); +#endif + } +#if DEBUG + Serial.print("\n"); +#endif }