Power-company voltage waveform measurement - Page 1
Forum section: electronics / beginners

author: DrDeke
author_rank: Contributor
timestamp: January 23, 2023, 07:26:13 pm
content: I have been having some unusual power quality (rapid voltage fluctuation) issues at home recently, and I would like to see approximately what the voltage waveform is doing during these events should another one happen.In an attempt to measure/record the waveform, I connected a transformer to the mains with a rated output of 8 V, 1000 mA. I connected the transformer output to a(n approximately) 10:1 voltage divider consisting of a 22k resistor and a 2.2k resistor. I then connected the voltage divider output to the line-in jack of a computer's sound card and used Audacity to capture and record the signal. I am a bit confused about the results; the recorded waveform appears to be clipping (or something like that), but only on the signal's positive peak voltages, not its negative peaks:I thought perhaps the clipping might be caused by the voltage still being too high for the sound card's input circuit, so I added another 22k resistor in series with the first one, bringing the ratio to 44k:2.2k. Other than reducing its magnitude, this had no effect on the shape of the recorded waveform.I think that the quality of this waveform will probably be good enough to answer the questions I would like answers to if the power quality event happens again, but I am still curious what might be causing this apparent distortion on only one half of the AC cycle. I look forward to hearing any ideas you all may come up with.

author: wasedadoc
author_rank: Super Contributor
timestamp: January 23, 2023, 07:31:37 pm
content: If you swap over the connections to the transformer secondary does the waveform remain the same or do the flat tops move to the negative half cycles?

author: DrDeke
author_rank: Contributor
timestamp: January 23, 2023, 07:36:55 pm
content: I tried that just now and the waveform remained the same - the flat tops stayed on the top/positive half cycles.

author: TizianoHV
author_rank: Regular Contributor
timestamp: January 23, 2023, 07:58:19 pm
content: Could be leakage from the transformer to the PC psu, a battery device (laptop, smartphone) would clear this issue.What about adding a battery in series to the divider? (to create an offset and see if changes something...).

author: Buriedcode
author_rank: Super Contributor
timestamp: January 23, 2023, 08:04:59 pm
content: A soundcard is less than ideal for measuring voltage, its not really for absolute accuracy, plus the maximum input voltage varies by manufacturer, so you really have no idea at what voltage the signal clips.Aswasedadocpoints out, by swapping the polarity, if it still clips the top you know its not the signal itself that is clipped, but your setup causing the waveform to be distorted. If it was the signal looking like that, the bottom would be clipped when you swapped the wires.Your 8V transformer will likely have a much higher output than 8V since the resistor divider and soundcard present very light loads (~24k input impedance) - so even with your 11:1 voltage divider, and a transformer voltage of say 10V RMS would be 10*1.414 / 11 = 1.29V (thats peak from 0v, so p-p would be double this, at 2.58V p-p). Thats less than 1V RMS, which most soundcards can handle, but as I said, the transformer could be outputing a much higher voltage than the rated 8.If you have access to a known amplitude signal, say a 1kHz 1VRMS source, you can use this to check your soundcards input capability, and amplifiying it to see when it starts to clip.In the meantime I would try to load your 8V transfortmer somewhat. Say with ~200mA, and then checking it again in Audacity.

author: wraper
author_rank: Unknown
timestamp: January 23, 2023, 08:17:19 pm
content: Did you try to attach a capaitor in series? I suspect you are driving the input of sound card below GND and it does not have a bipolar power supply.

author: wasedadoc
author_rank: Super Contributor
timestamp: January 23, 2023, 08:25:35 pm
content: Quote from: wraper on January 23, 2023, 08:17:19 pmI never encountered an unbalanced line input on a soundcard that did not have its own input capacitor. Mic inputs are a different kettle of fish as they sometimes provide dc for electret mics.

author: Terry Bites
author_rank: Super Contributor
timestamp: January 23, 2023, 08:27:26 pm
content: You want a reasonable load on the XFMR.2k2 is very low.I agree, this looks very much like clipping. Make sure you sure you're using the line input not mic. Mic has a DC pullup.You don't want more than about 150mV on the soundcard line input. I'd go less than that, say 50mV.As pointed out, you still have over 500mV peak from your divider. (8*1.4/20)VCheck the gain on your PCs audio mixer control.Audacity may not be the best thing to use here even with 0dB rec gain.Get a copy of digilent "waveforms", it has a soundcard option and its free.digilent.com/reference/software/waveforms/waveforms-3/start

author: Simon
author_rank: Unknown
timestamp: January 23, 2023, 08:51:51 pm
content: I take it an oscilloscope is not available?

author: DrDeke
author_rank: Contributor
timestamp: January 23, 2023, 10:34:37 pm
content: Thanks to everyone who has replied so far! I have several updates:* First, I tried putting a 40 ohm resistance across the transformer secondary, so as to pull about 200 mA. This did nothing at all to change the recorded wave form.* I confirmed that I am definitely using the sound card's line-level input, not its microphone input.* I increased the value of R1 in the voltage divider from my already-increased22k44k value to44k88k. This results in 0.221 V RMS going into the sound card (as measured with an RMS DMM in AC voltage mode), and also fixed the issue! The waveform now appears mostly sinusoidal with only a small amount of "flattening" near the positive and negative peaks.I also have some follow-up questions about oscilloscopes and the Digilent Waveforms software:* While I do not have an oscilloscope available to me at the moment, how would I use one to capture these events if I did? I have very, very little experience using oscilloscopes for making anything but the very simplest of measurements and I am unsure how I would set up a trigger to capture these events. Is it possible to set most oscilloscopes to trigger on a condition along the lines of "the voltage stays below X volts for Y consecutive milliseconds" or something like that? If not, what approach would you recommend?* I set up the Digilent Waveforms software that Terry Bites mentioned, and it looks much more useful for analyzing one of these events (should I manage to capture one) than Audacity would be. But I am having some trouble getting the software to do what I want. What I would like it to do is continuously capture and record the soundcard channel and write the data to disk for later analysis.I can capture data using the regular oscilloscope tool in Waveforms, but there appears to be a limit of something like 2M samples per capture. At 8 kHz, this only amounts to 250 seconds. Since I can't predict when an event will occur and don't know how to set up an appropriate trigger, I seem to need a longer recording period than this. There is a 'REC' button in the oscilloscope window which brings up a dialog box with settings to capture data in various formats for extended periods of time, but no matter which file format I tell it to use, it seems to record all values of "0" for each sample instead of the actual value measured by the sound card.In the mean time, I have gone back to letting Audacity capture sound card audio (having made a note of the capture start time), but if anyone has any suggestions for getting Waveforms to capture the needed data, I'd be very interested to hear them.

author: Simon
author_rank: Unknown
timestamp: January 24, 2023, 09:44:12 am
content: Maybe we need to go back to the beginning. You say you have power fluctuations, how do you know? where do you see this? what happens?

author: BeBuLamar
author_rank: Super Contributor
timestamp: January 24, 2023, 01:39:01 pm
content: I am not sure if the waveform would have anything to do with the power functuation but I think in this case you have the problem with your sound card. Not so much how you feed it but something is wrong with your sound card. Try to record something from an audio source and see if it's still clip the positive side of the waveform.

author: jonpaul
author_rank: Super Contributor
timestamp: January 24, 2023, 01:58:55 pm
content: extreme overload of PC audio input. Checdk soecs of audio input to PC.Use 100 or 1000:1 attenJon

author: BeBuLamar
author_rank: Super Contributor
timestamp: January 24, 2023, 02:33:15 pm
content: Quote from: jonpaul on January 24, 2023, 01:58:55 pmI don't know how to overload only the positive half and only recorded as 50% of max. If I use an opamp and set the offset toward the positive I can clip the positive only but then the amplitude would be at 100% not 50%.

author: DrDeke
author_rank: Contributor
timestamp: January 24, 2023, 08:54:00 pm
content: Quote from: BeBuLamar on January 24, 2023, 01:39:01 pmThe sound card is working correctly in general, and the soundcard waveform problem was fixed by further increasing the ratio of the voltage divider (R1=88k, R2=2.2k) per Terry Bites' suggestion.Quote from: jonpaul on January 24, 2023, 01:58:55 pmIndeed, further reducing the voltage being fed to the soundcard fixed the problem.Quote from: Simon on January 24, 2023, 09:44:12 amAhh, yeah, good point; I had not mentioned what _kind_ of fluctuations I had been having and wanting to measure.The electric power in my neighborhood is fairly unreliable. This usually manifests itself in frequent prolonged total outages, or in brief (3-5 second) total outages during which a temporary fault presumably trips a protective relay which is then closed after a few seconds by an automatic recloser.In the past two days, however, I have been seeing a brand-new-to-me type of power problem. The new problem hasnotoccurred again (yet) since setting up the soundcard based monitor, so all I can go by to describe what's happening are my own observations.What happens is that for a period of somewhere around 4 seconds, the lights in my house flicker deeply and rapidly, at what appears to be a steady pace (maybe somewhere around 8-10 Hz, but again, this is estimated from my visual observation, not measured). At the end of the event, power returns to normal. Further observations:* This affects lights on multiple branch circuits, on both legs of the 120/240 V, 60 Hz split-phase service* When I say the lights "flicker deeply", I mean they (visually) appear to turn all or almost-all of the way off during the flicker cycle. This gives a strobe light-like appearance, quite unlike the momentary brightness fluctuation you might see if you turned on a large motor or other non-resistive load in the house.* When this happens, it causes both of my double-conversion UPSes to transfer their loads to battery and record "ConditionInputFrequencyDeviation" and "Input Power Supply Fail" messages to their logs. This seems notable because these UPSes are quite tolerant of variations in input voltage and frequency. Their spec sheets indicate that they can accept input voltages between 70-140 V and input frequencies between 40-70 Hz without having to transfer the load to battery.I have never seen a power problem like this before, and I have no idea what conditions on the distribution system might cause something like this. This is my reason for wanting to measure the utility voltage waveform. If this particular problem happens again, I would like to be able to characterize what is happening in more detail than my "the lights flickered deeply and rapidly" observation above.At present, I am using Audacity to record the waveform on an ongoing basis after you all helped me correct my soundcard input circuit yesterday. But if I could get the Digilent Waveform software to do the needed type of capture, I could almost certainly get a better analysis out of the captured waveform if the problem happens again in that software than I can in Audacity.Thanks again for everyone's input and help; I truly appreciate it.

author: Jeroen3
author_rank: Super Contributor
timestamp: January 24, 2023, 09:07:01 pm
content: What you are describing sounds like line fault conditions upstream. Trees shorting or stuff.There is no fix except put the cable underground? But that's not free of trouble either, the very old cable here arced out last week at multiple places due to the ground being saturated with water.But it can also be a fault in your owninstallation. Did you have that checked yet?Even if you measure the event, there probably isn't much you can do about it, brownouts happen.

author: DrDeke
author_rank: Contributor
timestamp: January 24, 2023, 10:08:24 pm
content: Quote from: Jeroen3 on January 24, 2023, 09:07:01 pmI fully agree; I do not expect this to be something I can fix. But it doesn't exactly seem like a normal brownout either, and I am very curious to learn what exactly is happening to the voltage during these events.

author: james_s
author_rank: Super Contributor
timestamp: January 24, 2023, 10:25:06 pm
content: Quote from: DrDeke on January 24, 2023, 08:54:00 pmHow long does it last? Makes me wonder if one of your neighbors has a large air compressor that cycles on periodically.

author: DrDeke
author_rank: Contributor
timestamp: January 25, 2023, 04:35:40 am
content: Quote from: james_s on January 24, 2023, 10:25:06 pmI would say about 4 seconds, but one of the major points of trying to monitor the voltage waveform is to enable me to give more fact-based answers to these kinds of questions than my recollection-based "about 4 seconds".Regarding the air compressor (or other nearby motor/inductive/non-resistive load), I would expect that to produce more of a one-off voltage dip than the oscillation that seems to be happening here.

author: james_s
author_rank: Super Contributor
timestamp: January 25, 2023, 04:39:37 am
content: Yeah 4 seconds is too short for the compressor idea, I've never measured mine but I assume it draws current in pulses matched to the compression stroke which I would estimate from the sound to be around 10Hz on my own compressor.

author: DrDeke
author_rank: Contributor
timestamp: January 25, 2023, 04:44:47 am
content: Quote from: james_s on January 25, 2023, 04:39:37 amOoh, ok, now I see where you're coming from with this idea! Although yeah, a compressor would probably run for more than 4 seconds at a time. Interesting idea though.

author: floobydust
author_rank: Super Contributor
timestamp: January 25, 2023, 04:51:09 am
content: It could be a tap changer, usually they are automated for voltage regulation (AVR).Changing an (on load) tap, it takes a long time and the switches/carbon brushes arc. I've seen these on the distribution side (around 13-25kV).The tend to get slower when old or cold, until they eventually bag. They do blow up really good. Flickering lights is one of their hallmarks with sloppy switching.I would keep an eye on mains voltage to see if it is moving around for long periods.For your soundcard, I would give it say 1/10 the signal amplitude you have now (i.e. add 10k + potentiometer) and confirm the distorted waveform is due to overload. Cheap wall wart transformers do compress the sinewave as they are run at fairly high flux density to keep costs low. So they can make a poor accuracy PT (potential transformer).

author: Simon
author_rank: Unknown
timestamp: January 25, 2023, 08:28:36 am
content: It sounds like you want to video the effects on things in your house and report to the power company.

author: tggzzz
author_rank: Super Contributor
timestamp: January 25, 2023, 10:34:17 am
content: Quote from: DrDeke on January 24, 2023, 08:54:00 pmYou missed another important point as well, best summed up by a valuable generic question: "so what?" In other words, suppose you use a scope/whatever to capture waveforms, what can you do with that data?I doubt a power company would know what to do with your measurements. A video of the effects would be of more use to them. Alternatively, hire a tool that is designed to log the voltages and present "interesting things" in a form that the power company can understand - preferably is related to their service specification and guarantees.As for the 4s you mention; thatmightbe a large electric motor startup drawing a high current. Normal domestic freezers sometimes draw 10* their normal operating current (>1.2kW vs 100W) for more than a second.My house is fed from 240V overhead lines. I did experience "chatter" in winds, which was traced to an imperfect connection at the pole in the street. Once tightened up (by someone on a fibreglass ladder) the problem disappeared.

author: BILLPOD
author_rank: Frequent Contributor
timestamp: January 25, 2023, 02:53:07 pm
content: My local utility company takes 'Power Quality' seriously, as they can receive large fines by state government monitoring agencies. They will come to your home and install monitoring equipment in your meter box,to try to identify the causes of your 'flicker'. Your Utility may have a similar program. Give them a call.

author: jonpaul
author_rank: Super Contributor
timestamp: January 25, 2023, 05:57:34 pm
content: You can never locate the few ms of bad line V with a PC and sound card.Needs a power quality analyzer that monitors 24/7 dfor weeks.These cost 1000s$.Easier to thinkTime of day of occurence?Weather?Had similar issue years back, was a buried utility 240V 4/0 feeder, damged by diggers, insulation cut partially.Over the years it corroded the Co[per or Al conductors.Result was intermittet cutout and imiing a few seconds on on side of the 120/240 feed to the meter box.Called local util, they checked and sent a lineman, was hard to locate the break, feeder needed replacement.CLEWL It was worse with damp weather...Look over the poles, line, underground util boxes for signs of work.Ask the uil workers if any aroundAsk neighbors if they have had simialr.Jon

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 25, 2023, 11:48:14 pm
content: Mains transformers are not very good fit for voltage measurements because they are usually made as cheap as possible, and are therefore driven to near saturation and this causes non-lineairities. If your wall socket delivers 120Vac, and your transformer has a 230Vac winding, then use that for the primary. The output voltage will also be halved, but as you are still using a voltage divider after the transformer that is easy to correct for. You can also put the windings of two (identical) transformers in series, so they each see only half the mains voltage.As for the clipping. It does not look "normal". What happens if you swap the connections along the way. does the clipping also reverse polarity?Alternatively: Increase the voltage divider to give a lower output voltage. Does the clipping go away?And a soundcard is also far from optimal. Maybe you're using a microphone input (or the input is set to microphone)

author: rstofer
author_rank: Super Contributor
timestamp: January 26, 2023, 12:28:48 am
content: Sometimes the utility company will install recording equipment and they know very well how to detect the problem and they have the equipment. You might have to call more than once to raise the annoyance level.

author: rstofer
author_rank: Super Contributor
timestamp: January 26, 2023, 12:36:03 am
content: There are some fairly inexpensive DMMs with data logging to a PC. I'm sure details vary.

author: MrAl
author_rank: Super Contributor
timestamp: January 26, 2023, 02:34:40 am
content: Quote from: DrDeke on January 24, 2023, 08:54:00 pmHello there,I was going to suggest getting a UPS system but apparently you already did that.The only other thing you can do really is call the power company and report the problem. See what they can do about it.You can get a scope for monitoring the power line for something like $25 these days that run on batteries so are completely isolated. You'll need a probe too. To record though you would have to aim a web cam at the scope and keep it running so you can record the wave as it changes. I dont think you will get much out of this though because then all you will know is how the waveform changes it still wont be fixed.The scopes that are that cheap are Arm based and they have a sampling rate of 1MS/s and that's enough for a power line of 50Hz or 60Hz.I used one on the car for a while and it was able to show the different waveforms when looking across the battery while the car engine is running and that's a higher frequency than the line.

author: shapirus
author_rank: Super Contributor
timestamp: January 26, 2023, 08:38:24 pm
content: So I finally came across an interesting topic that warrants going through the registration procedure to be able to contribute :).Hello, everyone.Quote from: jonpaul on January 25, 2023, 05:57:34 pmIt can actually be DIY'ed much cheaper, as long as you are not after officially certified measurements and just want something for personal use to satisfy your curiosity and possibly decide whether there is an actual reason to contact your power company's customer support.This is exactly what happened in my case. Initially I wanted to simply log mains voltage values over time and plot a graph, which I did, and it was quite easy to do using what could be grabbed from my computer's UPS over the RS232 connection, but its data update rate was really slow, the readings were a few volts off, and it worked only when the computer was turned on, so I decided to implement a dedicated 24/7 ADC-based data acquisition and logging system.It required a lot of reading, learning and simulating to implement (and I'm still not sure I did everything properly, but it works). Schematics is really simple and it basically follows the typical application circuits from the datasheets.(it's a simplified diagram: passives etc. aren't shown)Fuctional parts are as follows:1) Input: a divider made of 5W resistors, them being 5W to both meet the necessary voltage rating and avoid any noticeable heating that would cause an uneven temperature drift. It's not easy and possibly doesn't make much sense to obtain proper low-tempco resistors of the necessary values with proper voltage rating where I live, so I just throw in some thicker ones and call it a day.The values shown allow to register input values up to about +/-650 V peak before hitting the max values at the ADC output.The symmetrical arrangement of the 2x240K resistors (instead of using a single 480K) allows to avoid direct contact between any of the mains wires, be it line or neutral, and the low-voltage side (but this still doesn't provide proper isolation, which requires separate attention).2) Input protection 1: a low-value fast-acting fuse in series and an appropriately valued varistor after the fuse across the mains input. At the varistor's value shown, the fuse is expected to blow before the ADC readings reach their maximum, which is probably not good (we lose resolution for nothing), but safe.3) Input protection 2: an 11V rated bidirectional TVS diode across the outputs of the 240K resistors to blow the input fuse should any of the 240K resistors fail short. The 11V value seems to be the first at which the diode has a steep enough voltage vs current curve "shoulder" and draws negligible, if any, current at the working input voltage, thus not affecting the readings. At the same time, reaching 11V across the inputs will still not be enough to damage the op amp, see below.4) A decent op amp that provides sufficient output current and slew rate. Defining "sufficient" is difficult for me, I just found what works experimentally, in my case it's a nice RRIO quad-channel AD8608 that allows to use a single 5V supply to power everything, rather than having to make dedicated power rails for the op amp. There's no strict requirement for a RR op amp, however, and something like a good old TL084 can be used, provided that it's powered in such a way that the input/output voltage swing specs are met. But then it's necessary to make sure that the ADC inputs aren't overdriven which happens automatically with a 5V-powered op amp.Another advantage of this AD8608 is that its inputs are allowed to receive voltage higher than VCC+0.6V if the input current stays below 5 mA, which is the case, unless the input protection components (or the circuit designer) fail. It may be possible with other ICs that have integrated input clamping diodes, but in this case the 5 mA limit is explicitly specified in the datasheet.Two channels are used to buffer the differential input signal, the other two buffer the common mode and ADC Vref references. For these I used MCP1525 and MCP1541, respectively.5) ADC: SPI-compatible MCP3304 (MCP3302 will work as well -- whatever is cheaper/easier to get) working in fully-differential mode and providing a 13-bit output value from -4096 to +4095. MCP3202/3204/3208 will also work, but it cannot into fully-differential mode and signed output, providing lower effective resolution.6) Galvanic isolation between the ADC and the SPI digital data receiver: ADuM2401BRWZ. A nice little IC working no questions asked at the ADC's max clock of 2MHz and beyond. Beware, the "ARZ" version works up to 1MHz only, so need to get the "B". Zero hassle compared to optical isolation, which is still possible, but wastes more power and is fiddly in getting it right (which I however did successfully) in terms of choosing proper high-speed optocouplers and resistor values for them, not to mention the number of components and board space used, considering one optocoupler plus the passives per each SPI pin (4 total).7) Digital SPI signal receiver and processor: Orange Pi Zero LTS single-board computer, which has been collecting dust in a drawer for several years. Nice little thing. Rather slow (~20ksps max) with the WiringOP library, but with DMA access to GPIO registers* it can easily reach the 2.1MHz/100ksps speed that the MCP3304 can work at, and do all the necessary math in real time.Providing uninterruptible power for it is a separate topic. There are multiple possibilities.(*in case anyone's interested, I published abasic proof-of-concept implementation.)8) (not shown on the schematics) Power supply for the op amp, ADC, voltage references and the "unsafe" side of the ADuM2401: a 5V-5V isolated DC-DC converter from AliExpress.Nice and cheap thing, comes in a variety of input and output voltages, can be used to make dual supply rails etc., really useful to have a handful of them in the components bin. Input is powered from the OPi 5V rail, output goes to a MIC5205YM5 LDO regulator set for 5.1V output, thanks to the fact that my DC-DC converter gives about 5.2V on the output when input is 5V. It's really better to use a 5V-9V model and use a plain old jelly bean LM317 instead, but all I had at the time was the 5V in, 5V out model.The "safe" side of the ADuM2401 is powered from the 3.3V rail of the SBC, which is the logic level of its GPIO pins.At this point we have the original (save for the effects of the input resistors' parasitic capacitance and inductance) input waveform sampled 100000 times per second which is more than enough for the 50/60 Hz mains voltage.Simple math calculations (but we have to implement zero-crossing detection to process complete periods, which, however, is easy enough on the software side) will yield us real-time timestamp, RMS, DC offset, frequency and crest factor values, which can be used as a measure of distortion of the input signal relative to the ideal sine wave at the measured amplitude. The raw values received from the ADC chip will need their DC offset and gain corrected, which is easily done on the software side. Calibration is done with any TRMS multimeter you trust. It only remains then to implement some graphing of the results which is usually the least pleasant part of the job.This is likely as much as any hobbyist would ever want to have. Well, I also wanted to perform FFT on my samples to properly calculate THD in real time, but unfortunately this is where I hit my lack of knowledge and fail to understand how to use the FFT libraries to do this. So I ended up simply calculating the crest factor deviation as a measure of quality of the input voltage.Finally, it's dirt cheap, all parts combined probably under $30 or maybe $20, which includes the Orange Pi SBC. Far below any factory-made data logger.

author: BeBuLamar
author_rank: Super Contributor
timestamp: January 26, 2023, 09:07:58 pm
content: Quote from: rstofer on January 26, 2023, 12:36:03 amI think the OP wanted to see what the wavform looks like when the voltage drops not so much how far it drops.