Pressure Sensors Drum Trigger problem

I'm having problems programming code to get the pressure sensors to trigger MIDI drum events. I made them from conductive foam like the nice folks at fluidforms showed me.

I can't figure out how to get it to not spit out a stream of numbers after it gets above a programmed threshold. What I'm looking for is a peak detection algorithm for C i believe. Local maxima as they call it. At this point any solution would do.

I was thinking maybe toggle something so it doesn't trigger again until it goes below threshold. But programming that, it just spits out the first number read after threshold.(not velocity sensitive)

That, and sometimes I might want to trigger again while never getting fully back down below threshold. (these things are being placed in my shoes so gravity is an issue.)

Any help would be much appreciated. I've been tearing my hair out for three days tryna research and program this.

do you mean you want it to go to a certain threshold, and then just change to a constant value?

try something like this:

if (val1 > yourthreshold)
val2 = 1
val2 = 0

that should work i think... by the way: val1 is the incoming value, val2 is either 1, which means on, or 0, which means off, and yourthreshold is how high your threshold is...

good luck, hope this helped!

I'm trying to get velocity sensitive with it.

The problem is the data polling goes so fast that it just returns the first number right after threshold is reached with a toggle like that.

If this takes forever I may just use your method, and scrap the velocity sensitivity bit, but that means I also can't use my velocity sensitive Interlink FSRs because it's the same concept.

I want it to detect when a local maximum (peak detection) is reached and spit out the value as a midi note.

Thanks for the input though. I really extremely appreciate how cool of a community this is. I'd probably use a normally open spring loaded switch for a boolean toggle like that.

My goal is to have a bluetooth wireless MIDI getup, with foot triggers, four other pads, and all the switches that'll fit into the board.

After that it's on to multiplexing to get insane with it.

TodBot has an algorithm for doing that right here:

TodBot has an algorithm for doing that right here:

Spooky Arduino Projects #4 – Musical Arduino – todbot blog

I wish it were that easy. There are a number of reasons that piezo trigger algorithm wont work with these conductive foam triggers. I tried it already.

Actually I found something close to what I need, though I don't know how I would go about looping and running this with six sensors and eleven switches. ONe problem though is it waits till it reaches less than threshold to trigger (the foam takes a little bit to decompress), though at this point I'm not going to get picky.

It's here:

Proper Respect Due to Tom Igoe for that one.

I might just put a switch in my shoe and only sample the resistance when pressed.

well, scratch that phase of the project.

After getting the software working it appears that the conductive foam sensors are so inaccurate for pressure sensitivity that one would definately be better off just using a spring loaded normally open switch.

Phase II, Flexiforce sensors or maybe some of this pressure sensitive rubber from zoflex on interdigital pads.

THe interlink stuff appears to be way too sensitive for foot switchs, though I'm considering trying one in a controlled housing.

Any advice would be appreciated.


Did you ever get this project working at all? i've been trying to figure out how to do something similar. I want midi triggers inside of shoes that will play drum samples. I was thinking about trying to use homemade piezo type triggers with a wireless doorbell to send the information to a laptop, but I don't think that the wireless doorbell will give any sort of velocity information.

I did get this project working to great success.

Velocity algorithms from analog sensors aren't the easiest to code for, just a warning.

I scrapped pressure sensors and ended up using accelerometers strapped to my ankles and xbee radios transmitting MIDI data.

If you're doing doorbell/garage door opener type stuff you'd be best just using a spring loaded switch in a boot. It'd be easier to code for as well.

Very interesting idea! I play drums and I might want to use some of your ideas!


I am working on a similar project, and I am curious if you have had any success with bluetooth instead of xbee. i am using the sparkfun bluemate and I am getting considerable end-to-end latency (~100ms!), which I believe I can attribute to the BT itself and not my arduino code or sound generation code. Do you know if BT in general is low enough latency to be usable for drum trigger applications?


100ms is not acceptable.

I don't know about the characteristics of blue tooth because I rejected the standard early on after I found out getting out of radio range screws your session up and you have to restart and log back in.

You can get to the edge of xbee range and if you drop out a little when you come back into range your network is still linked.