Circuit to detect a modified sinewave

  • Thread starter KHinMS
  • Start date
  • Tags
    Circuit
In summary, the conversation is about designing a circuit that can differentiate between a modified sine wave and a pure sine wave in order to sense when mains power is lost and a UPS takes over. The purpose of this circuit is for a senior project to monitor the input power to a piece of equipment and relay UPS state via ethernet. Different methods and challenges are discussed, such as using relays, sampling the waveform, and simulating a modified sine wave.
  • #1
KHinMS
I wander if yo guys can point me in the right direction here. I need to design a circuit that will differentiate a modified sine wave from a pure sine wave.

What I am trying to do here, is design a circuit that will sense when mains is lost and a UPS takes over by monitoring the waveform of the input voltage.

I may be going in the wrong direction, but I have been trying to sense the rise created in the modified sine wave, and feed that pulse into a monostable multivibrator to extend the pulse which will eventually be fed into a arduino as a digital high.

Thanks in advance.
 
Engineering news on Phys.org
  • #2
A shortcoming of sensing sharper rises is that it is going to be tripped erratically by noise coming in on the mains. If someone starts up an electric drill the monostable may be almost continuously triggered. Is this just a visual display you are wanting, so erratic blinking could be disregarded?
 
  • #3
NascentOxygen said:
A shortcoming of sensing sharper rises is that it is going to be tripped erratically by noise coming in on the mains. Is this just a visual display you are wanting, so erratic blinking could be disregarded?

No, not visual. But I could introduce a delay, so that the pulse had to be present for a prolonged period before the event is triggered.
 
  • #4
A more reliable way may be to filter and detect one or more of the AC supply harmonics, the distorted wave having consistent significant harmonic content.
 
  • Like
Likes Borek, jim hardy and Asymptotic
  • #5
KHinMS said:
design a circuit that will sense when mains is lost and a UPS takes over
Unless you need very fast response - less than the time required to switch a mechanical relay - you could use a pair of 120 VAC control relays (or whatever the mains/UPS AC voltage is).

If only a single digital input is available on the arduino a set of contacts from each would be placed in series, normally closed on the mains-sensing relay, and normally open on the UPS-sensing relay. When mains voltage is available the mains-sensing relay contact is open; when mains is lost, it closes, and (provided the UPS-sensing relay is turned on) will set the digital input true.

If two digital inputs are available, both mains and UPS sense relays could be evaluated separately, and (provided the arduino is powered from another source) could be programmed to detect both mains and UPS loss.
 
  • Like
Likes rbelli1
  • #6
Asymptotic said:
Unless you need very fast response - less than the time required to switch a mechanical relay - you could use a pair of 120 VAC control relays (or whatever the mains/UPS AC voltage is).

If only a single digital input is available on the arduino a set of contacts from each would be placed in series, normally closed on the mains-sensing relay, and normally open on the UPS-sensing relay. When mains voltage is available the mains-sensing relay contact is open; when mains is lost, it closes, and (provided the UPS-sensing relay is turned on) will set the digital input true.

If two digital inputs are available, both mains and UPS sense relays could be evaluated separately, and (provided the arduino is powered from another source) could be programmed to detect both mains and UPS loss.

I understand what you are getting at. The mains and the UPS are each sensed independently. Unfortunately, I need to sample the supply from a single point and differentiate.
 
  • #7
Most UPS systems will include a method of detecting when they are active. They also usually have a battery low indication that may prove useful.

If you can't use that or it is not available then @Asymptotic's suggestion seems to be the easiest solution. There are other methods using an optical or galvanic isolation or simpler means to achieve the same function.

BoB
 
  • Like
Likes Asymptotic
  • #8
KHinMS said:
I need to sample the supply from a single point and differentiate.

What sort of horsepower do you have available in your CPU? you could sample the waveform and do some FFT. The modified sine will likely have a bunch of sharp harmonics where many types of interference will have a more continuous spectrum. I would be very reluctant to base any even safety adjacent functions on this approach.

BoB
 
  • Like
Likes donpacino and Asymptotic
  • #9
KHinMS said:
I understand what you are getting at. The mains and the UPS are each sensed independently. Unfortunately, I need to sample the supply from a single point and differentiate.
Then an approach along the lines of @NascentOxygen and @rbelli1 may be necessary, along with his safety caveat.

It might seem odd, but another approach to remote detection could be to do the mains/UPS sensing at the UPS, and adapt something along the line of X-10 devices to transmit this information to the arduino location.
 
  • Like
Likes rbelli1
  • #10
No, safety is in no way dependent upon this solution.

Basically, this is for my senior project. I had to think of a problem and then build a solution. So, I am building a device that monitors the input power to a piece of equipment and relays UPS state via ethernet. It does a couple of other things also, that I have already figured out, so not important here.

The equipment will plug into this device, and this device plugs into the UPS. So, power is sampled and the arduino is powered before the power is routed to the equipment.

One thing that is really slowing me down, is that I have no way to simulate a modified waveform. I am using multisim, and I can simulate a pure sine wave and a square wave, or even a pulse, but not a modified sine wave..
 
  • #11
KHinMS said:
I wander if yo guys can point me in the right direction here. I need to design a circuit that will differentiate a modified sine wave from a pure sine wave.

What I am trying to do here, is design a circuit that will sense when mains is lost and a UPS takes over by monitoring the waveform of the input voltage.

I may be going in the wrong direction, but I have been trying to sense the rise created in the modified sine wave, and feed that pulse into a monostable multivibrator to extend the pulse which will eventually be fed into a arduino as a digital high.

Thanks in advance.
How modified is modified?
Are we talking about a slight difference? or a triangle wave?
 
  • #12
You could implement a notch filter around the sine frequency, then amplify it. This would only amplify signals not of the sine wave's frequency. Average the voltage over your desired time constant, then compare it to your acceptable limit.

Note: You might want to decrease and isolate the voltage first and this will only solve your modified sine wave problem.
 
Last edited:
  • #13
KHinMS said:
One thing that is really slowing me down, is that I have no way to simulate a modified waveform. I am using multisim, and I can simulate a pure sine wave and a square wave, or even a pulse, but not a modified sine wave..

You can add a square wave and sine wave, or do some other weird things like that
 
  • #14
KHinMS said:
No, safety is in no way dependent upon this solution.

I don't want to be a curmudgeon but safety is very much a part of this project. You are working with mains voltages. Please consider safety at every step of working with them. You may only be working with one or two parts in contact with the dangerous voltage but even that can kill if handled improperly.

I'm not saying that safely working with mains voltage is overly complicated but it is very important.

BoB

Edit: During every step please consider any accidental way you can touch the apparatus. Then once the mains voltage parts are completed insulate and/or enclose them them so it is impossible to touch a live conductor at the earliest possible time.

Edit2: Consider it this way. Not all touches to mains voltage are lethal but all lethal touches are only once. Now get off my lawn!
 
Last edited:
  • Like
Likes anorlunda and Asymptotic
  • #15
A couple ideas:

1) Include a sine wave oscillator synchronized to (the zero crossings of?) the incoming power, then subtract that sine wave from the incoming power waveform. This could be implemented in either hardware or software.

2) Instead of synchronizing an oscillator, a few stages of bandpass filters of the incoming power will also yield an acceptable sine wave source. (Watch out for phase shift in the filters though.)
 
  • Like
Likes Asymptotic
  • #17
rbelli1 said:
I don't want to be a curmudgeon but safety is very much a part of this project. You are working with mains voltages. Please consider safety at every step of working with them. You may only be working with one or two parts in contact with the dangerous voltage but even that can kill if handled improperly.

I'm not saying that safely working with mains voltage is overly complicated but it is very important.

BoB

Edit: During every step please consider any accidental way you can touch the apparatus. Then once the mains voltage parts are completed insulate and/or enclose them them so it is impossible to touch a live conductor at the earliest possible time.

Edit2: Consider it this way. Not all touches to mains voltage are lethal but all lethal touches are only once. Now get off my lawn!
I meant that if the equipment didn't work properly, it wouldn't cause an unsafe condition, such as loss of flight controls, etc.
 
  • #18
Thank you all, I am going to experiment with some of these suggestions. I'll update.
 
  • #19
Look up 'distortion meter"

Those meters work by measuring harmonic content of the wave, and there's several ways to do it that have already been suggested in prior posts.

So in your first post, what you called 'sense the rise' was a step in the right direction. Most approximations of a sinewave are rich in harmonics .

So if you find your source is rich in harmonics, you can infer either:
1. you're on the inveter
or
2. the electric company is having a bad day.
 
  • Like
Likes AlexCaledin
  • #20
jim hardy said:
Look up 'distortion meter"

Those meters work by measuring harmonic content of the wave, and there's several ways to do it that have already been suggested in prior posts.

So in your first post, what you called 'sense the rise' was a step in the right direction. Most approximations of a sinewave are rich in harmonics .

So if you find your source is rich in harmonics, you can infer either:
1. you're on the inveter
or
2. the electric company is having a bad day.

What is a distortion meter? does it just display the THD? if it does that's a handy piece of equipment
 
  • #21
donpacino said:
What is a distortion meter? does it just display the THD? if it does that's a handy piece of equipment

Yes, they were bulky analog things until FFT analyzers got small

https://en.wikipedia.org/wiki/Total_harmonic_distortion_analyzer describes one that works as @Tom.G described

there are several youtubes showing the HP334 in use.
 
  • #22
jim hardy said:
Yes, they were bulky analog things until FFT analyzers got small

https://en.wikipedia.org/wiki/Total_harmonic_distortion_analyzer describes one that works as @Tom.G described

there are several youtubes showing the HP334 in use.

I wish I knew that a few years ago. I built my own distortion analyzer for the techs to use. If I could have bought one it would have saved some time and effort haha!
 
  • #23
donpacino said:
I built my own distortion analyzer for the techs to use. I
Wow what fun ! How'd it work ? Was it analog ?

Somebody on PF posted a home-made ESR meter for measuring filter capacitors.
 
  • #24
KHinMS, If I understand your ultimate goal correctly perhaps I can recommend an alternative solution. Monitor the input and output of the UPS. Probably the best way would be with power measurements. Measuring power can likely be done with a number of pretty cheap instrumentation options depending on your specific setup (especially if you only need to know it's non-zero) Anyway, if the UPS input power is zero and the output power is non-zero then it has switched over.
 
  • Like
Likes Asymptotic and donpacino
  • #25
jim hardy said:
Wow what fun ! How'd it work ? Was it analog ?

Somebody on PF posted a home-made ESR meter for measuring filter capacitors.

Unfortunately it was not analog, although that would have been a fun project.
We had some recurring field failures in some of our 3 phase motor controllers. These failures, while not an immediate critical failure, would drastically decrease the life of our system and cause other failures in the future. We found that the failures (part of the inverter switching circuity) caused an increase in THD by about 10% in certain operating modes. There wasn't an easy way for your typical field tech to tell if the failure occurred on said unit.

The solution was we a box providing electrical connection and isolation hooked up to the inverter and provided a connection to a second instrument that did the thd calculation and display. The comparison was done by taking an FFT in a FPGA, then comparing the spectrum data with one of the baselines we loaded. The operator can select which baseline based on which combination of engine model and controller the system was. Then the THD was calculated and displayed. If the THD was over a certain amount, it flagged a high likelihood the failure was occurring on said model. We couldn't rely on every tech and operator being able to read an oscilloscope, which would have worked as well

TLDR: Used digital logic to do an FFT of the waveform, then compared it to and displayed the THD.
 
  • Like
Likes Asymptotic
  • #26
donpacino said:
We couldn't rely on every tech and operator being able to read an oscilloscope, which would have worked as well
10% distortion is hard to see by eye, unless it's got sharp edges...

Sounds like a real interesting episode.
We had some transformers burn up from third harmonics, but it was real evident in the neutral current - pure 180 hz by analog 'scope.

old jim
 

1. What is a modified sinewave?

A modified sinewave is a type of electronic signal that has been altered or manipulated in some way. This could include changes to the amplitude, frequency, or shape of the signal.

2. Why would someone want to detect a modified sinewave?

Detecting a modified sinewave can be useful in various applications, such as identifying signal interference or detecting malfunctioning equipment. It can also be used for security purposes, to detect unauthorized changes to a signal.

3. How does a circuit detect a modified sinewave?

A circuit designed to detect a modified sinewave typically uses a combination of components such as resistors, capacitors, and diodes to filter and amplify the signal. The circuit may also use a microcontroller or other electronic components to analyze the signal and compare it to a known sinewave pattern.

4. Is it difficult to design a circuit to detect a modified sinewave?

The complexity of designing a circuit to detect a modified sinewave depends on the specific requirements and desired level of accuracy. It may require knowledge of electronic components, circuit design, and signal analysis techniques. However, with the right skills and resources, it is possible to design an effective circuit for this purpose.

5. Are there any limitations to using a circuit to detect a modified sinewave?

Like any electronic circuit, a circuit to detect a modified sinewave may have limitations such as sensitivity to external interference, accuracy in detecting certain types of modifications, and cost of components. These limitations can be minimized through careful design and testing.

Similar threads

  • Electrical Engineering
Replies
10
Views
2K
  • Electrical Engineering
Replies
28
Views
3K
Replies
9
Views
4K
  • Electrical Engineering
Replies
5
Views
1K
Replies
19
Views
2K
  • Electrical Engineering
Replies
23
Views
3K
Replies
1
Views
1K
  • Electrical Engineering
Replies
4
Views
1K
Replies
12
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
Back
Top