19
7/21/2019 Arduino Xylophone http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 1/19 (/) let's make Explore (/tag/type-id/) Create (/about/submit.jsp) Contests (/contest/) Community (/community/) share what you make > (/editInstructable/)  (/id/intel/) (/tag/type-id/category-workshop/channel-gardening/?sort=FEATURED) (/tag/type-id/category-outside/channel-bikes/?sort=FEAT (/tag/type-id/category-technology/ Related (http://cdn.instructables.com/FQO/UQAX/H4AGIJOD/FQOUQAXH4AGIJOD.LARGE.jpg) (http://cdn.instructables.com/FE6/E2YJ/H4AG8XHH/FE6E2YJH4AG8XHH.LARGE.jpg) About This Instructable License: 75,151 views 212 favorites (/member/audreyobscura/) audreyobscura (/member/audreyobscur audreyObscura.com (http://www.audreyObscura.com  Follow i work at instructables! i make things with technology, eat pho, and play electric ukulele. 2653 Bio:  (/id/Googly-Eye-Bikini)  (/id/Peach-Berry-Tart)  (/id/Solar-Powered-Disco- Bike-Trailer) More by audreyobscura arduino (/tag/type-id/category-technology/keyword- arduino/) xylophone (/tag/type-id/category-technology/keyword- xylophone/) midi (/tag/type-id/category-technology/keyword-midi/) radioshack (/tag/type-id/category-technology/keyword- radioshack/) piezo (/tag/type-id/category-technology/keyword- piezo/) music (/tag/type-id/category-technology/keyword- music/) awesome (/tag/type-id/category-technology/keyword- awesome/) Tags: Arduino Uno Xylophone (http://www.instructables.c Uno-Xylophone/? utm_source=base&utm_m Arduino Uno Cat Xylophone (http://www.instructables.c Uno-Cat-Xylophone/? What is MIDI? (http://www.instructables.c is-MIDI/? utm_source=base&utm_m (/) Arduino Xylophone  by audreyobscura (/member/audreyobscura/)  C oll ec tio n I Made it!  Download (/id/Arduino-Xylophone/?download=pdf)  10 Steps  Favorite Share (/id/Arduino-Xylophone/) Login (/account/login) | Sign Up (/account/gopro?sourcea=header&sourceaUrl=/id/Arduino-Xylophone/?ALLSTEPS)

Arduino Xylophone

Embed Size (px)

DESCRIPTION

sdfghj rtyui ghjk jukl yui hj bn fgh hjk moe moemoemoemoemoemoemoemoememoemoemoemoe

Citation preview

Page 1: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 1/19

(/)

let's makeExplore (/tag/type-id/) Create (/about/submit.jsp) Contests (/contest/) Community (/community/)

share what you make >

(/editInstructable/) (/id/intel/) (/tag/type-id/category-workshop/channel-gardening/?sort=FEATURED)(/tag/type-id/category-outside/channel-bikes/?sort=FEAT(/tag/type-id/category-technology/

Related

(http://cdn.instructables.com/FQO/UQAX/H4AGIJOD/FQOUQAXH4AGIJOD.LARGE.jpg)

(http://cdn.instructables.com/FE6/E2YJ/H4AG8XHH/FE6E2YJH4AG8XHH.LARGE.jpg)

About This Instructable

License:75,151 views

212 favorites

(/member/audreyobscura/)

audreyobscura(/member/audreyobscur

audreyObscura.com(http://www.audreyObscura.com

Follow

i work at instructables! i make things

with technology, eat pho, and play electricukulele.

2653

Bio:

(/id/Googly-Eye-Bikini)

(/id/Peach-Berry-Tart)

(/id/Solar-Powered-Disco-Bike-Trailer)

More by audreyobscura

arduino (/tag/type-id/category-technology/keyword-

arduino/)

xylophone (/tag/type-id/category-technology/keyword-

xylophone/)

midi (/tag/type-id/category-technology/keyword-midi/)

radioshack (/tag/type-id/category-technology/keyword-

radioshack/)

piezo (/tag/type-id/category-technology/keyword-

piezo/)

music (/tag/type-id/category-technology/keyword-

music/)

awesome (/tag/type-id/category-technology/keyword-

awesome/)

Tags:

Arduino Uno Xylophone

(http://www.instructables.c

Uno-Xylophone/?

utm_source=base&utm_m

Arduino Uno Cat

Xylophone(http://www.instructables.c

Uno-Cat-Xylophone/?

What is MIDI?

(http://www.instructables.c

is-MIDI/?

utm_source=base&utm_m

(/)

Arduino Xylophone by audreyobscura (/member/audreyobscura/)

Coll ec tio n I Mad e i t!

Download (/id/Arduino-Xylophone/?download=pdf) 10 Steps

F avorite Share

(/id/Arduino-Xylophone/)

Login (/account/login) | Sign Up (/account/gopro?sourcea=header&sourceaUrl=/id/Arduino-Xylophone/?ALLSTEPS)

Page 2: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 2/19

(http://cdn.instructables.com/FXV/JW7Z/H4AG4YEP/FXVJW7ZH4AG4YEP.LARGE.jpg)

(http://cdn.instructables.com/F3C/23B9/H4AGJ8J1/F3C23B9H4AGJ8J1.LARGE.jpg)

(http://cdn.instructables.com/F9I/MYF8/H4AGJ86I/F9IMYF8H4AGJ86I.LARGE.jpg)

(http://cdn.instructables.com/FG2/C1VW/H4AGJ86J/FG2C1VWH4AGJ86J.LARGE.jpg)

(http://cdn.instructables.com/F5N/1GUB/H4AGJ8J3/F5N1GUBH4AGJ8J3.LARGE.jpg)

Musical MIDI Shoes

(http://www.instructables.c

MIDI-Shoes/?

MIDI Arduino Drums

(http://www.instructables.c

Arduino-Drums/?

utm_source=base&utm_m

Page 3: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 3/19

(http://www.radioshack.com/product/index.jsp?productId=2062351))

(x1) Single Core wire (Radioshack #278-1221

(http://www.radioshack.com/product/index.jsp?productId=2049742))

(x1) Printed Circuit Board (Radioshack #276-170

(http://www.radioshack.com/product/index.jsp?productId=2102846))

(x1) USB 2.0 Cord (Radioshack #26-714

(http://www.radioshack.com/product/index.jsp?

productId=2103977&clickid=prod_cs#))

(misc) Electrical Tape (Radioshack #64-2373

(http://www.radioshack.com/product/index.jsp?productId=2103347))

(misc) Heat shrink (Radioshack #55048444

(http://www.radioshack.com/product/index.jsp?productId=12656262))

The housing for the xylophone was easy to build. I used:

1/4" plywood

1/8" acrylic sheeting

wood glue

1/4" vinyl tubing

1 1/2" long machine screws.

2" masking tape

Tools:

laser cutter

scissors

cotton swabs

small flat head screw driver

Step 2: Free the Piezos, then solder longer leads.

For this project, I used piezo elements to detect when each note is struck on the

xylophone. These piezos detect vibration, or a knock. Often the elements come

in a housing, to protect the disc from being bent or smashed - but for this project

I needed to remove them from their plastic.

By gently pressing around the edges with my fingers, you could hear the gluecrack apart from the plastic, I loosened the bottom of the casing. Carefully, I

insterted a precision flat-head screw driver, and popped the bottom of the case

off.

The piezo element could then be removed from the outside of the housing.

Because I am using an Arduino Mega Board, I could have up to 16 Analog

(http://cdn.instructables.com/F0K/77N4/H4AGJFJL/F0K77N4H4AGJFJL.LARGE.jpg)

(http://cdn.instructables.com/F9I/MYF8/H4AGJ86I/F9IMYF8H4AGJ86I.LARGE.jpg)

(http://cdn.instructables.com/FKS/2BM0/H4AGICHE/FKS2BM0H4AGICHE.LARGE.jpg)

(http://cdn.instructables.com/F4V/6S8M/H4AGI66K/F4V6S8MH4AGI66K.LARGE.jpg)

(http://cdn.instructables.com/FNF/FZYJ/H4AGJ86L/FNFFZYJH4AGJ86L.LARGE.jpg)

Page 4: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 4/19

inputs, or 16 Piezos. I decided to just include an octave & a half, 12 notes, so I

used 12 piezos.

After they were free from their case, I soldered longer wires to each piezo

element, to prepare them to be inserted into the xylophone. When I was done

soldering longer leads on to each piezo, I wrapped my solder points with heat

shrink or electrical tape.

Step 3: The Bars and Housing.

I used CorelDraw to draft vector files that would guide the laser cutter for the

housing and bars of the xylophone.

The acrylic bars were each 10x2 inches. Each bar has two holes in them that

will guide a machine screw through the bar, and mount to the top panel of thewooden housing.

The wooden housing I designed is 10.5x30x3 inches. It forms a shallow box that

supports the electronics embedded within it. I used woodglue and a cotton swab

to secure all of the corners, and allowed 24 hours to cure before I sanded down

all of the edges.

The CorelDraw file for the base housing is attached to this step.

xylophone.cdr (/files/orig/FA7/95XS/H4AGJ93P/FA795XSH4AGJ93 P.cdr)16 KB

Step 4: Attach the Piezos to the Bars

(http://cdn.instructables.com/FY3/5J2H/H4AGDAKM/FY35J2HH4AGDAKM.LARGE.jpg)

(http://cdn.instructables.com/FDL/7S03/H4AGIJW4/FDL7S03H4AGIJW4.LARGE.jpg)

(http://cdn.instructables.com/FNB/78PM/H4AGJ3RY/FNB78PMH4AGJ3RY.LARGE.jpg)

(http://cdn.instructables.com/F47/TFY8/H4AGJFKP/F47TFY8H4AGJFKP.LARGE.jpg)

(http://cdn.instructables.com/FCK/A78A/H4DXIT0M/FCKA78AH4DXIT0M.LARGE.jpg)

(http://cdn.instructables.com/FXU/ITUO/H4AG8UDO/FXUITUOH4AG8UDO.LARGE.jpg)

Page 5: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 5/19

I threaded the Piezo wires through the middle holes in the top panel of the

housing. Then, I centered the piezo element on each acrylic bar, and used 2

inch blue masking tape to adhere the piezo to the bar.

Step 5: Attach the Bars to the top Panel.

(http://cdn.instructables.com/FRZ/4X9G/H4AG8W47/FRZ4X9GH4AG8W47.LARGE.jpg)

(http://cdn.instructables.com/F99/STGV/H4AG8UDP/F99STGVH4AG8UDP.LARGE.jpg)

(http://cdn.instructables.com/FLU/JFWG/H4AG8UDN/FLUJFWGH4AG8UDN.LARGE.jpg)

(http://cdn.instructables.com/FBE/6JD5/H4AGDAKL/FBE6JD5H4AGDAKL.LARGE.jpg)

(http://cdn.instructables.com/F9N/TVNQ/H4AG8W4E/F9NTVNQH4AG8W4E.LARGE.jpg)

(http://cdn.instructables.com/F72/6X9U/H4AG4YES/F726X9UH4AG4YES.LARGE.jpg)

Page 6: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 6/19

I used 1 1/2" machine screws and nuts to secure the bars to the wooden

paneling.

To prevent excessive shake or vibration on each bar, I decided to use vinyl

tubing as a shock absorber on each machine screw. With 12 bars, I used 24

machine screws and nuts, and 24 3/4" lengths of vinyl tubing. Thread the

machine screw through the bar, then the vinyl, and slip it into the paneling.

When the screw was through the panel, I was able to twist on the nut to fully

secure it to the panel.

All of these should only be finger-tight, to avoid stress on the paneling, or on the

bar.

(http://cdn.instructables.com/FJS/QZY5/H4AGJ3RW/FJSQZY5H4AGJ3RW.LARGE.jpg)

(http://cdn.instructables.com/FX8/FOO5/H4B2N8VG/FX8FOO5H4B2N8VG.LARGE.jpg)

(http://cdn.instructables.com/FY5/RMWM/H4AFS68E/FY5RMWMH4AFS68E.LARGE.jpg)

(http://cdn.instructables.com/FQC/SFG1/H4AGI66H/FQCSFG1H4AGI66H.LARGE.jpg)

Page 7: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 7/19

Step 6: Build the circuit.

(http://cdn.instructables.com/FB6/VMRG/H4AGICO1/FB6VMRGH4AGICO1.LARGE.jpg)

(http://cdn.instructables.com/FQT/THOY/H4B2N8VE/FQTTHOYH4B2N8VE.LARGE.jpg)

(http://cdn.instructables.com/F2C/9VZ1/H4B2N8VF/F2C9VZ1H4B2N8VF.LARGE.jpg)

(http://cdn.instructables.com/FKE/HKRM/H4B2N8VB/FKEHKRMH4B2N8VB.LARGE.jpg)

(http://cdn.instructables.com/FJW/04UK/H4B2N8VC/FJW04UKH4B2N8VC.LARGE.jpg)

(http://cdn.instructables.com/FXR/9Y4D/H4AGJ3RU/FXR9Y4DH4AGJ3RU.LARGE.jpg)

(http://cdn.instructables.com/F9F/59XL/H4AFS68D/F9F59XLH4AFS68D.LARGE.jpg)

Page 8: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 8/19

Before connecting the piezos to the Arduino, I connected a 1-megohm resistor in

parallel to the Piezo element to limit the voltage and current produced by the

piezo, and to protect the analog input ports on the Arduino. On the PCB, I

marked with a permanent marker which piezo goes to each analog input port on

the Arduino. I also made the same markings on the back of the top wooden

panel.

After I soldered the resistors into place, I ran a small jumper wire from one end

of the resistor, to the longest rail on the PCB, and designated it my ground rail.Next, I soldered all of the piezos' ground wires into place, in line wtih the same

end of each grounded resistor. The positive lead from the piezos is soldered in

to the same rail as the other end of each resistor.

I cut 12 lengths of green wire to be my "signal wire" to the Arduino. Each signal

wire is soldered into the same positive resisted rail of the piezo.

The fritzing (http://fritzing.org/) diagram file is attached to this step.

Step 7: Connecting to the Arduino

(http://cdn.instructables.com/FY3/GKU5/H4AGJ3MT/FY3GKU5H4AGJ3MT.LARGE.jpg)

Page 9: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 9/19

I took all of the signal wires, and the ground wire running from the PCB and

marked each one with blue masking tape, writing which port each wire was

designated to. I then fed all of the marked single core wire into the

corresponding ports of the Arduino.

All remaining Analog ports must be grounded! Otherwise it will affect your serial

output from the arduino. I used 4 black wires, running from the ground rail of the

PCB directly to the open analog ports of the Mega board. (A12, A13, A14, and

A15)

When you have completed your circuit, you can load the xylophone program, or

sketch, onto the Arduino board from the Arduino Developing Environment

(http://arduino.cc/en/Main/Software).

Here is the sketch I used.

//*******************************************************************************************************************

// Transmit MIDI Message

//*******************************************************************************************************************

void MIDI_TX(byte MESSAGE, byte PITCH, byte VELOCITY)

status1 = MESSAGE + midichannel;

Serial.write(status1);

Serial.write(PITCH);

Serial.write(VELOCITY);

Step 8: Power and communication.

(http://cdn.instructables.com/FXK/8UWG/H4AGI66A/FXK8UWGH4AGI66A.LARGE.jpg)

(http://cdn.instructables.com/F0B/DB18/H4AGIJOF/F0BDB18H4AGIJOF.LARGE.jpg)

(http://cdn.instructables.com/FKE/HKRM/H4B2N8VB/FKEHKRMH4B2N8VB.LARGE.jpg)

Page 10: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 10/19

The Arduino can be powered via USB, which doubles as a communication port. I

ran a USB cable through the housing of the xylophone. By drilling a small hole,

that was big enough for the ends of the cable, I could hide most of the USB cordin the housing.

I drilled a second hole to hold my mallots.

Step 9: Serial to Midi

(http://cdn.instructables.com/FNH/V66S/H4AFZHFF/FNHV66SH4AFZHFF.LARGE.jpg)

(http://cdn.instructables.com/F9V/9LS4/H4AFSEU2/F9V9LS4H4AFSEU2.LARGE.jpg)

(http://cdn.instructables.com/FKY/UPXP/H4AFSEU6/FKYUPXPH4AFSEU6.LARGE.jpg)

(http://cdn.instructables.com/FPA/OTDZ/H4AGDGVF/FPAOTDZH4AGDGVF.LARGE.jpg)

anouskadg(/member/anouskadg/)

oined May 9th 2014

Follow

Messag

recipientId=MU3GIGMHUY4

5

Instructables

10

Collections

48,676 Views

14 Favorited

78

Page 11: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 11/19

To get the xylophone coupled with my comptuer I used software called Hairless

(http://projectgus.github.com/hairless-midiserial/). It converts the serial out signal

from the Arduino into a MIDI signal that programs like GarageBand, Logic, and

Ableton can read and record. Be sure that the bridge is running before you try

and import MIDI data from the xylophone.

Note: Disable the bridge while trying to update the sketch on the Arduino board.

You cannot have the bridge running while trying to communicate to the board

from the Arduino software.

Step 10: Jam it!

After you are up and running, you can play the xylophone like drums. Record

your beat track. Then kick change the MIDI instrument to a bass synth, and

(http://cdn.instructables.com/FNJ/WA5C/H4AGIEMZ/FNJWA5CH4AGIEMZ.LARGE.jpg)

(http://cdn.instructables.com/FY6/CQ37/H4AFSEU7/FY6CQ37H4AFSEU7.LARGE.jpg)

(http://cdn.instructables.com/FID/3E63/H4AGIEN3/FID3E63H4AGIEN3.LARGE.jpg)

Page 12: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 12/19

We have a be nice comment pol icy.

Please be p ositive and constructive.

I Mad e it ! Ad d I ma ge s Make Comme nt

(/member/sonicmanipulator/)

8 days ago Reply

(/member/anouskadg/)

4 days ago Reply

(/member/RichusLV/)

5 days ago Reply

(/member/blackcamo/)

13 days ago Reply

(/member/lpeavey/)

1 year ago Reply

(/member/massodax/)

2 months ago Reply

(/member/NarWhaLs15/)

1 year ago Reply

(/member/jeff.evans.5855/)

7 months ago Reply

record a rhythm track. Finally turn it back into a xylophone and create a melody

track for the best song ever. This thing is a lot of fun!

sonicmanipulator (/member/sonicmanipulator/)

Hi.......I thought the sketch would be perfect for my drum pads but when I

compiled it it said this - sketch_Piezo1.ino:11:64: error: too many initializers for

'char [6]'

Error compiling.

Mmmmmm I'm a newbe so not sure how to fix.

Claude

anouskadg (/member/anouskadg/) sonicmanipulator

Change 'char pinAssignments[6] ' at the top of the code to 'char

pinAssignments[16] ' and it'll work ;)

RichusLV (/member/RichusLV/)

Is it possible to get only one note for each piezo?

blackcamo (/member/blackcamo/)

arduino - educational FUN! and it is cheap as chips now...

https://sites.google.com/site/arduinouk/

lpeavey (/member/lpeavey/)

Must you use the exact piezo elements from Radioshack? Will any piezo

elements work?

massodax (/member/massodax/) lpeavey

there is plenty of "ready to use" project piezo elements for this project )

http://www.ebay.com/sch/i.html_odkw=10PCS+Piezo+El...

(http://www.ebay.com/sch/i.html_odkw=10PCS+Piezo+Elements+Sound

but carefully make a choice of the size what you need

NarWhaLs15 (/member/NarWhaLs15/) lpeavey

You don't need to use the Piezo elements from Radioshack (I hope).

Here are the ones from Sparkfun:

https://www.sparkfun.com/products/10293

(https://www.sparkfun.com/products/10293)

Hope this helped!

jeff.evans.58 55 ( /member/jeff.evans.5855/)

Page 13: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 13/19

(/member/joeyjerry/)

9 months ago Reply

(/member/carter714/)

10 months ago Reply

(/member/audreyobscura/)

10 months ago Reply

This is what I'm looking for. I have a Korg Nano Key controller that I use now to

input notes into my Finale music composition program. It uses USB also. Being a

percussionist, I am interested in building a midi "marimba" to input notes.

I see that you have used 12 notes in your project. I would like to make a 25 note, 2

octave chromatic (both naturals and accidentals) instrument to use when

composing.

I know the Arduino Mega has 16 inputs. Would I need a multiplex to accommodate

all the keys? Also, what would the code be to add more notes, including

accidentals? Could it be so simple to connect the piezo from each bar to the

corresponding keys on the controller that I already have? Any suggestions or

pointers would be very appreciated. Thanks.

joeyjerry (/member/joeyjerry/)

are these pads velocity sensitive?

And do we have to make any changes when we are making a drumkit in this

way?

carter714 (/member/carter714/)

My son and I made this project together. We had a hard time getting the

proper response from the note keys. When we watched the keyboard view in

Garageband we noticed a few different notes were sometimes playing when

we struck only one key. We isolated the problem to vibration. We replaced thevinyl tubing with rubber and felt pads with a through hole drilled into them. This

isolated only the note we wanted to play.

We had to change the code a bit to get all 12 keys to play. I do not know why

the changes worked since this was our first project, but we studied other code

and experimented until everything worked as expected.

This is a great project, fun, interesting, challenging, and we ended up with this

really cool device that can be easily switched to produce a wide range of

instrument sounds as the original author explained.

The few lines of code we modified were as follows:

We changed the pinAssignments to [12]. In fact we switched all arrays to [12].

We changed the char pinAssignments to an int function.

We removed all single quotes from the pinAssignments [12] =A0,A1, ...n

Changed PadCutOff values to 40

Changed MaxPlaytime values to 70

Changed byte status1; to byte status;

Set hitavg = 127;

We used a note off value of 128 instead of the note on with velocity 0 in the

MIDI_TX(128,PadNote[pin], 0)

And in the Transmit MIDI section we changed the status1 statement to status.

Again, I do not know if these were required to make our project work or why it

made it work, but it did and we wanted to share and tell everyone that this is a

great project to build.

(http://cdn.instructables.com/F1F/SVD0/HVS19M7Y/F1FSVD0HVS19M7Y.LARGE.jpg)

audreyobscura (/member/audreyobscura/) (author) carter714

So AWESOME! So glad it worked <3 it's pretty

fun. I am in the process of overhauling this

project based on the code suggestions made on

this comment thread. I really appreciate such an

awesome community, its wonderful that this little

project has become so collaborative :D

johnb28 (/member/johnb28/)

Page 14: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 14/19

(/member/johnb28/)

1 year ago Reply

(/member/cchisholm1/)

11 months ago Reply

(/member/audreyobscura/)

1 year ago Reply

11 months ago Reply

(/member/cchisholm1/)

Hi guys. I made some progress on this . But I can't seem to figure out why my

piezos and spitting out all kinds of wacky data. here is some the debug MIDI

messages from the Hairless MIDI bridge application.

This is all from successive stries of the same xylophone key. I would thin it

should always be putting out the same note number just with differing

velocities. I seem to be getting all kinda of notes and ask pitch bending

information, which makes for wacky sounds in my audio program (Logic). Any

ideas? I have it hooked up like instructed..

john

(http://cdn.instructables.com/F0D/YQ4K/HTCNIUTS/F0DYQ4KHTCNIUTS.LARGE.jpg)

cchisholm1 (/member/cchisholm1/) johnb28

I was having a similar problem to yours and this is what I did to get it

working.

Hey Guys! I just finished this project. Few things to consider for thoseof you having problems.

First: you need to make sure that your pins are initialized as "int" NOT

"char" otherwise you might only have a few of your keys work.

Second: make sure the baud number/ serial port number is set to

115200 both in the code and in your serial to MIDI converter. I used

Hairless so it should be under File-> Preferences

Third: (only applies to Ableton and Windows users users) Make sure

that you use loopMIDI to create a virtual MIDI port and that serial to

MIDI converter (Hairless) is set so that the MIDI Out is loopMIDI Port

and MIDI In is set to loopMIDIPort. From there go into Ableton and set

the Control Surface to "None" and Input as loopMIDI Port and Output

as loopMIDI Port. .

Hope this helps!!This is a super fun project

audreyobscura (/member/audreyobscura/) (author) johnb28

Huh....thats a new one. I wonder if boosting the

resistors would curb that. or don't qualify 4 of the

Analog ins in the beginning of the sketch - so try it

with A0-A11 for your inputs?

Hey Guys! I just finished this project. Few things to consider for those of you

having problems.

First: you need to make sure that your pins are initialized as "int" NOT "char"

otherwise you might only have a few of your keys work.

Second: make sure the baud number/ serial port number is set to 115200 both

in the code and in your serial to MIDI converter. I used Hairless so it should be

under File-> Preferences

Third: (only applies to Ableton and Windows users users) Make sure that you

use loopMIDI to create a virtual MIDI port and that serial to MIDI converter

(Hairless) is set so that the MIDI Out is loopMIDI Port and MIDI In is set to

loopMIDIPort. From there go into Ableton and set the Control Surface to

"None" and Input as loopMIDI Port and Output as loopMIDI Port. .Hope this helps!!

This is a super fun project

cchisholm1 (/member/cchisholm1/) made it!

Page 15: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 15/19

(/member/johnb28/)

1 year ago Reply

(/member/audreyobscura/)

1 year ago Reply

(/member/johnb28/)

1 year ago Reply

(http://cdn.instructables.com/F90/W8G9/HU77OAW5/F90W8G9HU77OAW5.LARGE.jpg)

johnb28 (/member/johnb28/)

One more thing.. I think there was a small typo in the code...I could only get itto work when I used this instead of the line that was in there: char

pinAssignments[16] =

audreyobscura (/member/audreyobscura/) (author) johnb28

Awesome! There very well could be - do you mind

emailing me your finished .ino file?

[email protected]

I recently tried to revive this project in a different

form and ran into some strange behavior. I thought it

was because I was trying to use an arduino

micro......

Thanks!

Audrey

johnb28 (/member/johnb28/) audreyobscura

Hi Audrey.

this code below seems to work. the only issue Im having now is that

when I strike , it seems to trigger multiple notes. not sure if its because

of excessive vibration or the code... The attached picture is what I get

from hitting it twice, so instead of hearing clear tones, Im hearing a

combination of xylophone tones in Logic. Did you ever have that

problem?

Getting close!

int pinRead;

char pinAssignments[16] =

'A0','A1','A2','A3','A4','A5','A6','A7','A8','A9','A10','A11','A12','A13','A14','A

byte PadNote[16] =

57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72; // MIDI notes from

0 to 127 (Mid C = 60)

int PadCutOff[16] =

100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100;

// Minimum Analog value to cause a drum hit

int MaxPlayTime[16] =

90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90; // Cycles before a

2nd hit is allowed

#define midichannel 1; // MIDI channel from 0 to 15 (+1 in "real world")

boolean VelocityFlag = true; // Velocity ON (true) or OFF (false)

//********************************************************************************

// Internal Use Variables

//********************************************************************************

boolean activePad[16] =

0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; // Array of flags of pad currently playing

int PinPlayTime[16] =

0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; // Counter since pad started to play

byte status1;

int pin = 0;

int hitavg = 0;

Page 16: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 16/19

//********************************************************************************

// Setup

//********************************************************************************

void setup()

Serial.begin(115200);

//********************************************************************************

// Main Program

//********************************************************************************

void loop()

for(int pin=0; pin < 16; pin++) //

//int pin = 3;

// for (pinRead=0; pinRead < 16, pin++)

hitavg = analogRead(pinAssignments[pin]);

//Serial.println(hitavg);

// read the input pin

if((hitavg > PadCutOff[pin]))

if((activePad[pin] == false))

if(VelocityFlag == true)

// hitavg = 127 / ((1023 - PadCutOff[pin]) / (hitavg - PadCutOff[pin])); //

With full range (Too sensitive ?)

hitavg = (hitavg / 8) -1 ; // Upper range

else

hitavg = 127;

MIDI_TX(144,PadNote[pin],hitavg); //note on

PinPlayTime[pin] = 0;

activePad[pin] = true;

else

PinPlayTime[pin] = PinPlayTime[pin] + 1;

else if((activePad[pin] == true))

PinPlayTime[pin] = PinPlayTime[pin] + 1;

if(PinPlayTime[pin] > MaxPlayTime[pin])

activePad[pin] = false;

MIDI_TX(144,PadNote[pin],0);

//********************************************************************************

Page 17: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 17/19

(/member/johnb28/)

1 year ago Reply

(/member/phisitja/)

1 year ago Reply

(/member/Kosmo2/)

1 year ago Reply

(/member/brassclams/)

2 years ago Reply

(/member/bricabracwizard/)

2 years ago Reply

(/member/Simpson_jr/)

1 year ago Reply

// Transmit MIDI Message

//********************************************************************************

void MIDI_TX(byte MESSAGE, byte PITCH, byte VELOCITY)

status1 = MESSAGE + midichannel;

Serial.write(status1);

Serial.write(PITCH);

Serial.write(VELOCITY);

(http://cdn.instructables.com/F9I/LNNQ/HTD7SONA/F9ILNNQHTD7SONA.LARGE.jpg)

(http://cdn.instructables.com/FCV/JNE6/HTD7SOOG/FCVJNE6HTD7SOOG.LARGE.jpg)

johnb28 (/member/johnb28/)

Hi. Great project. One thing Id point out that I overlooked is the oversized tabs

on the case. I know you made yours with wood and it indicates your sanded

them down. I may have missed that important point. I went and had some

plexiglass laser cut with the .cdr file you attached not realizing that. So,

everything fits together but obviously the tabs extend longer than they need to.

And this material doesnt sand as easily as wood. Just something to consider.

phisitja (/member/phisitja/)

thank you for your information and detail project.

Kosmo2 (/member/Kosmo2/)

We cant buy radio Shack parts in Canada, can you recommend an equivelant

Piezo Element that we could maybe pick up elsewhere ?

Thanks

Mick

brassclams (/member/brassclams/)

Is it possible to use an Arduino Uno? Sorry, I haven't read through your tutorial

yet; maybe you explain there why the Mega is necessary.

Robert

bricabracwizard (/member/bricabracwizard/) brassclams

This uses 16 output pins, UNO has 14 so you could

make a xylophone with 14 notes instead of 16.

Simpson_jr (/member/Simpson_jr/) bricabracwizard

Not exactly true, this uses a lot of _analog input_ pins and the Uno only

got 6 of those. The compiled code does consume less then 5 KB

though, with some creative programming and analog multiplexers like

the 4051 or 4067 an Uno or even oldest 8KB-arduino would be up to

the task.

Page 18: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 18/19

(/member/dBange/)

1 year ago Reply

(/member/agomes6/)

2 years ago Reply

(/member/mmorlan62/)

2 years ago Reply

(/member/LoveDrums/)

2 years ago Reply

(/member/dworki/)

2 years ago Reply

(/member/zvizvi/)

2 years ago Reply

(/member/neoroman/)

2 years ago Reply

(/member/naturalist71261/)

2 years ago Reply

(/member/fjordcarver/)

2 years ago Reply

(/member/janw/)

2 years ago Reply

(/member/elhobe/)

2 years ago Reply

dBange (/member/dBange/)

Nice!!! I'll try to do this :D

agomes6 (/member/agomes6/)

I just cited this here: http://www.instructables.com/id/Simon-Game-Xylophone-

Version/

Hope someone merges them :)

mmorlan62 (/member/mmorlan62/)

I love a project with a tool list that starts with "laser cutter." I'll just pick that up

at the local Home Depot. :-)

Thanks for sharing the project.

LoveDrums (/member/LoveDrums/)

That's tremendous!

dworki (/member/dworki/)

if(VelocityFlag == true) ... :-D ... I still remember a teacher LOLing at me

looking at similar code I wrote ... what about if (velocityFlag) ... or if

(velocityEnabled) ... makes the code cleaner.

But otherwise i like this instructable. Nice idea.

zvizvi (/member/zvizvi/)

Very neat! great i'ble, clear and super fun

In case you don't want to source a Mega just for those extra analog ins, I'd

consider using a 4051 multiplexer

(http://www.arduino.cc/playground/learning/4051)

neoroman (/member/neoroman/)

Wow great...! I want to make it for my daughter.

naturalist71261 (/member/naturalist71261/)

Groovy idea, nice clean job too! I'll bet that your father is proud of you!

fjordcarver (/member/fjordcarver/)

Huzzah! Beautiful. Thanks for this!

janw (/member/janw/)

Awesome project!

As a trained musical instrument builder, I can only look at it and love it

instantly. It would be even nicer if it had the typical shape of a Xylophone

where the higher notes have smaller bars than the lower ones.

Maybe you should call it an Acrylophone as xylophone comes from the Greek

´xylos´ what means wood.

elhobe (/member/elhobe/)

it's a fantastic project! play notes via midi with a manual input is cool and fun!

Thank's for sharing :)

agomes6 (/member/agomes6/)

Page 19: Arduino Xylophone

7/21/2019 Arduino Xylophone

http://slidepdf.com/reader/full/arduino-xylophone-56da63eb131b6 19/19

(/member/agomes6/)

2 years ago Reply

(/member/mamalove/)

2 years ago Reply

(/member/Penolopy+Bulnick/)

2 years ago Reply

We have a be nice comment pol icy.

Please be p ositive and constructive.

I Mad e it ! Ad d I ma ge s Make Comme nt

I like this so much that I will give it a try in a smaller scale 3D printed version

with dig inputs for standard arduino usage....will keep you posted!!!

Congrats though, keep them coming :)

mamalove (/member/mamalove/)

BEYOND SUPER!

Penolopy Bulnick (/member/Penolopy+Bulnick/)

That is awesome! I didn't know you were done. It looks great :D

About Us

Who We Are (/about/)

Advertise (/ advertise/)

Contact (/about/contact.jsp)Jobs (/community/Positions-available-at-Instructables/)

Help (/id/how-to-write-a-great-instructable/)

Find Us

Facebook (http://www.facebook.com/instructables)

Youtube (http://www.youtube.com/user/instructablestv)

Twitter (http://www.twitter.com/instructables)

Pinterest (http://www.pinterest.com/instructables)

Google+ (https://plus.google.com/+instructables)

Tumblr (http://instructables.tumblr.com)

Resources

For Teachers (/teachers/)

Artists in Residence (http://www.autodesk.com/ar tist-in-residence/home)

Gift Pro Account (/account/give?sourcea=footer)

Forums (/community/)

Answers (/ tag/type-question/?sort=RECENT)

Sitemap (/sitemap/)

Go Pro Today » (/account/gopro?sourcea=footer)

We're Hiring! » (/community/Positions-available-at-Instructables/)

Mobile

Download our new apps for iOS,

Android and Windows 8!

Android

(https://play.google.com/store/apps/details?

id=com.adsk.instructables)

iOS

(https://itunes.apple.com/app/instructables/id586765571)

Windows

(http://apps.microsoft.com/windows/en-

us/app/7afc8194-c771-441a-9590-

54250d6a8300)

Join our newsletter:

Terms of Service (http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) |

Privacy Statement (http:// usa.autodesk.c om/adsk/servlet/item?siteID=123112&id=21292079) |

Legal Notices & Trademarks (http:// usa.autodesk.c om/legal-notices-trademarks/) | Mobile Site (http://m.instructables.com)

(http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)

Join!

© 2015 Autodesk, Inc.

Englishenter email