How about an NE2 bulb with resistor, heat shrink to a phototransistor?
You said this is a 20Hz sine wave. Continuous? If so, you could use the time that the NE2 turns on and off again to determine the approximate zero crossing. The NE2 turns on at a somewhat higher voltage than it turns off, so it'll be just a bit before the halfway point when the NE2 is dark.
How accurate must this be?
Or are these individual pulses, arriving at about 20Hz rate, but the pulses are much faster?
Yes this is a continuous sine wave. Its not enough to simply detect the zero crossing though, I need to detect the zero crossings from the piezo and then turn on a switch that is connected to some control circuitry every time this happens.
Accuracy is pretty important.
How accurately must you detect the zero crossings? If you got a 200V input would a detection at +/- 2 Volts be OK. Or should it be +/-200mV?.
How much delay can you afford between the mathematical zero crossing and the time you detect it?
A symmetrical 20Hz signal gives you 40 zero crossings per second (every 25ms).
My idea of using a voltage divider (see my previous post) does not work when you have to detect the zero crossing as soon as possible. The voltage divider would not give you the required accuracy.
If all you want to do is to simply detect the zero crossings with maybe a delay of several milliseconds my solution would be an easy to implement solution.
If the timing is imporant, you will need a voltage comparator (special OP-Amp). The bad thing about this solution is that you would need a split voltage supply.
However, a simple lowcost ICL7660 will give you a negative voltage and a couple of milliamperes to feed your comparator chip. A rail-to-rail comparator with a single voltage source will not do the job, because you would need measurements in the one digit millivolts range (referenced to ground).
I've tried to use the ua741 as a comparator (like the one in this site: http://www.circuitstoday.com/op-amp-comparator) since this was easily available in the lab that im at. However, the output is not correct at all and the transitions to positive saturation do not happen at the zero crossing.
Accuracy is important. The switching needs to happen exactly (or as close as possible) at the zero crossing. Would I get better performance if i used some other IC instead? Like the one that you have suggested. I'm still not sure why the ua741 does not give me accurate pulses though since the input is only 20hz.
Is it not possible to implement this using the arduino at all btw? Would it not work if i used some sort of voltage divider and then a DC offset to make a 5V peak to peak input?
You started by talking about a piezo "damper", can you tell us the full application.
What is the damper connected to and what do you want the output of the arduino to control.
In other words what is the full application of your project.
What is the piezo you are using, and a picture of your project or its components will help immensely.
Working on a vibration damper using piezoelectric ceramics. its basically to reduce vibration in beams etc. There is one piezo patch that acts as a sensor (this is what generates my input 20hz sine wave) and then there is another piezo which acts as a controller. Every time the sensor piezo gives me a zero crossing i need to be able to turn on a switch that completes the circuitry attached to the control piezo which will increase the rate at which the beam gets damped and thus reduce the vibration.
Also, once i manage to detect the zero crossings and generate some sort of a pulse when they happen, is it enough to use a relay for completing the control circuit (this basically consists of the control piezo and an inductance)?