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.
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...
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.
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.
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.
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 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?
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.