Go Down

Topic: Piezo sensor sensitivity. (Read 1 time) previous topic - next topic

vanakaru

Thank you again!
I tested the circuit given on the piezo conditioning  page you linked. This did not work somehow. I got erratic notes and most of the time nothing. I then modified the circuit a bit moving zener to first position parallel before series diode. It does work rather good.
I do not have the parts at hand to try yours.
I added averaging of 10 readings to the code as well that would do the similar effect as the conditioning circuit.
Code: [Select]

#include <MIDI.h>
byte note = 0;
byte c = 1; //MIDI channel
byte d = 3; //MIDI channel offset

const int piezo = 0;  // the piezo is connected to analog pin 0
long randNumber;

int record[10] = {0,0,0,0,0,0,0,0,0,0}; //record 10 readings in a row
int record_max;  //max of 10 recordings
int a=0;
int i=0;
int b=32;        //lowest note allowed to play

void setup() {

 Serial.begin(31250); // use the midi port




}

void loop()  {
   a = analogRead(piezo);
    for(int i=0; i < 10; i++)
   {
   record[i] = analogRead(piezo);   // read the input pin
   if(record[i] > record_max)
   {
     record_max = record[i];
   }
   }
   a = record_max;                 // record max
   record_max = 0;

   a = map(a, 0, 1024, b, 122);    //map recorded max to lowest and highest note
   randNumber = random(1, 8);      //generate random number 1-8
  if (a > 32 + randNumber)         //add random number to the lowest note to make it more interesting
 
{ MIDI.sendNoteOn(a,127,c);        //send note and note off
delay(50);
 MIDI.sendNoteOff(a,0,c);
 delay(50);      


 }

}

What do you think of the circuits. I am pretty dumb with understanding electronics.

elac

#16
Jan 04, 2014, 01:00 pm Last Edit: Jan 04, 2014, 01:09 pm by elac Reason: 1
Glad to hear it's doing what you want.
That circuit is open to modifications depending on the piezo used.
I tried 4 different piezos and had to modify the circuit for each one to get a clean pulse.
As the author states "Be warned that piezo are all differents, and that size matters… So experiment with that before engraving the above stuff in copper."
The way you have the circuit is fine, actually better if you are using the BAT85 diodes or any diode rated under 200V VRRM.
If you read the comments of that link Alan Burlison advises putting the zener in parallel first to protect the BAT85 diodes from over voltage. He also says the second diode isn't needed, I only found that to work with one of the piezos I tested.
So the circuit you used does this: Zener only allows 5.1xx volts to pass, diodes rectify to positive only voltage, RC filter cleans pulse.
**edit**In each test I checked the output using an oscilloscope to make sure it was a cleaned up pulse.
Were you able to test with an oscilloscope?
It's all about the skills

vanakaru

#17
Jan 07, 2014, 08:35 am Last Edit: Jan 07, 2014, 08:42 am by vanakaru Reason: 1


5.1v zener in parallel with piezo + 1N5819 in series > 1M ohm & 4.7nf cap in parallel> LM386 amp module 5V > speaker 8 ohm 1/2 watt
P++++5.1++1N5819+++1M++4.7+++++L++++++/ |
i           z                         O      N           M          /S |
e          e                         H       F           3          |  P  >
z          n                        M       |            8           \K |
o-Gnd-|----------------|-----|-------6--------\ |    



Could you, please elaborate how do you connect the opamp(what pins where)

And it becomes apparent that depending of the room(floor where the sensor is placed) the piezo sensitivity will vary a lot. So I need some kind of physical control to calibrate the setup(it would not be possible to use computer) - like a pot in the wiring.
Something like this maybe  >>>

elac

I used a LM386 amp module like this one.
If you are planning on using a speaker and don't have the above module then connect the LM386 chip like the circuit shows here.
If you plan on feeding the signal to an analog pin then use a LM358 like in the circuits described here .
It's all about the skills

vanakaru

#19
Jan 27, 2014, 09:26 am Last Edit: Jan 27, 2014, 09:29 am by vanakaru Reason: 1
After the initial performance where the setup worked pretty well
http://vimeo.com/84249323
I am developing the stuff further. Thanks elac!
My goal is to have as clear as possible correlation between the force of a hit and the high of a note. I have been messing with the code trying to clear up the un-wanted notes. So far it has not been too successful. So I came back to the question of piezo and its characteristics. And it appears that my electronic conditioning is far from perfect. Since a do not have access to an oscilloscope I finally recorded the piezo hit and looked at the waveform.
As seen on the attachment  I do have eliminated neg values OK, but anything else is not looking good at all. So it is clear that my difficulties with coding come from this. Look at the discussion about the code:
http://forum.arduino.cc/index.php?topic=211968.0
I have piezo wired as the posted above. So I need some guidance how to do things different.
Again I started with this information
http://leucos.lstilde.org/wp/2009/06/piezo-transducer-signal-conditioning/

elac

If it were my project I would use 2 or more piezos. At least one for soft taps and one for hard taps.
Each with its own conditioning circuit for it's range.
Taking the example from Taiko Trainer (LM358) link I posted above, I would go from there.
I have quite a few different piezos hanging around and have been able to get a nice pulse on a few that I tried using variants of those circuits.
Also, I would test the conditioning circuit while someone is dancing and make adjustments according to those readings.
Are you using a breadboard for the conditioning circuit?  Cleaner readings from PCB board.
Are you using a plain flat disk piezo? If so what size?
It's all about the skills

vanakaru

I tested on breadboard , but soldered it for the show. My piezos are basically these flat disks but they come from Yamaha DDrum 50. These just sound better comparing to all the other various piezos I have around.
I had the same thought about two sensor pairs. So I shall try that too. And I have collected all the parts for the filter so the testing is in the works.
On stage adjustment I would like to have a pot somewhere in the circuit. Can you suggest where?
What do you think of my sound wave test - is it accurate in a sense?

Go Up