Convert low voltage AC sine wave to DC wave

Considering you are using an amplifier that was designed in 1979 and was/is not made for single rail power supplies you probably lucked out.

I can't say for sure but I suspect the high frequency is partly due to the internal stages of the LM348 saturating and taking some time to come out of saturation.

And can have hysteresis which helps prevent oscillations as the input slowly passes through the reference voltage.

Yeah I think you could be correct. I didn’t pick the LM348 for any engineering reason, I picked it because I had one :joy:

I’m busy tomorrow but I’ll try it again on Wednesday using an MCP6022. At the moment it’s all thrown together on a bit of veroboard hence using through hole but ultimately it’ll be integrated into a bespoke PCB so I want to find a surface mount device with identical properties which it looks like the 6022 has. Actually the “weirdness” only occurs at a speed lower than what I need anyway so I could design it out in software but obviously the better I can get the source electronics the better.

I also want to try a comparator before I commit to production, which I would never have got to without all the help from you guys.

Again I’ll keep you posted :+1:

Take a look at this application note then.
Comparator app note

2 Likes

Many years ago I bought a few tubes of LM324's because I got them for about 10cents each. It became my go-to opamp for anything non-precision for obvious reasons.

MCP6022 is a much better opamp.
Anyway beside testing, make sure that everything is inside the datasheet specs, keep away from the limits even in the worst posible case.

For example, the input signal shouldn't get close to -1V in any case, I would say maximum -500mv. Because half of the signal is already out of the rails, and the limit for the inputs is Vss - 1V, so -1V. Otherwise it could be damaged (datasheet: 4.1.2 input voltage limits).

If you think that it could happen then just put a schottky diode from GND to V+, it will clamp the negative side to -0.3V maximum.

1 Like

@EmilyJane 's app note is good to read. Keep in mind you input is going something in the order of +/- 100mv and the device has no negative supply. It would be best to put a resistor of a few k ohms in series with the input for the negative inputs. And the hysteresis in the app note would help noise but will have to be pretty small due to the small input signal.
So basically a comparator will be a "zero crossover detector".

A small change to avoid the saturation and problems in the first opamp. You can just add a ceramic capacitor of 3nF in parallel with the feedback resistor, and adjust the values of R1 and R2.

The input signal can be as low as 10mV when the speed is 15,000 RPM (250 Hz) and as high as 100mV at 250,000 RPM (4.2 KHz), right?

The capacitor reduces its reactance and the gain of the amplifier as the frequency increases, avoiding the clipping and saturation in all cases.
So, when the speed is lower, the amplitude of the input signal is also lower, but then the gain gets increased. And when the speed increases again, the gain gets reduced.

With the lower speed: 10mV, 250 Hz:


Gain ~ 250
.

With higher speed 100mV, 4.5 KHz:


Gain ~ 24

Now the mid signal (blue) is always well above Vref (yellow) avoiding problems and below 4V, not saturating. Even with only 5mV it works well.
Beside that, replacing the second opamp by a comparator would be also better, but not so critical I think.

1 Like

Hi guys.

I just wanted to update you where I am with this.

I remade the circuit using a 6022 op amp (stage 1 as an amplifier, stage 2 as a pseudo comparator) and included the 3nF capacitor as suggested by gromit1. This does seem to have cleaned things up a bit and it now works great down to about 5,000 RPM (approx +/- 4mV). It has the added bonus of now being (more or less) a 5v square wave :slight_smile:

I also tried using just the first stage as an amp and a genuine comparator (LM393) instead of the second stage. To be honest, whilst I accept that this is technically the right way to go, there was no discernible benefit as far as my particular application is concerned so I've opted to go with the 2 stage op amp approach as the second stage was sitting there doing nothing anyway.

A massive thank you to all who helped / contributed to this. I couldn't have got this far without you.

Gareth

I'm happy to hear that! It seems that procrastinating here sometimes is helpful for someone :slightly_smiling_face:

What you could maybe additionally consider is the possible noise in the signal, maybe when the device is placed somewhere in the wild.
With noise this could happen:

And you would get some false hits.
But this is very easy to fix, with just one resistor more in the comparator stage, if you think that this could be a problem.
You would need to add a feedback resistor of about 1M Ohm from V+ to the output of the 2nd stage, to add some hysteresis. We can check if needed.

But anyway, I think that the cap also attenuates the noise at higher frequencies than the signal, so it cleans it up a bit.

Very nice! That's a quite narrow margin to catch.

can you give me that proteus file, please
on my email: as4665567@gamil.com

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.