Conversion of low amplitude sine wave to square wave for PLC

Thread Starter

piashaw

Joined Apr 20, 2013
12
Have been looking around for a way to convert a sinewave (minimum pk to pk of 80mV) to a square wave of 0-24V (realistically need above 18V to definitely register a high) for PLC input, maximum input however can be greater than 12V pk to pk. Specs for the anemometer are at
http://www.renewablenrgsystems.com/products/1900.aspx#

Was thinking of using LM393 comparator but don't know if it will trigger at such low signal strength. Frequency will be between 1Hz to 200Hz and then how to protect it with the higher peak to peak voltages.

I would run the circuit from a +24V DC supply.

Most circuits show it using the inverting input. Why is this? I would prefer to use the non-inverting.

Many thanks
 

ericgibbs

Joined Jan 29, 2010
18,872
hi,
Do you require the square wave to have 50/50 mark/space.?
Also is required to be thru zero voltage detect on the sinewave input.?

The 80mV should not be a problem for the LM393, but it is also possible to use one half of the LM393 as a low frequency amplifier, using the 2nd half as a comparator.

Many apps require the output sense to be the same as the input sense to the LM393 , thats why non inverting is used.
E
 

Thread Starter

piashaw

Joined Apr 20, 2013
12
Thanks Eric.

I need to measure frequency in the PLC on an interrupt, so i only need to work on a rising or falling edge, so mark/space ratio is irrelevant. As is zero voltage detect in this particular requirement.

I agree with the non-inverting preference, just happens that many of teh circuits i saw use the inverting for some reason.

Regards
P
 

Thread Starter

piashaw

Joined Apr 20, 2013
12
Not yet. Thanks for the offer.

I was just trying to find out if the comparator for this simple conversion were the best or if I should go with a trigger or just using Transistors.

Not certain how to cope with such a wide input pk to pk voltage range.

I was slightly incorrect in my statement about using rising or falling edges, basically I will count when the PLC input is a HIGH or a LOW. The actual duration in whichever state is irrelevant to me.

P
 

ericgibbs

Joined Jan 29, 2010
18,872
Not yet. Thanks for the offer.

I was just trying to find out if the comparator for this simple conversion were the best or if I should go with a trigger or just using Transistors.

Not certain how to cope with such a wide input pk to pk voltage range.

I was slightly incorrect in my statement about using rising or falling edges, basically I will count when the PLC input is a HIGH or a LOW. The actual duration in whichever state is irrelevant to me.

P
hi P,
A LM393 would be easier to build IMO rather than using transistors, a LM393 is about 20p UK.
The LM393 will have no problem with a 80mV signal.

E.
 

MaxHeadRoom

Joined Jul 18, 2013
28,700
The link for the Anemometer also shows a signal conditioning add on, it doesn't appear to show the nature of the output, will this be of any use to condition the signal for your PLC?
I assume this is a PLC in the industrial sense (not microcontroller), some will have the option of rising edge detection for counting purposes.
Max.
 

Thread Starter

piashaw

Joined Apr 20, 2013
12
Thanks Eric, very interesting.

My electronics is somewhat rusty as I haven't used it since the mid 80's properly......

Why do I need the Vref, as opposed to just using Ground?
How does one define the correct vref for different input voltages? Or does it not change?

I am looking at the circuit just using a comparator rather than a preamp followed by a comparator.

Thanks

Peter
 

Thread Starter

piashaw

Joined Apr 20, 2013
12
@MaxHeadRoom
Yes it is an industrial PLC.

The add-on only goes up to 15V MAX output.

Trying to resolve an issue where the wrong anemometer has been used. Had a 40H (Hall effect ) version been bought, I wouldn't have to be trying to resolve this.

P
 

ericgibbs

Joined Jan 29, 2010
18,872
hi Peter.
A LM393 can have either a negative or positive 'self offset', so its advisable to fix a defined Vref threshold voltage for the comparator.

The Vref is set to about +20mV, it should stay at this value, so every time the input signal rises above +20mV the comp will switch, whatever the amplitude of the input signal.

I am assuming from from your first post that the 80mVppk swings thru 0V.
ie: +/-40mVpk.
E
 

Thread Starter

piashaw

Joined Apr 20, 2013
12
Yes it is a self generating sinewave from magnets, so yes fluctiation +-40mV.

Ah now I understand the purpose of the Vref.

In my case, as it is crossing zero, what benefit do I have of defining the vref rather than not caring about the internal offset and tying it to ground (0V)? (Unless the offset is likely to be close to or greater than the peak of the signal.)

If you set a Vref manually, do you have to take the Internal offset into account at all or will you get exactly the Vref you set?

For my reference, do they define they tell you the maximum possible offset in the datasheet and if so, what do I look for?
Is it "Low Input Offset Voltage: 5.0 mV (max) LM293/393"

Thanks

P
 
Last edited:

Alec_t

Joined Sep 17, 2013
14,335
If the input signal goes below ground you will need to limit it, or offset it, so that the '393 input pin doesn't go below -0.3V (the rated minimum).
 

vk6zgo

Joined Jul 21, 2012
677
Retro-style would be to just amplify it & put it through a bi-directional clipper circuit -----An overdriven amplifier,going into saturation at one extreme,& cutoff at the other would do it!:D
 
Top