Trybotics Logo

Minimal MIDI Drum Kit with 3D Printer © GPL3+

DESCRIPTION

Hi.

This is minimal drum kit using arduino UNO.

First of all, please check this instructables page.

https://blog.arduino.cc/2017/01/19/a-3d-printed-e-drum-pad/

Since I started making this, I was captivated by piezo and electronic drums.

I was fascinated by a very simple mechanism of electronic drums and the great invention called MIDI.

In other words, I could not be satisfied just by making pads.

This drum kit is roughly divided into two productions.

1.Pad made with a 3d printer and thick paper.

2.Trigger midi converter with arduino UNO .

The signal sent from the pad of " 1 " is processed by arduino of " 2 " and converted into MIDI signal. And the MIDI signal is transmitted from arduino to iPhone, laptop, etc, and sound comes out.

You do not need to prepare a power supply other than a smartphone or PC.

What You'll Need

Tools

・3D Printer

・Laser Cutter (Extra)

・hex wrench

・cutter knife

・circle cutter

・Soldering Iron

Pipe Cutter

・driver drill

・drill bit 9mm / 10mm

Material

・1mm thick paper

・PLA filament

・Sponge Foam Sheets 5mm / 10mm

・MDF 2.5mm / 5.5mm (Extra)

・M6 - 70mm bolt and nuts

・M6 - 50mm bolt and nuts

・M3 - 10mm bolt and nuts

・M3 - 15mm bolt and nuts

・M3 - 25mm bolt and nuts

・M2 screw

・13 mm diameter Stainless steel pipe

Drum Hardware

Mesh head 10 inch / 8 inch

・Snare stand (Anything is OK. I am using YAMAHA SS662.)

・Hi-hat stand (Anything is OK. I am using YAMAHA HS650A)

・Kick pedal (Anything is OK. I am using YAMAHA FP7210A)

・Drum stick

Step 1 : 3D Printing

All data is on Thingiverse and GitHub.

Please use Ver.2 for the rim.

I printed parts with infill at 20%. The thickness of the layer is 0.3 mm.

Also, you can use laser cutter for making pad.

https://github.com/RyoKosaka/drums/tree/master/vector

Step 2 : Assembling

Use M3-10mm bolts and nuts to connect the parts together.

Use the M3-15 mm or M3-25 mm bolts for the center part to fix the bottom part to each other.

Step 3 : Making Shell

First, the height of the shell is 55 mm.

Please make three bands with a width of 55 mm.

The length is slightly longer than the length covering the pad.

Since there is a gap at the bottom, try inserting one band into that gap.

Cut the band so that it will be perfect circle length.

Repeat this 3 times and overlay using adhesive.

When the shell dries, with the mesh head fixed, make a hole of 9 mm in diameter for the socket.

You can use butterfly nuts, but I also made tuning keys that can be tightened even with ordinary nuts, so please use it by all means.

For fixing the mesh head, use M6-70 mm bolts.

Once you've made a hole, remove the mesh head again to put a piezo

Step 4 : Attaching Piezo

SNARE

In the case of a snare, use two piezo as shown in the picture.

Connect piezo's red cable to each of tip and ring.

Both black cables connect to sleeve.

Do not forget to thread the cables through the holes in the sensor plate when soldering.

Piezo for the head (piezo connected to tip) needs to be sandwiched with 10 mm thick sponge foam as shown in the picture.

One below, three on the top. And make the top 3 cones like the picture.

Then put it on the sensor plate.

KICK

Since the kick pad uses only one piezo, only tip can be used.

No sensor plate is required.Two sponge foams under the piezo

Place the sensor offset from the center.

It is because arduino can not judge the strength of hit if beater hits sensor directly.

HI-HAT

The circuit is the same as the kick pad.

Put a piece of 10 mm thick sponge foam under the piezo.

Piezo is delicate. Be careful not to bend or hurt.

Step 5 : 10 inch Snare Pad

First attach the sensor for the rim.

Fix the sensor plate. Firmly fix it. Make the end of the cone visible 2-3 mm when viewed from the side.

Of course, the same procedure is also used when using an 8-inch pad as a snare.

Step 6 : 8 inch Kick PAD

First, cut a 13 mm diameter stainless steel pipe.

Make two 200 mm and two 365 mm.

Since the length can be adjusted, even if there is some error in the length, it is OK.

Assemble them with reference to pictures.

In order to fix the pipe, it is designed so that the M3 nut can be loaded inside the part.

Fix the pipe securely. Use M3-15 mm bolts and nuts.

Step 7 : 12 inch Hi-Hat

After producing the shell with thick paper, I thought that if you use thick paper I can make cymbals.

First. Cut thick paper into a circle with a diameter of 300 mm. Make three of this.

Next, make a notch from the center.

Finally, a second notch is made from the point 10 mm apart parallel from the first notch.

In this way, three pac-mans with a small mouth opened are made.

Then close the Pac Man's mouth carefully with tape to make it into a cymbal shape.

Apply adhesive and overlay these.Do not forget to extend the adhesive cleanly and thinly

Hold firmly with your hands, then place the weight around and dry.

For silencing, put a 5 mm thick sponge and drill a hole. You can not open the hole neatly, but you can hide the hole so it's okay.

Complete by attaching sensor mount and cable guide with double-sided tape. It might be easier if you use glue gun.

Step 8 : Hi-Hat Controller

Hi-Hat Controller sends the opening and closing of the hi-hat to arduino.

The circuit is very simple.

It is made by combining three parts.

Attach the FSR to the bottom part and fix the socket. FSR can be used even if a hole is opened.

Attach a 10 mm sponge to the FSR like a photo.

Fix the cover with M3 - 10 mm bolts.

Even though it's only HIGH and LOW, you may wonder why I used FSR.

I use FSR to correspond to sound modules such as Roland and Yamaha.

And in the sound source exclusive for drums such as EZ DRUMMER 2, there are several stages in the degree of opening of the hi-hat.

If it is FSR, it may be possible to respond by just modifying the code. However, I have not tried it.

Step 9 : USB - MIDI

What can we do in this step?

With usb cable alone, you can send midi signal from arduino.

In other words, make arduino be recognized by iPhone etc. as a midi device without any additional hardware.

First of all, check this page.

http://morecatlab.akiba.coocan.jp/lab/index.php/aruino/midi-firmware-for-arduino-uno-moco/

https://github.com/kuwatay/mocolufa

If you connect normal arduino UNO directly to iPhone, you will get an error message like "Arduino UNO is not compatible".

So, you have to rewrite the USB chip (ATmega16U2) used in arduino UNO.

https://www.arduino.cc/en/Hacking/DFUProgramming8U2

This instruction is how to rewrite the hex file.

Please proceed according to this site until the description below.

sudo dfu-programmer atmega16u2 flash Arduino-usbserial-uno.hex

Just replace "Arduino-usbserial-uno.hex" with "dualMoco.hex".

Therefore,

sudo dfu-programmer atmega16u2 flash dualMoco.hex

After rewriting, your Arduino will be recognized as a MIDI device.

If you short-circuit the pin as shown in the picture, it will be recognized as normal Arduino.

If not (when not short-circuited), arduino UNO will be recognized as a MIDI device.

In other words, when writing code using the arduino IDE, you have to short-circuit the pins as shown in the picture.

Step 10 : Trigger to MIDI Converter

There is arduino UNO and shield in the box.

Refer to the image of fritzing for the circuit of the shield.

Diodes are for protection but I saw the information that arduino UNO has protection circuit, diodes may not be necessary. Does anyone know about this?

After printing the model of the case and the cover first, it is good to make the shield according to it.

There is also a 3D model of the cover, but I made a cover with a laser cutter. Please choose whichever you like.

Step 11 : Play with GarageBand

Just start garageband and connect. There is no particularly difficult setting.

There are a number of DAWs for PCs that can be used on this drum set, including GarageBand.

Among them, Hydrogen is free and you can add sound.

Step 12 : Setting

In making the code, it was troublesome to rewrite the code each time the value changed, so I wanted to be able to change the value with arduino alone.

In other words, this is made for debugging code, so there are items that do not need to be changed.

Nevertheless, setting is necessary depending on the size of the piezo, the size of the pad, the hardness of the sponge foam.

Select an instrument with the INC / DEC button and select the setting item with the NEXT / BACK button. When the EDIT button is pressed while the instruments and items you want to set are displayed, you can change the value with the INC / DEC button. Then, pressing the EDIT button again confirms the change.

If you watch at the latter part of the video you will understand how to operate.

THRESHOLD

The lowest value at which sound comes out

SENSITIVITY

Sensor sensitivity. If you lower it, you will gain high velocity even if you hit softly.

NOTE

Number of the note. By changing, you can change instruments. Please refer to the image.

FLAG

A value for judging that the beating is over. You do not have to change it too much. It would be nice to set the value from 1 to 10. If you raise the value too much, you will get a sound twice with a single hit. If you lower it too much, you may get out of sound when you hit repeatedly.

SCAN TIME

In searching for peaks, values are taken consecutively for several milliseconds after exceeding the threshold. The highest value among them will peak. This several milliseconds is SCANTIME. There is no need to change it.

HEAD / RIM

Set the ease of the rim. Raising it makes it difficult to sound. If you lower it too hard the rim will sound when you hit the head. Regarding the judgment of the head and the rim, it may be necessary to improve the code

PEDAL VELO

Unlike other pads, the velocity of the pedal is constant. The initial value is 100. Please change to your favorite value.

MASK TIME

This is a value related to FLAG. There is no need to change it. If you raise it, you may not hear a sound when you hit continuously.

Step 13 : Fusion 360

Some parts may not be usable unless their dimensions are changed. It is difficult to edit STL data. So I uploaded fusion 360 data. However, since I am editing data while trial and error, it is better not to depend too much on the history function.

https://github.com/RyoKosaka/drums/tree/master/Fusion360

EXTRA

Extra steps are on instructables.

https://www.instructables.com/id/Arduino-Minimal-Drum-Kit/

And, detailed production process is published on this blog.

Check it if you are interested.

Please feel free to ask anything.

Have fun!

Description:

3drag
3D Printer (generic)
Lasercutter
Laser cutter (generic)
not necessary,extra
09507 01
Soldering iron (generic)
circle cutter

Description:

Description:

Hi.

This is minimal drum kit using arduino UNO.

First of all, please check this instructables page.

https://blog.arduino.cc/2017/01/19/a-3d-printed-e-drum-pad/

Since I started making this, I was captivated by piezo and electronic drums.

I was fascinated by a very simple mechanism of electronic drums and the great invention called MIDI.

In other words, I could not be satisfied just by making pads.

This drum kit is roughly divided into two productions.

1.Pad made with a 3d printer and thick paper.

2.Trigger midi converter with arduino UNO .

The signal sent from the pad of " 1 " is processed by arduino of " 2 " and converted into MIDI signal. And the MIDI signal is transmitted from arduino to iPhone, laptop, etc, and sound comes out.

You do not need to prepare a power supply other than a smartphone or PC.

What You'll Need

Tools

・3D Printer

・Laser Cutter (Extra)

・hex wrench

・cutter knife

・circle cutter

・Soldering Iron

Pipe Cutter

・driver drill

・drill bit 9mm / 10mm

Material

・1mm thick paper

・PLA filament

・Sponge Foam Sheets 5mm / 10mm

・MDF 2.5mm / 5.5mm (Extra)

・M6 - 70mm bolt and nuts

・M6 - 50mm bolt and nuts

・M3 - 10mm bolt and nuts

・M3 - 15mm bolt and nuts

・M3 - 25mm bolt and nuts

・M2 screw

・13 mm diameter Stainless steel pipe

Drum Hardware

Mesh head 10 inch / 8 inch

・Snare stand (Anything is OK. I am using YAMAHA SS662.)

・Hi-hat stand (Anything is OK. I am using YAMAHA HS650A)

・Kick pedal (Anything is OK. I am using YAMAHA FP7210A)

・Drum stick

Step 1 : 3D Printing

All data is on Thingiverse and GitHub.

Please use Ver.2 for the rim.

I printed parts with infill at 20%. The thickness of the layer is 0.3 mm.

Also, you can use laser cutter for making pad.

https://github.com/RyoKosaka/drums/tree/master/vector

Step 2 : Assembling

Use M3-10mm bolts and nuts to connect the parts together.

Use the M3-15 mm or M3-25 mm bolts for the center part to fix the bottom part to each other.

Step 3 : Making Shell

First, the height of the shell is 55 mm.

Please make three bands with a width of 55 mm.

The length is slightly longer than the length covering the pad.

Since there is a gap at the bottom, try inserting one band into that gap.

Cut the band so that it will be perfect circle length.

Repeat this 3 times and overlay using adhesive.

When the shell dries, with the mesh head fixed, make a hole of 9 mm in diameter for the socket.

You can use butterfly nuts, but I also made tuning keys that can be tightened even with ordinary nuts, so please use it by all means.

For fixing the mesh head, use M6-70 mm bolts.

Once you've made a hole, remove the mesh head again to put a piezo

Step 4 : Attaching Piezo

SNARE

In the case of a snare, use two piezo as shown in the picture.

Connect piezo's red cable to each of tip and ring.

Both black cables connect to sleeve.

Do not forget to thread the cables through the holes in the sensor plate when soldering.

Piezo for the head (piezo connected to tip) needs to be sandwiched with 10 mm thick sponge foam as shown in the picture.

One below, three on the top. And make the top 3 cones like the picture.

Then put it on the sensor plate.

KICK

Since the kick pad uses only one piezo, only tip can be used.

No sensor plate is required.Two sponge foams under the piezo

Place the sensor offset from the center.

It is because arduino can not judge the strength of hit if beater hits sensor directly.

HI-HAT

The circuit is the same as the kick pad.

Put a piece of 10 mm thick sponge foam under the piezo.

Piezo is delicate. Be careful not to bend or hurt.

Step 5 : 10 inch Snare Pad

First attach the sensor for the rim.

Fix the sensor plate. Firmly fix it. Make the end of the cone visible 2-3 mm when viewed from the side.

Of course, the same procedure is also used when using an 8-inch pad as a snare.

Step 6 : 8 inch Kick PAD

First, cut a 13 mm diameter stainless steel pipe.

Make two 200 mm and two 365 mm.

Since the length can be adjusted, even if there is some error in the length, it is OK.

Assemble them with reference to pictures.

In order to fix the pipe, it is designed so that the M3 nut can be loaded inside the part.

Fix the pipe securely. Use M3-15 mm bolts and nuts.

Step 7 : 12 inch Hi-Hat

After producing the shell with thick paper, I thought that if you use thick paper I can make cymbals.

First. Cut thick paper into a circle with a diameter of 300 mm. Make three of this.

Next, make a notch from the center.

Finally, a second notch is made from the point 10 mm apart parallel from the first notch.

In this way, three pac-mans with a small mouth opened are made.

Then close the Pac Man's mouth carefully with tape to make it into a cymbal shape.

Apply adhesive and overlay these.Do not forget to extend the adhesive cleanly and thinly

Hold firmly with your hands, then place the weight around and dry.

For silencing, put a 5 mm thick sponge and drill a hole. You can not open the hole neatly, but you can hide the hole so it's okay.

Complete by attaching sensor mount and cable guide with double-sided tape. It might be easier if you use glue gun.

Step 8 : Hi-Hat Controller

Hi-Hat Controller sends the opening and closing of the hi-hat to arduino.

The circuit is very simple.

It is made by combining three parts.

Attach the FSR to the bottom part and fix the socket. FSR can be used even if a hole is opened.

Attach a 10 mm sponge to the FSR like a photo.

Fix the cover with M3 - 10 mm bolts.

Even though it's only HIGH and LOW, you may wonder why I used FSR.

I use FSR to correspond to sound modules such as Roland and Yamaha.

And in the sound source exclusive for drums such as EZ DRUMMER 2, there are several stages in the degree of opening of the hi-hat.

If it is FSR, it may be possible to respond by just modifying the code. However, I have not tried it.

Step 9 : USB - MIDI

What can we do in this step?

With usb cable alone, you can send midi signal from arduino.

In other words, make arduino be recognized by iPhone etc. as a midi device without any additional hardware.

First of all, check this page.

http://morecatlab.akiba.coocan.jp/lab/index.php/aruino/midi-firmware-for-arduino-uno-moco/

https://github.com/kuwatay/mocolufa

If you connect normal arduino UNO directly to iPhone, you will get an error message like "Arduino UNO is not compatible".

So, you have to rewrite the USB chip (ATmega16U2) used in arduino UNO.

https://www.arduino.cc/en/Hacking/DFUProgramming8U2

This instruction is how to rewrite the hex file.

Please proceed according to this site until the description below.

sudo dfu-programmer atmega16u2 flash Arduino-usbserial-uno.hex

Just replace "Arduino-usbserial-uno.hex" with "dualMoco.hex".

Therefore,

sudo dfu-programmer atmega16u2 flash dualMoco.hex

After rewriting, your Arduino will be recognized as a MIDI device.

If you short-circuit the pin as shown in the picture, it will be recognized as normal Arduino.

If not (when not short-circuited), arduino UNO will be recognized as a MIDI device.

In other words, when writing code using the arduino IDE, you have to short-circuit the pins as shown in the picture.

Step 10 : Trigger to MIDI Converter

There is arduino UNO and shield in the box.

Refer to the image of fritzing for the circuit of the shield.

Diodes are for protection but I saw the information that arduino UNO has protection circuit, diodes may not be necessary. Does anyone know about this?

After printing the model of the case and the cover first, it is good to make the shield according to it.

There is also a 3D model of the cover, but I made a cover with a laser cutter. Please choose whichever you like.

Step 11 : Play with GarageBand

Just start garageband and connect. There is no particularly difficult setting.

There are a number of DAWs for PCs that can be used on this drum set, including GarageBand.

Among them, Hydrogen is free and you can add sound.

Step 12 : Setting

In making the code, it was troublesome to rewrite the code each time the value changed, so I wanted to be able to change the value with arduino alone.

In other words, this is made for debugging code, so there are items that do not need to be changed.

Nevertheless, setting is necessary depending on the size of the piezo, the size of the pad, the hardness of the sponge foam.

Select an instrument with the INC / DEC button and select the setting item with the NEXT / BACK button. When the EDIT button is pressed while the instruments and items you want to set are displayed, you can change the value with the INC / DEC button. Then, pressing the EDIT button again confirms the change.

If you watch at the latter part of the video you will understand how to operate.

THRESHOLD

The lowest value at which sound comes out

SENSITIVITY

Sensor sensitivity. If you lower it, you will gain high velocity even if you hit softly.

NOTE

Number of the note. By changing, you can change instruments. Please refer to the image.

FLAG

A value for judging that the beating is over. You do not have to change it too much. It would be nice to set the value from 1 to 10. If you raise the value too much, you will get a sound twice with a single hit. If you lower it too much, you may get out of sound when you hit repeatedly.

SCAN TIME

In searching for peaks, values are taken consecutively for several milliseconds after exceeding the threshold. The highest value among them will peak. This several milliseconds is SCANTIME. There is no need to change it.

HEAD / RIM

Set the ease of the rim. Raising it makes it difficult to sound. If you lower it too hard the rim will sound when you hit the head. Regarding the judgment of the head and the rim, it may be necessary to improve the code

PEDAL VELO

Unlike other pads, the velocity of the pedal is constant. The initial value is 100. Please change to your favorite value.

MASK TIME

This is a value related to FLAG. There is no need to change it. If you raise it, you may not hear a sound when you hit continuously.

Step 13 : Fusion 360

Some parts may not be usable unless their dimensions are changed. It is difficult to edit STL data. So I uploaded fusion 360 data. However, since I am editing data while trial and error, it is better not to depend too much on the history function.

https://github.com/RyoKosaka/drums/tree/master/Fusion360

EXTRA

Extra steps are on instructables.

https://www.instructables.com/id/Arduino-Minimal-Drum-Kit/

And, detailed production process is published on this blog.

Check it if you are interested.

Please feel free to ask anything.

Have fun!

Description:

Hello Drum v2Arduino
Modified: 05/12/2019 by George Brotherston
/*
	Drum MIDI Controller
	Created:  28/06/2017 by Ryo Kosaka as " HELLO DRUM " Ver.1.0
	Modified: 05/12/2019 by George Brotherston
*/

// Library Includes

//	#include <Arduino.h>		// Arduino Library (automatically included)
		// LOW (Line 41)
		// HIGH (Line 40)
		// INPUT_PULLUP (Line 47)
		// digitalRead() (Line 177)
		// analogRead() (Line 178)
	#include <MIDI.h>           // MIDI Library		- Version: 4.3.1
		// includes <midi_Namespace.h>
			// class MIDI (Line 30)
		// class method 'begin' (Line 55)
	#include <LiquidCrystal.h>  // LiquidCrystal	- Version: 1.0.7
		// lcd object instantiatied (in Variables section below) from LiquidCrystal class (Line 45)

//	Variables - Declare and Initialize

	// Variables - Program
		boolean	bSnareFlag			= false;
		boolean	bHihatFlag			= false;
		boolean	bKickFlag			= false;
		boolean	bPedalFlag			= false;
		boolean	bButtonState		= true;
		boolean	bButtonState_set	= true;
		int		iUPDOWN				= 0;
		int		iNEXTBACK			= 0;

	//	Arrays - Program
		// InstrumentSensor[6] = {threshold, sensitivity, note, flag, velocity, iPeakValue}
		// 'iPeakValue' and 'velocity' must be zero for all InstrumentSensor arrays
		// All 'aHIHAT[]' and 'aHIHAT_CLOSE[]' array elements should have the same value except for 'note' element.
			int		aSNARE[6]		= {150, 950, 38, 3, 0, 0};
			int		aSNARE_RIM[6]	= {5, 500, 37, 3 , 0, 0};
			int		aHIHAT[6]		= {100, 800, 46, 1, 0, 0};     
			int		aHIHAT_CLOSE[6]	= {100, 800, 42, 1, 0, 0};
			int		aKICK[6]		= {200, 700, 36, 1, 0, 0};
		// Instrument_ContinuousController[4] = {scantime, snare/rim, pedalVelocity , masktime}
			int		aHIHAT_PEDAL[4]	= {600, 0, 44, 0};
		// InstrumentSensor_ParameterValue[4] = {threshold, sensitivity, note, flag}
			int		aSETTING[4]		= {4, 500 ,100 ,1};

	//	Libraries
		//	LiquidCrystal.h
			//	Constants (already defined in Library, still in scope?  If not then define below)
				//	const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
			//	lcd object instantiatiated from LiquidCrystal class (LiquidCrystal.h Line 45)
				LiquidCrystal lcd(rs, en, d4, d5, d6, d7);	//	Associate LCD interface pins to associated Arduino pin number
		// MIDI.h
			//	Initialize the library
				MIDI_CREATE_DEFAULT_INSTANCE();

// Program Code

	// Program Execution - Initial (program setup)

		void setup() {
			MIDI.begin(10);						// begin (MIDI.h Line 55)
			lcd.begin(16, 2);					// begin (LiquidCrystal.h Line 62)
			lcd.print("INITIALIZING...");		// print (LiquidCrystal.h Line 45)
			lcd.setCursor(0, 1);				// setCursor (LiquidCrystal.h Line 82)
			lcd.print("DRUM MIDI CONTROLLER");
			pinMode(6, INPUT_PULLUP);			// pinMode (Arduino.h Line 175); INPUT_PULLUP (Arduino.h Line 47)
			pinMode(7, INPUT_PULLUP);
			pinMode(8, INPUT_PULLUP);
			pinMode(9, INPUT_PULLUP);
			pinMode(10, INPUT_PULLUP);
		}

	// Program Execution - Steadystate (continuous loop until power is lost)

		void loop() {
		// Drum MIDI Controller Circuit
		// Declare and Initialize Variables

			int		iButton_set		= digitalRead(6);	// Set Button			// digitalRead() (Arduino.h Line 177)
			int		iButton_up		= digitalRead(7);	// Up Button
			int		iButton_down	= digitalRead(8);	// Down Button
			int		iButton_next	= digitalRead(9);	// Next Button
			int		iButton_back	= digitalRead(10);	// Back Button
			int		iPiezoValue_A0	= analogRead(A0);   // Piezo - Snare Head	// analogRead() (Arduino.h Line 178)
			int		iPiezoValue_A1	= analogRead(A1);   // Piezo - Snare Rim
			int		iPiezoValue_A2	= analogRead(A2);   // Hi-hat
			int		iPiezoValue_A3	= analogRead(A3);   // Kick Drum
			int		iFSRValue_A4	= analogRead(A4);   // Hi-hat Pedal
	
		// Edit Mode

			int		aUP[4]			= {5, 50, 1,1};		// {threshold, sensitivity, note, flag}
			int		aUP_ADVANCE[4]	= {1, 50, 1,1};		// {scantime, rim/head, pedal velocity, masktime}

			// Note: aINSTRUMENT[] array was not declared in 'Arrays' above
			char* aINSTRUMENT[] = {
				"SNARE HEAD",  "SNARE RIM", "HIHAT OPEN", "HIHAT CLOSE", "HIHAT PEDAL", "KICK", "ADVANCED SETTING"
			};

			// Note: aSETTING[] array WAS declared in 'Arrays' above
			char* aSETTING[] = {
				"THRESHOLD",  "SENSITIVITY", "NOTE", "FLAG"
			};

			// Note: aSETTING_ADVANCE[] was not declared in 'Arrays' above
			char* aSETTING_ADVANCE[] = {
				"SCAN TIME", "HEAD / RIM ","PEDAL VELO", "MASK TIME"
			};

			if (iUPDOWN < 0) {
				iUPDOWN = 6;
			}

			if (iUPDOWN > 6) {
				iUPDOWN = 0;
			}

			if (iNEXTBACK < 0) {
				iNEXTBACK = 3;
			}

			if (iNEXTBACK > 3) {
				iNEXTBACK = 0;
			}

		// Pushbutton EDIT
			// LOW (Arduino.h Line 41)
			if (iButton_set == LOW && bButtonState == true && bButtonState_set == true) {
				lcd.clear();
				lcd.print("EDIT");
				bButtonState		= false;
				bButtonState_set	= false;
				delay(500);
			}

			if (iButton_set == LOW && bButtonState == true && bButtonState_set == false) {
				lcd.clear();
            	lcd.print("EDIT DONE");
            	bButtonState		= false;
            	bButtonState_set	= true;
            	delay(500);
			}

			if (iButton_up == LOW && bButtonState == true && bButtonState_set == false) {
				switch (iUPDOWN) {
					case 0:
					aSNARE[iNEXTBACK] = aSNARE[iNEXTBACK] + aUP[iNEXTBACK];
					break;

					case 1:
					aSNARE_RIM[iNEXTBACK] = aSNARE_RIM[iNEXTBACK] + aUP[iNEXTBACK];
					break;

					case 2:
					switch (iNEXTBACK) {
						case 2:
						aHIHAT[iNEXTBACK] = aHIHAT[iNEXTBACK] + aUP[iNEXTBACK];
						break;

						default:
						aHIHAT_CLOSE[iNEXTBACK] = aHIHAT_CLOSE[iNEXTBACK] + aUP[iNEXTBACK];
						aHIHAT[iNEXTBACK] = aHIHAT[iNEXTBACK] + aUP[iNEXTBACK];
					}
					break;

					case 3:
					switch (iNEXTBACK) {
						case 2:
						aHIHAT_CLOSE[iNEXTBACK] = aHIHAT_CLOSE[iNEXTBACK] + aUP[iNEXTBACK];
						break;
						
						default:
						aHIHAT_CLOSE[iNEXTBACK] = aHIHAT_CLOSE[iNEXTBACK] + aUP[iNEXTBACK];
						aHIHAT[iNEXTBACK] = aHIHAT[iNEXTBACK] + aUP[iNEXTBACK];
					}
					break;

					case 4:
					switch (iNEXTBACK) {
						case 0:
						aHIHAT_PEDAL[iNEXTBACK] = aHIHAT_PEDAL[iNEXTBACK] + aUP[iNEXTBACK];
						break;
						
						case 2:
						aHIHAT_PEDAL[iNEXTBACK] = aHIHAT_PEDAL[iNEXTBACK] + aUP[iNEXTBACK];
						break;
					}
					break;

					case 5:
					aKICK[iNEXTBACK] = aKICK[iNEXTBACK] + aUP[iNEXTBACK];
					break;

					case 6:
					aSETTING[iNEXTBACK] = aSETTING[iNEXTBACK] + aUP_ADVANCE[iNEXTBACK];
					break;
				}
				bButtonState = false;
				delay(30);
			}

			if (iButton_down == LOW && bButtonState == true && bButtonState_set == false) {

				switch (iUPDOWN) {
					case 0:
					aSNARE[iNEXTBACK] = aSNARE[iNEXTBACK] - aUP[iNEXTBACK];
					break;

					case 1:
					aSNARE_RIM[iNEXTBACK] = aSNARE_RIM[iNEXTBACK] - aUP[iNEXTBACK];
					break;

					case 2:
					switch (iNEXTBACK) {
						case 2:
						aHIHAT[iNEXTBACK] = aHIHAT[iNEXTBACK] - aUP[iNEXTBACK];
						break;

						default:
						aHIHAT_CLOSE[iNEXTBACK] = aHIHAT_CLOSE[iNEXTBACK] - aUP[iNEXTBACK];
						aHIHAT[iNEXTBACK] = aHIHAT[iNEXTBACK] - aUP[iNEXTBACK];
					}
					break;

					case 3:
					switch (iNEXTBACK) {
						case 2:
						aHIHAT_CLOSE[iNEXTBACK] = aHIHAT_CLOSE[iNEXTBACK] - aUP[iNEXTBACK];
						break;

						default:
						aHIHAT_CLOSE[iNEXTBACK] = aHIHAT_CLOSE[iNEXTBACK] - aUP[iNEXTBACK];
						aHIHAT[iNEXTBACK] = aHIHAT[iNEXTBACK] - aUP[iNEXTBACK];
					}
					break;

					case 4:
					switch (iNEXTBACK) {
						case 0:
						aHIHAT_PEDAL[iNEXTBACK] = aHIHAT_PEDAL[iNEXTBACK] - aUP[iNEXTBACK];
						break;

						case 2:
						aHIHAT_PEDAL[iNEXTBACK] = aHIHAT_PEDAL[iNEXTBACK] - aUP[iNEXTBACK];
						break;
					}
					break;

					case 5:
					aKICK[iNEXTBACK] = aKICK[iNEXTBACK] - aUP[iNEXTBACK];
					break;

					case 6:
					aSETTING[iNEXTBACK] = aSETTING[iNEXTBACK] - aUP_ADVANCE[iNEXTBACK];
					break;
				}
				bButtonState = false;
				delay(30);
			}

		// Pushbuttons UP; DOWN; NEXT; BACK
			if (iButton_up == LOW && bButtonState == true && bButtonState_set == true) {
				iUPDOWN = ++iUPDOWN;
				bButtonState = false;
				delay(30);
			}

			if (iButton_down == LOW && bButtonState == true && bButtonState_set == true) {
				iUPDOWN = --iUPDOWN;
				bButtonState = false;
				delay(30);
			}

			if (iButton_next == LOW && bButtonState == true && bButtonState_set == true) {
				iNEXTBACK = ++iNEXTBACK;
				bButtonState = false;
				delay(30);
			}

			if (iButton_back == LOW && bButtonState == true && bButtonState_set == true) {
				iNEXTBACK = --iNEXTBACK;
				bButtonState = false;
				delay(30);
			}

			if (bButtonState == false && iButton_up == HIGH && iButton_down == HIGH && iButton_next == HIGH && iButton_back == HIGH && iButton_set == HIGH) {
				// HIGH is defined in Arduino.h Line 40

				switch (iUPDOWN) {

					case 0:
					lcd.clear();
					lcd.print(aINSTRUMENT[iUPDOWN]);
					lcd.setCursor(0, 1);
					lcd.print(aSETTING[iNEXTBACK]);
					lcd.setCursor(12, 1);
					lcd.print(aSNARE[iNEXTBACK]);
					break;

					case 1:
					lcd.clear();
					lcd.print(aINSTRUMENT[iUPDOWN]);
					lcd.setCursor(0, 1);
					lcd.print(aSETTING[iNEXTBACK]);
					lcd.setCursor(12, 1);
					lcd.print(aSNARE_RIM[iNEXTBACK]);
					break;

					case 2:
					lcd.clear();
					lcd.print(aINSTRUMENT[iUPDOWN]);
					lcd.setCursor(0, 1);
					lcd.print(aSETTING[iNEXTBACK]);
					lcd.setCursor(12, 1);
					lcd.print(aHIHAT[iNEXTBACK]);
					break;

					case 3:
					lcd.clear();lcd.print(aINSTRUMENT[iUPDOWN]);
					lcd.setCursor(0, 1);
					lcd.print(aSETTING[iNEXTBACK]);
					lcd.setCursor(12, 1);
					lcd.print(aHIHAT_CLOSE[iNEXTBACK]);
					break;

					case 4:
					lcd.clear();
					lcd.print(aINSTRUMENT[iUPDOWN]);
					lcd.setCursor(0, 1);
					lcd.print(aSETTING[iNEXTBACK]);
					lcd.setCursor(12, 1);
					lcd.print(aHIHAT_PEDAL[iNEXTBACK]);
					break;

					case 5:
					lcd.clear();
					lcd.print(aINSTRUMENT[iUPDOWN]);
					lcd.setCursor(0, 1);
					lcd.print(aSETTING[iNEXTBACK]);
					lcd.setCursor(12, 1);
					lcd.print(aKICK[iNEXTBACK]);
					break;

					case 6:
					lcd.clear();
					lcd.print(aINSTRUMENT[iUPDOWN]);
					lcd.setCursor(0, 1);
					lcd.print(aSETTING_ADVANCE[iNEXTBACK]);
					lcd.setCursor(12, 1);
					lcd.print(aSETTING[iNEXTBACK]);
					break;
				}

				bButtonState = true;
			}

		// Instrument Sensors

			// Snare Drum
			if (iPiezoValue_A0 > aSNARE[0] && bSnareFlag == false) {

				for (int i = 0; i < aSETTING[0]; i++) {
					int iPeak_A0 = analogRead(A0);
					int iPeak_A1 = analogRead(A1);
					delay(1);
					if (iPeak_A0 > aSNARE[4]) {
						aSNARE[4] = iPeak_A0;
					}
					if (iPeak_A1 > aSNARE_RIM[4]) {
						aSNARE_RIM[4] = iPeak_A1;
					}
				}
				aSNARE[5] = aSNARE[4];
				aSNARE_RIM[5] = aSNARE_RIM[4];
				aSNARE[4] = map(aSNARE[4], aSNARE[0], aSNARE[1], 0, 127);
				aSNARE_RIM[4] = map(aSNARE_RIM[4], aSNARE_RIM[0], aSNARE_RIM[1], 0, 127);
				aSNARE[4] = (aSNARE[4] *  aSNARE[4]) / 127; // Curve setting

			//aSNARE_RIM[4] = (aSNARE_RIM[4] * aSNARE_RIM[4]) / 127;
				if (aSNARE[4] <= 1) {
					aSNARE[4] = 1;
				}
				if (aSNARE[4] > 127) {
					aSNARE[4] = 127;
				}
				if (aSNARE_RIM[4] <= 0) {
					aSNARE_RIM[4] = 0;
				}
				if (aSNARE_RIM[4] > 127) {
					aSNARE_RIM[4] = 127;
				}
				if (aSNARE_RIM[5] > aSETTING[1]) {
					MIDI.sendNoteOn(aSNARE_RIM[2], aSNARE_RIM[4], 1);   //(note, velocity, channel)
					MIDI.sendNoteOn(aSNARE_RIM[2], 0, 1);
					lcd.clear();
					lcd.print("SNARE RIM");
					lcd.setCursor(0, 1);
					lcd.print(aSNARE_RIM[4]);
					bSnareFlag = true;
				}

			//else if (aSNARE[5] > aSNARE_RIM[5])
				else {
					MIDI.sendNoteOn(aSNARE[2], aSNARE[4], 1);   //(note, velocity, channel)
					MIDI.sendNoteOn(aSNARE[2], 0, 1);
					lcd.clear();
					lcd.print("SNARE HEAD");
					lcd.setCursor(0, 1);
					lcd.print(aSNARE[4]);
				//lcd.setCursor(10, 1);
				//lcd.print(aSNARE_RIM[5]);
					bSnareFlag = true;
				}
			}

		// Hi-Hat Cymbal
			if (iPiezoValue_A2 > aHIHAT[0] && bHihatFlag == false) {
				for (int i = 0; i < aSETTING[0]; i++) {
					int iPeak_A2 = analogRead(A2);
					delay(1);
					if (iPeak_A2 > aHIHAT[4]) {
						aHIHAT[4] = iPeak_A2;
					}
				}
				aHIHAT[5] = aHIHAT[4];
				aHIHAT[4] = map(aHIHAT[4], aHIHAT[0], aHIHAT[1], 0, 127);
				aHIHAT[4] = (aHIHAT[4] * aHIHAT[4]) / 127;
				if (aHIHAT[4] <= 1) {
					aHIHAT[4] = 1;
				}
				if (aHIHAT[4] > 127) {
					aHIHAT[4] = 127;
				}
				if (iPiezoValue_A0 < aHIHAT_PEDAL[0]) {
					MIDI.sendNoteOn(aHIHAT[2], aHIHAT[4], 1);
					MIDI.sendNoteOn(aHIHAT[2], 0, 1);
					lcd.clear();
					lcd.print("HIHAT OPEN");
					lcd.setCursor(0, 1);
					lcd.print(aHIHAT[4]);
					bHihatFlag = true;
				}
				else if (iPiezoValue_A0 >= aHIHAT_PEDAL[0]) {
					MIDI.sendNoteOn(aHIHAT_CLOSE[2], aHIHAT[4], 1);
					MIDI.sendNoteOn(aHIHAT_CLOSE[2], 0, 1);
					lcd.clear();
					lcd.print("HIHAT CLOSE");
					lcd.setCursor(0, 1);
					lcd.print(aHIHAT[4]);
					bHihatFlag = true;
				}
			}

		// Hi-hat Pedal
			if (iPiezoValue_A0 > aHIHAT_PEDAL[0] && bPedalFlag == false) {
				MIDI.sendNoteOn(aHIHAT_PEDAL[2], aSETTING[2], 1);  // (note, velocity, channel)
				MIDI.sendNoteOn(aHIHAT_PEDAL[2], 0, 1);
				lcd.clear();
				lcd.print("HIHAT PEDAL");
				lcd.setCursor(0, 1);
				lcd.print(aSETTING[2]);
				bPedalFlag = true;
			}

		// Kick Drum
			if (iPiezoValue_A3 > aKICK[0] && bKickFlag == false) {
				for (int i = 0; i < aSETTING[0]; i++) {
					int iPeak_A3 = analogRead(A3);
					delay(1);
					if (iPeak_A3 > aKICK[4]) {
						aKICK[4] = iPeak_A3;
					}
				}

				aKICK[5] = aKICK[4];
				aKICK[4] = map(aKICK[4], aKICK[0], aKICK[1], 0, 127);
				aKICK[4] = (aKICK[4] * aKICK[4]) / 127;
				if (aKICK[4] <= 1) {
					aKICK[4] = 1;
				}
				if (aKICK[4] > 127) {
					aKICK[4] = 127;
				}
				MIDI.sendNoteOn(aKICK[2], aKICK[4], 1);
				MIDI.sendNoteOn(aKICK[2], 0, 1);
				lcd.clear();
				lcd.print("KICK");
				lcd.setCursor(0, 1);
				lcd.print(aKICK[4]);
				bKickFlag = true;
			}

// --- BEGIN 'Code in Progress' --- //
// --- I could be wrong, but this is what it appears to be --- and out of curiousity what is purpose of this sequence? -- //

			// I=(A0);  // Previous Code
			// -- DOES iSensorValue_A0 need to be declared as an integer?  How does this relate to iPiezoValue_A0?  -- //
			if (iSensorValue_A0 < (aSNARE[5] * (0.01 * aSNARE[3]))) {
				bSnareFlag = false;
			}
			if (iPiezoValue_A0 <= aHIHAT_PEDAL[0] && iPiezoValue_A2 < (aHIHAT[5] * (0.01 * aHIHAT[3])) && bHihatFlag == true) {
				delay(aSETTING[3]);
				// iSensorValue_A1 is reading analogRead(A2), but this is aHIHAT_PEDAL (which is analogRead(A2)
				int iSensorValue_A1 = analogRead(A2);
				if (iSensorValue_A1 < (aHIHAT[5] * (0.01 * aHIHAT[3]))) {
					bHihatFlag = false;
				}
			}
			if (iPiezoValue_A0 >= aHIHAT_PEDAL[0] && iPiezoValue_A2 < (aHIHAT[5] *(0.01 * aHIHAT[3])) && bHihatFlag == true) {
				delay(aSETTING[3]);
				int iSensorValue_A2 = analogRead(A2);
				if (iSensorValue_A2 < (aHIHAT[5] * (0.01 * aHIHAT[3]))) {
					bHihatFlag = false;
				}
			}
			if (iPiezoValue_A3 < (aKICK[5] * (0.01 * aKICK[3])) && bKickFlag == true) {
				delay(aSETTING[3]);
				// -- Should declared iSensorValue_A3 be iPiezoValue_A3?  iSensorValue_A3 is declared but not used anywhere??
				int iSensorValue_A3 = analogRead(A3);
				if (iPiezoValue_A3 < (aKICK[5] * (0.01 * aKICK[3]))) {
				bKickFlag = false;
				}
			}
			if (iPiezoValue_A0 <= aHIHAT_PEDAL[0] && bPedalFlag == true) {
				bPedalFlag = false;
			}

// --- END 'Code in Progress' --- //
		}
Hello Drum

Description:

circuit_x5tIBQ5SLw.png
Circuit x5tibq5slw
circuit_nZotR7rJMM.fzz
circuit_nZotR7rJMM.fzz


YOU MIGHT ALSO LIKE