A position sensitive midi drum pad

 by ganglion
Featured

Step 8: Building the circuit

p1010015.jpg
input-buffer.png
The pad uses a very simple electronic circuit to feed the sensor signals from the pad into the arduino. All this really does is make a false ground at half the 5v power supply produced by the arduino. The circuit diagram is attached below - I don't want to describe every step you need to take to build this on breadboard or stripboard, but it's not too hard.

 
Remove these adsRemove these ads by Signing Up
H4T says: Nov 28, 2010. 2:13 PM
I was wondering if you could generally explain how your circuit works? Am I correct in thinking that your circuitry on the left is basically a fancy diode / one-way valve? It looks to me like it is supplying a constant 5V power to all piezo sensors when none of them are in use, and uses the op-amp to supply voltage directly from the piezo sensors themselves if they are hit with enough force to overcome the 5V battery.

But I was just wondering, why not just use a diode?
ganglion (author) in reply to H4TNov 28, 2010. 3:24 PM
The reason for using that circuit is because I wanted to be able to track negative going as well as positive going pulses from the piezo. When you hit it, it starts going positive, then oscillates both negative and positive. If the negative terminal of the piezo was just connected to the ground of the arduino, the negative part of the pulse would be below ground, and wouldn't be picked up by the ADCs.

What this circuit does is to halve the input voltage using a voltage divider, then use an opamp / transistor buffer to provide a constant voltage at that level (roughly 2.5 volts). Then when the voltage from the piezo goes negative, it's relative to that 2.5 volt false ground, not to the ground of the arduino.

The program on the arduino does a short calibration when it starts up to work out what the resting voltage from each piezo is. That value is then subtracted from each reading.

There might be better / simpler ways of doing this, but that's the way I did it in my first version, which I'm still using, and it seems to work ok.
H4T in reply to ganglionDec 12, 2010. 2:47 PM
cool, thanks!

I've taken another look at the circuit and brought up the datasheet for the TS912 and noticed a problem. In your schematic you have your ~2.5V output of the voltage divider section going into pin 1 of the TS912. According to the datasheet below, pin 1 is for output....are the pin numbers just incorrect in your schematic, or did you use a slightly different chip?

http://www.st.com/stonline/products/literature/ds/2325/ts912.pdf
ganglion (author) in reply to H4TDec 12, 2010. 4:46 PM
P.S. I can't get the circuit designer I'm using (GNU EDA) to remove the wrong pin numberings from the op amp, so I've just put up a new version with no numbers. The '+' and '-' signs on the inputs should be enough for people to read the schematic, I think.
H4T in reply to ganglionDec 12, 2010. 5:27 PM
Thanks, things make a little more sense now! :P

Did you also happen to change the resistor values across each piezo from 10M to 1M? Or am I remembering it wrong?
ganglion (author) in reply to H4TDec 13, 2010. 2:41 AM
They were always 1M as far as I remember.
ganglion (author) in reply to H4TDec 12, 2010. 4:35 PM
Sorry about that. You are right that the pin numberings are wrong on my circuit. I'll put up a corrected version in a minute.

The 2.5v divider should be feeding into the non-inverting input of the op-amp (pin 3), the feedback from the resistor should be on the inverting input (pin 2), and the output to the piezos should be on pin 1. It wouldn't hurt as well to put a high value electrolytic capacitor (100 uf?) across the 100 ohm resistor to make sure that the current into the piezos isn't drawing the ~2.5V rail up or down in voltage.
wrybread in reply to ganglionMar 29, 2011. 4:05 PM
Thanks for the fantastic instructable. I'm trying to adapt your circuit to make a detector for a BB gun shooting range, so we know when we hit the targets. The way I have the circuit set up now is too simple, just the piezos and the 1M resistor, and its very susceptible to electronic interference. So I'm building out your circuit now to try to make it a bit more reliable.

I had one question: I wasn't able to find the TS912 op-amp locally, but instead found the TL082. The package is labelled "Dual BiFET Op Amp", and here's some specs:

http://www.national.com/mpf/TL/TL082.html

Do you think that would work as a replacement?

ganglion (author) in reply to wrybreadMar 29, 2011. 7:34 PM
Interesting use for this circuit! :-)

Bear in mind that just using this circuit won't make your system more reliable - the reason for creating a 2.5v reference level like this is so that the firmware can detect both positive and negative going pulses from the piezos. Apart from that it will work pretty much like the simple input circuit you are using. Are you using shielded cable for the connection between the piezos and the arduino? This would help with reducing interference.

That opamp might work, but I'm not sure. It looks from the datasheet like it's designed for a higher voltage application, with split power supplies. The useful thing about the TS912 is it is 'rail to rail', which means that its input and output voltage ranges go right from the positive to the negative supply voltages. Also it's designed for low voltage applications (2.7 V minimum).

This isn't a very demanding use for an opamp, but it does need to be able to provide an output voltage of about 3.1V to drive the transistor. I'm not sure from the datasheet whether the TL082 will do that off a 5v single rail supply.

If you search for a general purpose rail to rail op-amp, you should find something that does the trick.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!