Maker Pro
Maker Pro

How can I build a sine wave generator with variable phase?

I live near an electrical substation that puts out a 120 hz hum that my house seems ideally (NOT!) positioned to resonate to. I want to feed a 120 hz signal to a subwoofer in my bedroom, and slowly vary the phase to see if I can cancel, or at least attenuate, the hum. I know there are many ways to build a sine wave generator, that's no problem. What I don't understand is how to design the variable phase into the circuit. Any help or suggestions would be appreciated. Thx.
 
It might have nothing to do with the sub-station, we can get hum like that without being close to one.

Are you taking a signal from a device plugged into a different electrical outlet than the sub-woofer is? This could be a ground loop problem.

Bob
 

Fish4Fun

So long, and Thanks for all the Fish!
Hey Openplanet, Welcome to the Forum!

I understand what you are asking, but I am going to begin by correcting your syntax and a few other minor details....

Phase in sinusoidal functions or in waves has two different, but closely related, meanings. One is the initial angle of a sinusoidal function at its origin and is sometimes called phase offset or phase difference. Another usage is the fraction of the wave cycle that has elapsed relative to the origin.

Copied w/o permission from: https://en.wikipedia.org/wiki/Phase_(waves)


Second, unless your local power sub-station is some specialized facility the "hum" you are referring to is likely 50hz or 60hz.

What you are actually asking about is "active noise cancellation", which is considerably more complicated than simply feeding a signal to a sub-woofer....I would suggest you begin by reading this: https://en.wikipedia.org/wiki/Active_noise_control ..... It covers the topic in very broad terms....

The most common example of active noise cancellation is "noise cancelling headphones" ..... and even in this micro-environment results vary widely....Typical noise associated with grid power is "transformer noise" where the transformer is actually vibrating/resonating with the line frequency acting much like a (relatively inefficient) speaker.....To actively cancel a low frequency sound wave like this in an area as big as a house is going to require a fair amount of power and a pretty sophisticated set-up...it is possible that your house is actually "resonating" and acting like a transducer via entrainment.....(The classic example of sound-entrainment is two identical tuning forks, "ping" one...bring it near the second, quell the first and you will note the second continues to "ring", albeit at a lower volume/magnitude....) If this is in fact the case, you might consider adding some spay-foam insulation in some walls/floors/ceilings in an effort to change the natural frequency response of the house....

Perhaps the best first step: Contact the utility responsible for the sub-station and request a review of noise compliance with what-ever state/county/city/local codes might apply.....frequently aging or over-loaded transformers make considerably more noise than newer more conservatively loaded transformers.....if you file a formal request or complaint at the very least the utility should be required to inspect the facility......if it is operating nominally then perhaps they would even work with you to suggest ways of reducing the noise-nuisance in your house as an act of "good-will".....I would suggest starting with the "Carrot" rather than the "Stick"....If that fails, then In some areas you might be able to use legal litigation to "force" them to reduce the noise emanating from their site.....but in most areas you will likely have to rely on some combination of proactive measures....and hope you can find someone sympathetic in a position to offer help...

Good Luck!

Fish
 
All you need to do is slowly tune up and down the frequency of your signal generator. This will change the phase - if compared with any external signal. However - this is, more or less, a trial-and-error procedure because the amount of phase changed is unknown.
 

Fish4Fun

So long, and Thanks for all the Fish!
Hrmmmmm....I think we need to clarify the OP's problem.....My take on it is that the sub-station is creating sound waves that are bothering the OP.....several of the responses address problems associated with improper grounding of an audio amplifier.....I am not 100% sure my take is correct, but from the OP I am 99.9% sure I am correct.....If the problem is, in fact, actual sound waves emanating from the facility (likely from transformers) and the OP's question involves using an audio amplifier and sub-woofer as part of an active noise cancellation system then this requires a completely different approach than proper grounding of an existing audio amplifier.....I would ask Openplanet to clarify that the problem is in-fact sound waves and not a "hum" in an existing audio system....

@LvW.....I seriously doubt that an effective noise cancellation solution can be accomplished by simply "creating more noise"...rather it generally uses feedback to "respond" to noise....effective active noise cancellation over a large 3-dimensinal area requires multiple feed-back sources, multiple active components and a fairly sophisticated, low-latency DSP response system....While grid frequency is actively maintained to fairly high precision over time, the nature of the reactive load it services precludes a "set it and forget it" approach....Even if this were not the case, depending on the distance between the OP's house and the sub-station, a simple change in humidity could change the speed of sound enough over a few-hour period to alter the phase of a "fixed response" from being a solution to contributing to the problem....even if the transformer noise were completely stable, and the speed of sound were constant, the "drift" in any affordable frequency generator would likely preclude the viability of this approach....Active Sound Cancellation needs feedback.....and latency between sound events and an active response generally requires some type of PID, predictive or adaptive response algorithm, though with a relatively constant noise source the approach is less demanding than a "more general solution".....

I still think the best initial approach is to contact the utility responsible for the sub-station to see if they might reduce the problem at the source before exploring complicated, expensive counter-measures.

Good Luck!

Fish
 
@LvW.....I seriously doubt that an effective noise cancellation solution can be accomplished by simply "creating more noise"...rather it generally uses feedback to "respond" to noise...
Fish
Fish - I fully agree with you. My answer concerns only the point of "changing the phase of an oscillatory signal" - nothing else.
If such an approach can be a starting point for any noise cancellation system is outside of my region of experience.
 
Thanks to all who have replied so far. To clarify: My house is completely off the grid. The hum is present even when I turn off my inverter, so I know that it's acoustic energy emanating from an external source. Not only is there a huge substation within a mile, but I have the misfortune to also have a large power line right-of-way within less than a quarter mile. I understand that noise cancellation is complex, and that to be effective across an area requires a phased array. What I'd like to do for starters, though, is to see if I can reduce the hum at one specific location in the house (the space containing my head on my pillow on my bed) by tweaking the phase of the signal coming from a subwoofer. So back to my original question. How do I build a simple sine wave generator that gives me the ability to vary the phase of the generated signal with respect to the phase of the hum at a specific point in space. Put another way, how do I build a sine wave generator with a phase that can be varied by up to 180 degrees? Can this only be accomplished digitally? Thank you.
 
Ok just a thought, what about using a small low voltage transformer plugged into the mains, invert the signal and feed this into the amplifier. I guess this then should track all line transients and harmonics and any change in frequency which is causing the hum.
Adam
 
To be honest I don't think a signal generator will work. The mains waveform in the UK at least is far from a nice sine wave. I wouldn't want you to build something like that and have disappointing results. My personal preference would be to use some kind of transducer to pickup the noise and then amplify the signal and invert it. But for cancelation it's going the need to be inverted. Having variable phase is possible but you will probably need the adjustment right up to 180 anyway.
Adam
 
How close to the substation are you? Are you sure the noise you are hearing is coming from (acoustically) the sub station?
 

Fish4Fun

So long, and Thanks for all the Fish!
Openplanet,

A good first-order attempt would, at the very least, involve a pair of microphones to "capture" the sound that you are going to attempt to actively cancel.....A "cheap and easy" place to get started would be with a PC...any PC built in the last decade has everything you need....inputs, outputs and access to a wide range of sound processing software. You can create virtually any waveform you can imagine with readily available mainstream applications and there are tons of freeware/shareware tools available as well; if none of these suit your needs you can write your own using what ever programming language suits you....C, C# and VB for example all have methods/tools/controls for managing/manipulating audio frequency wave forms.....both from file and in real-time.....Be fore-warned active noise cancellation is tricky at best and will require a lot more than simply "playing a wave form on a sub-woofer" if you hope to achieve anything other than adding volume to the din :) I would start by reading existing whitepapers on the subject and then I would spend some time looking to see if there are any open-source projects that are similar in nature.....I doubt seriously a PC is the best choice for a full-blown solution, but using a PC for prototyping will drastically reduce the time it takes to properly define the solution and give you some idea of how much processing power is requisite....perhaps an 8-bit Arduino class processor would be enough...perhaps it will require a bleeding edge multi-core 64-bit DSP.... hard to say, but if you can "capture" the actual sound in a file on your PC then you can begin to figure out what kind of processing power it will take to cancel it.....

If you just want to create a "tone" at a particular frequency this too is easy enough on a PC.....as far as "adjusting the phase"....you have to remember any given cycle of the noise you want to cancel occurs in < 20mS and is (as stated previously) likely not nearly as "stable" as you might think, there is no way to "manually calibrate" any type of tone generator on a cycle-by-cycle basis, to do this requires real time feedback from a system that operates at least 1 order of magnitude (and typically 2 to 4 orders of magnitude) faster than the smallest time domain you are interested in controlling/cancelling....in the case of the audio frequency range this would imply 5uS to 5nS response time....assuming any given digital solution would require some number of instruction cycles per response period this implies a minimum processor speed ~10Mhz and could easily require 100Mhz > more.....

One more little "caveat" about your sub-station....it is almost certainly handling three-phase power lines...while each phase is 50hz/60hz, they are themselves 120 degrees out of phase with each other....the resultant "noise" is NOT going to be a single 50/60hz sine wave, but rather a fairly complex cascade of harmonics with a plethora of "beat frequencies" in response to the natural harmonics of the transformers.....I would urge you to purchase a microphone and simply "record" ~10 seconds of the "noise" and then use existing PC software to study the wave.....this will give you a much better idea what you are actually trying to cancel.....

Good Luck!

Fish
 

Fish4Fun

So long, and Thanks for all the Fish!
Openplanet,

As I mentioned I think the easiest approach is to use a PC, there is no stand-alone piece of bench equipment even close in comparison wrt versatility, processing power and ease-of-use; however, if you are determined to try a wave form generator, then I would urge you to search e-bay before starting down the road of a DIY build/design....for instance: http://www.ebay.com/itm/Digital-DDS...157?pt=LH_DefaultDomain_0&hash=item2a4bf0f98d .... but please understand, you will not achieve any type of noise cancellation with a simple function generator, regardless of features....but if you need to 'scratch that itch', and, for what-ever reason, don't want to use a PC, then you should really just spend $10-$50 for an off-the-shelf solution to prove to yourself this is not a viable approach....I understand the need to 'prove' simple doesn't work before moving on to complex, but don't waste your time designing/building something that is readily available, tested and working for less than the components would cost you.

Once you are satisfied that simply "playing a sound" is not a viable approach do a google search on the topic......here is one soc ("solution on a chip"): http://www.silentium.com/ ..... Be fore-warned most of the readily available solutions are for headphones or are designed to allow integration into a stand-alone product (ie to make an air filtration system "silent")....

You mentioned the substation is ~1 mile from your home....this implies a tremendously powerful signal source....obviously it is a "sub-station", so there is a vast amount of power present, but the fact that it might be generating an audible noise with a radius of over a mile would mean a huge amount of energy is being converted into sound....This is a troublesome revelation....You really need to do some testing before settling on any particular approach to noise reduction....For example, if you WANTED to generate a 60hz sound wave with an effective audible range > 1 mile radius you would likely need a 10kW or larger amplifier/speaker system....but it would also imply the sound at the sub-station would be deafening....I doubt this is the case because it would mean there were some very serious flaws in the design of the sub-station. I am NOT doubting the noise exists in your home, NOR that it is possible the sub-station is the cause of the noise; however, I am suggesting the source of the noise does not originate as a sound wave emanating from the sub-station....Something else is going on....obviously it ultimately manifests itself in your home as a sound-wave, but I think it highly improbable it originates at the sub-station as a sound wave....

Think of it like this: if you had a 100W stereo in your basement and you wanted to play music for a neighbor's pool party would you turn the volume all the way up on the amplifier with the speakers in your basement, or would you run wires from your basement to your neighbor's house and place the speakers near the pool? My point is that if the sub-station is a mile away, AND is the source of the sound waves in your home; it is far more likely the energy is being transmitted via a more efficient medium and is then being converted to sound waves much closer to your home (or, as I earlier suggested, by your home itself....) In any case, this is easy enough to figure out....simply go for a walk....if the sound gets "louder" as you get closer to the sub-station then I am wrong and the problem is, in-fact, a sound emanating from the sub-station and by the time you are a quarter mile from the sub-station you will need to cover your ears with your hands....but I suspect this will not be the case....

Now, before we go too far down the sub-station rabbit-hole; You also mentioned proximity to transmission lines....if these are "primary" high-voltage lines they could easily be 10kV to 100kV or more carrying several hundred amps....and these lines could certainly be the source of your noise, again, taking a walk could really help with "finding the source".....I have frequently noted a "hum" around transmission lines...if these lines are close to your home then it is far more likely they could be the source of the noise....because transmission lines typically stretch for miles, they make a far more effective "long-range" transducer than the transformers at a sub-station....think of transmission lines like a large array of small speakers and the transformers at a sub-station more like a single, large speaker.....up-close the single large speaker "seems louder", but the effective range is fairly small.....but the transmission lines might span a 100 miles or more....the sound would never be "loud", but the area affected is considerably larger....

Why is it important what is causing the noise? Because before you can determine an effective approach to eliminating the noise you need to determine the source. Just because the 'problem area' is your bedroom does not imply the best solution is active noise cancellation in your bedroom....It just doesn't. It might be far more effective to "cancel the noise" somewhere between the source and your house, but if you don't know where the source is this possibility never emerges. Wouldn't you be a lot happier if you could use a 10W solar-charged solution located 100 yards from your house than having to use a 200W solution located in your bedroom? I am not suggesting either of these solutions exist, only that the more information you have about the problem the more opportunities you have to solve it....You stated that your home is off-grid....to achieve this you had to re-think how you use power...the solution is not to build a solar/wind array capable of supplying a sustained 220Vac panel box with 200A....that is NOT an economically viable solution....instead, you likely utilize low-grade radiant energy to heat water....you likely schedule larger power demands to coincide with peak production hours to reduce storage losses....you likely take full advantage of the passive heating and cooling options available....You likely coordinate wash days with favorable weather for air-drying your wash.......etc, etc; Solving your noise issue is going to take the same type of careful attention to understanding the problem that going off-grid presented with power usage....

I am happy to help, but I understand you need to scratch the function generator itch first....keep us posted on how that goes.

Good Luck!

Fish
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
if you can make a reasonable recording of ambient noise, I can analyse it with my DSA and tell you what the dominant low frequencies are.
 
Top