Saturday, August 11, 2012

Midi Controller: Hardware working :)

Woo! I have got the hardware side working! Finally :3

I started with the pressure sensor. and that went off without a hitch. Initially I was getting the same values, of about ~5mV when blowing full tilt. Reminds me of playing my real flute, as I was getting dizzy :P

Looking carefully at how I was sending the air down the tubes, I realized two things, that the Y joint was pointing the wrong way, so when I blow down the tube, the air actually has to bend around the Y connector before hitting the sensor. Switching the Y connector so that the air pressure smoothly hits the sensor helped alot.

Next, as I totally didn't get a valve, I used a zip tie to decrease the diameter of the outlet pipe. In doing so, I could get values in the range of ~10mV! Further tightening of the gap allowed me to get voltages in excess of 15mV, but to reach 15mV, I had to apply *alot* of breath pressure, and it felt really uncomfortable.

I re-adjusted so that the sensor would allow ~10mV at a pressure that didn't feel too uncomfortable, and proceeded to hook up the rest of the parts.

Next up, was the voltage converter to power the instrumentation amplifier. The amplifier requires +/- voltage to allow amplification of negative signals, e.g. audio, though in our case, I only need positive voltages. But oh well.

I'm not sure why, but the Si7661 refused to give me a negative voltage, only giving me 0V from the output terminal with a 5V input. Checking the spec sheet, the minimum input is 4.5V, and the arduino was providing voltages above that, so I have no idea what was up. On the verge of giving up, I connected the 10V out (for powering the MPX2010GSX) into the Si7661 and hey, presto! I got +/- 10VDC. Sweet :3

I wanted only +/-5V for maximum swing of the amplifier downstream; +/-10V is ok I think, given that I'm setting the gain to hit about 5V max anyways.

(Note to self: See ICL7660 for lower voltage voltage converter)

After a short break (read: gaming), I plonked down the INA114AP Instrument Amplifier and set it up so that the gain G = 500 with a 100 ohm resistor. I can't believe how simple it was to get that working. The two 0.1uF caps (the orange things) are amusingly larger than the IA itself.

Connected the outputs of the breath sensor to the inputs of the instrument amplifier, and connected the outputs of the amplifier to the multimeter, then gingerly connected power....

And WOOT! It works! I was getting about 5V at peak blowing pressure - which is perfect for the Arduino's analog inputs. However, at rest, the readout from the multimeter gave me a value of -0.06V. So, about 60mV, negative. I'm not sure why this is so, but I need to get some offset voltages going.

I think this can be done by doing two stage amplification; the first stage as unity gain plus offset control, then the 2nd stage for the usual amplification with V- tied to ground.

According to the data sheet though, Vref can be used with another op amp and several other components to compensate for offset. That's another option. Probably easier too.

In the meantime however, I think this _should_ be good enough to write the software on the arduino that allows me to control CC2 on my daw :3

On the software side, I'm wondering if there is a need to filter the input data off the analog input. Part of me says yes, filter the damned thing with at least a small moving window filter given as we have time between sending midi messages. Another part of me says, that's not natural, we should just send what's there, noise and all over to the daw.

Meanwhile, as the struggle for filter vs non filtering goes on, it's time to hit publish, shut off the browser and go save the world. In a game world of course ;-)

DISCLAIMER: What you read above is me sharing what I've experienced; if it doesn't work for you and damages stuff, don't come looking for me...

No comments: