Design for safely measuring mains (review request) - Page 1
Forum section: electronics / beginners

author: pcee
author_rank: Regular Contributor
timestamp: April 10, 2023, 11:55:34 pm
content: I want to safely measure mains voltage and current with my oscilloscope. While I could use an active differential high voltage probe and current probe, that’s about $1000 for the two and still requires exposed mains voltage.I’d rather have something that isolates and steps down the voltage (and includes a current transformer) to expose only safe test points so that I can simply use passive probes safely.Here’s a rough sketch of what I’m imagining:(Part numbers are just placeholders from the KiCad symbol library. This particular CT requires 5V DC, so I picked the first 5V power supply in the library.)Does such a thing (with or without a switch) already exist?If not, does this look like a sound approach? Am I missing any key components?If it looks like I’ll need to build something myself, I’ll have follow-up questions.

author: pcee
author_rank: Regular Contributor
timestamp: April 14, 2023, 04:56:14 pm
content: (bump) Since this involves mains, would this thread be better in the projects forum rather than beginners?

author: shapirus
author_rank: Super Contributor
timestamp: April 14, 2023, 05:02:26 pm
content: What's the reason behind using the oscilloscope in this task?You said you needed to "measure mains voltage and current", which can be done with a DMM (and, if required, a current clamp) where no additional isolation would be necessary, provided that the measuring equipment is of a sufficient quality.If you need to see the waveform, you can get away with a simple magnetic step-down transformer.

author: Siwastaja
author_rank: Super Contributor
timestamp: April 14, 2023, 05:03:06 pm
content: Would you be OK with just AC current measurement? Standard CT would not require any power supply so would be easier to deal with. It will saturate under large DC offset, of course; in that case, use that LA25-P.For safety, replace SW1 with a double pole switch, interrupting both live wires. Line and neutral are both live wires, even if you have polarized plug.Transformer is not perfectly accurate for measurement, especially if you need accurate phase information (timing, for example to calculate real power). You can compensate by calibrating out any random transformer, though. Special measurement transformers exist but are quite expensive AFAIK (I looked into it years ago and did not find low-cost solution).

author: pcee
author_rank: Regular Contributor
timestamp: April 14, 2023, 08:03:52 pm
content: Quote from: shapirus on April 14, 2023, 05:02:26 pmGreat question. I have a good Brymen DMM, so I could measure absolute values, as you observe.I'm trying to replicate this sort of analysis of LED lightbulb drivers:So in addition to the mains waveforum, I want to see the current draw waveform.QuoteBut that would only give me the voltage waveform, no?

author: pcee
author_rank: Regular Contributor
timestamp: April 14, 2023, 08:14:08 pm
content: Quote from: Siwastaja on April 14, 2023, 05:03:06 pmI also want voltage, so I think I'd still need a step-down transformer as well, but I'd be happy to use a CT that doesn't require a power supply. I didn't see such a transformer in the KiCad symbol library, so I just grapped the LA25-P. What sort of "standard CT" would I be looking for?QuoteThank you for pointing that out. I actually plan to use a dimmer light switch so that I can measure the LED bulbs' color rendering at various brightness levels, so I think that will be sufficiently safe.QuoteYes, if I need that level of phase accuracy, I'll calibrate to deskew the CT measurements.

author: Benta
author_rank: Super Contributor
timestamp: April 14, 2023, 08:59:19 pm
content: Quote from: pcee on April 14, 2023, 08:14:08 pmIt's just a plastic "blob" where you pass either L or N through the hole in the middle.Example:https://de.rs-online.com/web/p/stromwandler/1243879For your TR1, I strongly recommend that you use a part with 230 VAC primary. Small mains transformers are driven so close to saturation that you get a very distorted output. Running at half nominal voltage improves that a lot.

author: Siwastaja
author_rank: Super Contributor
timestamp: April 15, 2023, 01:32:11 pm
content: Quote from: pcee on April 14, 2023, 08:14:08 pmWell, the term is just simply current transformer, or CT; look at the usual distibutors using that term (Digikey calls them Current Sense Transformers, though).LA25-P is NOT a CT.CT is a simple transformer only, basically just wire on a core, you making the another winding, usually N=1 by just putting the measured wire through the core once. CT develops a AC current signal as an output, so it REALLY needs a load resistor to convert it to voltage and not generate nearly infinite voltages. This load resistor is sometimes already integrated making your life easier.For example, look athttps://en.yhdc.com/product/SCT013-401.htmlfor the usual cheap Chinese suspects with split-type core, which is super handy as you don't have to break the circuit at all or expose mains wiring. (Although you need to strip the outer insulation, making double insulated wires single insulated, so you still should apply some safety thinking.)I second Benta's suggestion for derating the voltage rating of TR1 to improve linearity when used to measure voltage. Seeing you are in the 120V land, excess voltage rating is very easy to get, just buy a 240VAC rated transformer.Using such transformer for voltage measurement is not the best for accuracy, linearity or accurately measuring the mains voltage shape, but it's the easiest way to a safe design, so I second the idea of a transformer.Also your proposition of looking voltage & current waveforms on a scope makes a lot of sense. Multimeters are very limited in this sense, even if you have a "true RMS" thing.

author: BeBuLamar
author_rank: Super Contributor
timestamp: April 15, 2023, 03:52:35 pm
content: I don't know for sure but the waveform could be distorted somewhat by the transformer. Also the winding ratio must be precise enough to make sure the values are correct.

author: Benta
author_rank: Super Contributor
timestamp: April 15, 2023, 10:29:15 pm
content: What you'll experience is that the output voltage from TR1 will be too high, perhaps by 10...20%.This is because small mains transformers have quite high losses (copper and iron mainly), and the nominal output voltage is at load. You'll be running at practically no load. No big deal, can be solved with an appropriate resistor divider on the secondary to give you, eg, 12 VAC at 120 VAC input. Depends on the nominal secondary voltage.EDIT: I want to applaud your approach here. You are going about this the right way and looking at how to isolate your test equipment from the mains. Thumbs Up!

author: pcee
author_rank: Regular Contributor
timestamp: April 17, 2023, 01:57:45 am
content: Quote from: Siwastaja on April 15, 2023, 01:32:11 pmWell, I only found current sensors (current transducers, as it turns out) in the KiCad symbol library, so thank you for pointing out the difference! Is the primary benefit of a transducer the ability to measure DC current as well, or are they generally more accurate and linear than a current transformer?Are there any particular characteristics of a CT that I should look for? For example:Does a 15A rating simply denote the maximum measurable? Would such a high rating make < 1A measurements less accurate?Is the frequency rating of a CT the required center frequency in order to get valid current measurements, or is it a maximum rating? In other words, do I need to find a CT rated for 50-60 Hz, or is anything >= 60 Hz fine?Anything else?QuoteBeyond the voltage rating and step-down ratio, is there anything other specification that's important?And, out of curiosity, whatwouldbe better for "accuracy, linearity or accurately measuring the mains voltage shape" apart from the resistor divider mentioned by Benta?

author: pcee
author_rank: Regular Contributor
timestamp: April 17, 2023, 02:16:23 am
content: Quote from: Benta on April 15, 2023, 10:29:15 pmThank you! I normally work with non-hazardous voltages, so isolating myself from mains voltage makes me much happier! I'd rather think about and address the risks once and not have to remember extra safeguards every time I want to make a measurement.Since I'm not particularly experienced with mains voltage, would would I do differently when prototyping this? I don't imagine a breadboard will handle that amount of power safely. Is there a particular perfboard rating or pitch that I need? Or something else?Can I simply solder connections as long as I'm using wire rated for the voltage/current? Or do I need to use terminal blocks?Do I need a fuse or GFCI for safety?I plan to mount this inside a 3- or 4-gang plastic electrical box, so that I can easily mount the dimmer light switch. Does that seem reasonable?

author: Siwastaja
author_rank: Super Contributor
timestamp: April 17, 2023, 06:50:42 am
content: Quote from: pcee on April 17, 2023, 01:57:45 amUsing some existing EDA symbol library to choose parts to design in is IMHO a bad idea. Instead, I recommend looking at suppliers like Digikey/Mouser to see what is available to buy, then build your own library symbols and footprints, or if brave enough to take the risk, see if someone else did it before (which usually leads to wrong footprints and PCB respins, through).Yes, the primary benefit of products like the LA25-P is DC current measurement. It is also possible sometimes to see significant DC bias on AC current (e.g., half-wave rectified large loads), which would saturate a plain old CT.Otherwise, plain old CTs are quite accurate and have decent linearity. They also won't have any drifting offset. A DC-capable transducer solution will have offset error which also drifts. It's easy to compensate of course (e.g., by setting your oscillosscope into AC coupling mode), but one more thing to do.QuoteSee the datasheet for specifics. Usually 15A rating would mean 15Arms and therefore 21.15A would be measurable, with good, proven linearity. Although it seems CTs have quite a lot of excess range usually, but at some point the core starts to saturate and linearity suffer.Yes, excess range generally means less accuracy. Remember though that you can always just loop the wire through the core multiple times and that way dynamically adjust the range vs. accuracy. Works for those DC-capable things, too. Loop 10 times and now you get 10x the signal, and 15A rated part becomes 1.5A. (Remember that the wire just going through the core is already one "loop", even if it does not look like a loop. The loop is there, though; it's your whole circuit.)QuoteIf the frequency is lower, it will just saturate at lower current, I think. Maybe someone more experienced with CTs will chime in, but I think 50-60Hz, 50Hz, 60Hz rated CTs are all fine, the difference is small.QuoteDon't forget the load resistor, otherwise the CT can output pretty high voltages. Integrated load resistor type removes this mental burden.QuoteThe voltage trnasformer really "should" be a measurement transformer, but those indeed are so special and expensive (others: correct me if I'm wrong) that you will be using any random transformer outside the "intended" use (which is to supply power, not measure) - there is not much you can do, except to use a transformer rated to higher voltage and maybe add a load resistor to bring the output voltage down, and/or calibrate the thing out by measuring and comparing against known value (e.g., a good multimeter).Nothing beats the accuracy, bandwidth and phase response of a simple voltage divider directly connected to mains. The problem is with adding the safety isolation without introducing errors.Quote from: pcee on April 17, 2023, 02:16:23 amAlways use GFCI, no excuses. If your distribution panel already has one for that circuit, that's ok. If not, add a plug-in type when doing any kind of stuff with mains.Your distribution box already has fuses. Adding another does not hurt, and is a very good idea if you supply significantly smaller loads. Using a fuse (proper mains rated) allows you to use wiring and components rated for lower currents. Otherwise, everything needs to be rated to the same as the house wiring.

author: Benta
author_rank: Super Contributor
timestamp: April 17, 2023, 10:44:06 am
content: Mains transformers are defined by one thing only: winding ratio. The same goes for CTs.The problems start when current gets too high, forcing the transformer to behave in a non-linear fashion. Small mains transformers do this from birth, as the iron core is magnetised to a RCH before saturation. Dropping the primary voltage by half will move magnetization down into the linear range, which is what you want. The only downside is, that it wll supply less power, but that's a non-issue here. Remember: winding ratio is the same.The current limit for CTs is where the core begins to saturate = non-linearity. All current measurements below this limit are highly linear.Way back before you could buy everything on the web, I made a small CT wound on a ferrite toroid with 100 windings. Worked great and very exactly. The load resistor could be 1 ohm, 10 ohms or 100 ohms depending on the measurement range. Measuring the voltage over the load resistor gave you the primary current.I mentioned a voltage divider: this is simply to get a comfortable voltage range when measuring. I'll give you an example:Small 2 W transformer 240/24 VAC. Connecting it to 120 VAC should give you 12 VAC on the secondary. Except it won't. It will probably give you something like 15 VAC. That's because the 12 VAC are rated at full load. But the copper losses in small transformers are so high, that to achieve the 12 VAC, idle voltage must be higher to compensate.A voltage divider will bring back the desired 12 VAC. You can of course just pop out a calculator and do the correction, but this is much easier.

author: pcee
author_rank: Regular Contributor
timestamp: April 17, 2023, 09:32:27 pm
content: Quote from: Siwastaja on April 17, 2023, 06:50:42 amAbsolutely! I was just using it as a quick way to illustrate what I had in mind, not because I thought it was a particularly good fit.QuoteIs a CT rated for 100 kHz fine for measuring 60 Hz AC current?QuoteAh, right. And, yes, idiot-proof isolation is my priority.I'm thinking I should use a transformer with a low current rating, since my probes should be drawing negligible current?QuoteTechnically the only ground will be passed straight through to the load, and E27 sockets don't use ground, so is there any failure mode that would trip a GFCI?QuoteSo I could use a fuse at, say, 2x my expected maximum load (hard to imagine more than 200W from an LED bulb!) as an extra safety? And maybe small fuses for the test points as a failsafe?

author: pcee
author_rank: Regular Contributor
timestamp: April 17, 2023, 09:37:10 pm
content: Quote from: Benta on April 17, 2023, 10:44:06 amWill a dual-primary transformer (wired for 240V in series) work just as well as a single-coil, since each coil would have a 55V potential?Also, how far apart do I need to keep L and N connections on the perf board? And can solder handle the load? As I said, I don't have a lot of experience with mains voltage.

author: Benta
author_rank: Super Contributor
timestamp: April 17, 2023, 10:51:47 pm
content: Quote from: pcee on April 17, 2023, 09:37:10 pmCertainly..

author: pcee
author_rank: Regular Contributor
timestamp: April 23, 2023, 06:18:28 pm
content: Thank you all for your help! I've incorporated the voltage divider on the voltage transformer (in the form of a trim pot), added fuses, and selected possible transformers, and now I have some follow-up questions:Will BNC connectors for TP1 and TP2 work with a high-impedance oscilloscope probe? I like the idea of using the BNC tip for my probes so that I can have a physically stable connection, but all the connectors I've found are 50Ω. I know impedance mismatches usually cause major headaches, but I'm not an RF expert, so I don't know whether that's an issue here?Is there any reason not to use a trim pot for my voltage divider?Am I likely to need trim the CT output as well? If so, the datasheet says that a terminating 100Ω resistor produces a 10:1 A:V measurement, so would I be better off replacing that resistor with a 200Ω trim pot, or dividing/trimming the voltage after that resistor?Do resettable PTC fuses make sense for the outputs here? (I probably need one to protect RV1 at least, I'm not sure whether it's needed for the CT output?)Does it make sense to use 2 fuses per test point as I've done here, so that the resistance is balanced? Or are variations (within tolerance) likely to outweigh any benefit?Does the VPL24-210 look like a suitable voltage transformer? It's 10:1, rated for 230VAC, and has an inherently limited power output. (See below for specifications.)Does the CST-1015 look like a suitable current transformer? It can measure up to 15A and provides a 10:1 output, apparently low-power? (See below for specifications.)VPL24-10Datasheet:http://catalog.triadmagnetics.com/Asset/VPL24-210.pdfInput voltage: 230VAC (in series)Output voltage: 24V, 210mA (in series)Max (output?) power: 5WCST-1015Datasheet:http://catalog.triadmagnetics.com/Asset/CST-1015.pdfMax current measured: 15AOutput voltage: 1.5V for 15A measured using 100Ω terminating resistorOutput current:15mA?based on 0.023-watt rating for terminating resistor

author: Benta
author_rank: Super Contributor
timestamp: April 23, 2023, 07:50:31 pm
content: 1: yes2: no, but your value is far too low. 10...20 kohm would be more to the point. Personally, I'd measure the turns ration and use a couple of precision resistors.3: no.4: no. Unless you possess shares in a fuse company.5: no.6: yes.7: I'd go for 1:100 myself, but that depends somewhat on your measurement setup.

author: pcee
author_rank: Regular Contributor
timestamp: April 24, 2023, 01:46:41 am
content: Thank you!Quote from: Benta on April 23, 2023, 07:50:31 pmIs that to reduce the induced current when idle, or to allow for more flexibility when choosing precision resistors? (What do you consider "precision"? 0.1%?)QuoteDid you mean "turn ratio"? Do you mean to measure the voltage observed by oscilloscope vs. the input voltage in order to compute the correction factor?What brought the trim pot to mind was the ability to dial in exactly the right ratio, rather than trying to piece together the approximate ratio with fixed resistors.QuoteSince the voltage transformer can produce 5W max, wouldn't I need a fuse in order to protect trim pots or fixed resistors at a more reasonable power rating (e.g. 0.5W)?QuoteIs this because when the voltage divider is using a resistance of 10-20kΩ, the fuse's resistance only has a 0.25-0.5% effect?QuoteIs that because the lower output voltage allows for faster response time?I found this alternative, which lists a 20kHz-200kHz frequency range. Is this what you had in mind?CST306-2ADatasheet:http://catalog.triadmagnetics.com/Asset/CST306-2A.pdfMax current measured: 25AOutput voltage:0.25V?(100:1according to digikey, not documented on the datasheet. Is that because this CT has 100 primary turns instead of 1000 like the CST-1015?)Output current:150mA?(based on 100:1 turn ratio)Termination resistor rating:0.0375W?(based on the above output voltage and current)

author: Benta
author_rank: Super Contributor
timestamp: April 24, 2023, 11:22:41 pm
content: First point: there's absolutely no reason to load TR1 unnecessarily. My suggestion of 10...20 kohms is a compromise between resistor size (wattage) and oscilloscope input impedance. 1% resistors should be good enough.Second: yes, I meant turn or winding ratio. Apply a known sine wave voltage to the primary, measure the secondary voltage. That's you turns/winding ratio. It's fixed.Third: with the voltage divider, you'll never be able to short the transformer output. And those small transformers are usually short-circuit proof anyway. No need for fuses.Last: CTs are a bit difficult to get your head around, but they do exactly that: transform current to current. If you have a 1:1000, it'll produce 15 mA of secondary current at 15 A. Looking back at your circuit, I think it's the right choice. Forget my 1:100 suggestion.

author: freda
author_rank: Regular Contributor
timestamp: April 25, 2023, 05:00:38 am
content: Quote from: pcee on April 17, 2023, 02:16:23 amum..no no. You have to be aware of what your doing ALL THE TIME.unless your designing a test fixture that someone else eventually uses, like ona production line, which I don't think you are going from the OP.hmm, the voltage transformer thing. Unless you can afford a proper instrument measurement transformer with all the required specs. That setup would continually do my head in, in trusting what it is showing. You have to adjust for phase, and high freq artifacts that your going to get from a dimmer, i'm assuming your going to want to notice those? no?You don't need a differential probe, you need a high voltage oscilloscope probe, they are notthat expensive, and sounds like you ought to get one at least.If your constructing some sort of test fixture setup, I'd build my own voltage divider froma series of high value resistors, your only dealing with 120VAC, not thousands so rathersimple, and you can easily calibrate with applying say a 50VDC that you know accurately.You may be able to enter a custom multiplier value for the Osc channel too.one more thing, the double pole switch, Good! But please put an indicator lamp afterit to visually remind you the circuit is HOT.I know these days you can get LED indicator lamps for AC, but I really wouldn't trust themfor here. Prefer Neon, yes getting harder to get, but infinitely more trust worthy.IMHOThe current TF is good, even comparatively cheap ones should have a frequency responsevery good enough for your purposes here.

author: Benta
author_rank: Super Contributor
timestamp: April 25, 2023, 10:10:16 pm
content: Quote from: freda on April 25, 2023, 05:00:38 amFirst point: why would you need to adjust for phase? And where did the dimmer come in?Second: a high voltage probe will not isolate you from the mains. A differential probe will. It's two different things. Try not to kill people, please.

author: pcee
author_rank: Regular Contributor
timestamp: April 26, 2023, 03:32:47 am
content: Quote from: Benta on April 24, 2023, 11:22:41 pmAnd low resistance produces high current, so you're aiming at a high resistance that doesn't collide with the oscilloscope impedance?(Also, it turns out that fixed resistors can handle lots more power than trim pots can, so definitely no fuse required!)QuoteCan I use a 3V sine wave from my function generator, or are power transformers not that linear across their whole range? In other words, should I just use mains and measure the primary with my DMM?QuoteThat's a relief! Everything I found with a 1:100 ratio was 20kHz and up.

author: pcee
author_rank: Regular Contributor
timestamp: April 26, 2023, 03:37:32 am
content: Quote from: Benta on April 25, 2023, 10:10:16 pmThe light switch I'm using is a dimmer, so that I can test the bulbs at varying brightness.QuoteNor will a voltage divider, for that matter. I want my galvanic isolation! I'll settle for less precision in exchange for safety.And as for phase, I can always deskew on my oscilloscope.

author: coppice
author_rank: Super Contributor
timestamp: April 26, 2023, 03:55:48 am
content: Quote from: pcee on April 26, 2023, 03:37:32 amBe careful to only use that with dimmable lamps. Most dimmers don't turn on for the full cycle, even when turned to maximum. You can get enough high frequency energy to make a bulb with an RC supply melt.

author: shapirus
author_rank: Super Contributor
timestamp: April 26, 2023, 05:18:07 am
content: Quote from: pcee on April 26, 2023, 03:37:32 amhmmm. what about mains->divider->ADC->SPI isolator->(maybe an MCU)->DAC?

author: freda
author_rank: Regular Contributor
timestamp: April 26, 2023, 06:42:34 am
content: Quote from: Benta on April 25, 2023, 10:10:16 pmdrama Queen much?dimmer, LED driver, well whatever! But note these things are NOT mains isolated. Seems to me the OP wants to muck around with these things, that's already a dangerous idea in itself.Oh I was negligent in not mentioning requirement to use mains isolation transformer.I still treat it as danger, and limiting me from the near infinite energy from the powerpoint [even in the mSec before the RCD trips]Does allow me to choose the common measurement point.Oh, further point, a differential probe of itself doesn't isolate "You" from the mains, especially if your not aware of what your doing. Yes it gives your measuring instrument a galvanic isolated differential voltage between 2 points. But if one point is mains hot side, that still is mains if you inadvertently touch it.Quote from: pcee on April 26, 2023, 03:37:32 amWhats with the tone of fixation on galvanic isolation? Its not a magic protection if you have trouble focusing with a task on hand. Maybe you should drop this project altogether?

author: Siwastaja
author_rank: Super Contributor
timestamp: April 26, 2023, 03:10:48 pm
content: Maybe he really just wants to characterize existing productswithouttearing their cases apart or measuring any internals. If that is the case, then it makes a lot of sense to build a decent completely galvanic isolated "measurement box" once and then using it will be perfectly safe.

author: Benta
author_rank: Super Contributor
timestamp: April 26, 2023, 07:23:45 pm
content: That was my thought as well.

author: pcee
author_rank: Regular Contributor
timestamp: April 26, 2023, 07:40:07 pm
content: That is indeed my plan: no exposed mains voltage once it's in an enclosure, so that I can plug in the DUT and safely characterize its power usage with my oscilloscope.Think of it like a glorified line splitter.

author: pcee
author_rank: Regular Contributor
timestamp: May 12, 2023, 01:07:48 am
content: So far so good, I've done initial tests with the transformers using my DMM (BM257s) and oscilloscope and a 43W incandescent bulb as a load. At this point, I've used only the DMM to test mains voltage and current directly, using the scope only for low-voltage tests.1.Should I calculate the voltage divider for TR1 based on Vpeak or Vrms?Comparing TR1's voltage vs. DMM's measurement of the output mains voltage, I get somewhat different ratios for Vrms and Vpeak. (My DMM measured 163.4V peak, 121.3 Vrms.)2.Is there any way to compensate for the phase error introduced by TR1?I'm not surprised there's some delay, but the magnitude is surprising: roughly 270µs! My scope's deskew function only lets me enter values up to 100ns. How do high-voltage differential probes keep their delay down to the ns/ps range? Or does Siglent's deskew fixture allow for higher deskew values?3. For reference, TR2canuse a tiny bit of calibration, but doesn't need it like TR1 does. Comparing its output with my DMM's inline measurement of actual current, resistor TR2 reads peak current of about 98.7% what the DMM does (and about 95.4% for RMS; R1=99.8Ω). Combining resistors to get R1=101.1Ω yields a TR2 value of 99.5% the peak value of the DMM and 96.7% RMS.

author: pcee
author_rank: Regular Contributor
timestamp: May 16, 2023, 12:39:33 am
content: Edit: added screenshot above to illustrate skew

author: pcee
author_rank: Regular Contributor
timestamp: June 04, 2023, 02:12:50 am
content: Quote from: pcee on May 12, 2023, 01:07:48 amI feel like the man with two clocks who is never sure what time it is. I now have a decade box so I can adjust the resistance of my voltage divider to try matching different values.If I match Vpeak measured by my scope (via 10:1 transformer) to the 160Vpeak directly measured by my DMM, the Vrms diverges between them. 114Vrms on the scope vs. 118.5Vrms on the DMM.If instead I match the Vrms (119V at this point), the Vpeak diverges. 166.7Vpeak on the scope vs. 160.6Vpeak on the DMM.If I use a power recorder to measure Vrms, it reads lower than the DMM: 118.3Vrms vs. 119Vrms. (Sadly my power recorder won’t measure crest voltage.) The power recorder is measuring at J1 and the DMM is measuring the power recorder’s output.Why the difference in Vrms calculation between the three? The DMM is a Brymen 257S, and the power recorder is a Zhurui PR10-E.Should I be calibrating to match Vrms or Vpeak?

author: Jwillis
author_rank: Super Contributor
timestamp: June 04, 2023, 02:36:25 pm
content: You have an invasive components TR2 . TR2 is acting as a choke on the main line . Inductors Lag current. If you want accuracy you need to use Non-invasive methods. Use a current transducer to measure current not a current transformer.

author: pcee
author_rank: Regular Contributor
timestamp: June 04, 2023, 08:45:04 pm
content: Quote from: Jwillis on June 04, 2023, 02:36:25 pmIt's actually a non-invasive (through-hole) current sense transformer. I based the symbol off of their drawing rather than using the IEC standard, sorry for the confusion.I'm still puzzled by the disparity between peak voltage measurement vs. RMS calculation between the scope and the DMM especially. I imagine the DMM is likely to compute RMS more accurately than the power recorder, but I would have thought the scope would match the DMM once calibrated.

author: Benta
author_rank: Super Contributor
timestamp: June 04, 2023, 09:53:34 pm
content: First, TR2 isnotacting as a choke.Second: @pcee, welcome to the real world.What you're seeing is sine wave distortion of the mains voltage (it's not TR1), which you'll see in every home in the world. This of course leads to current draw distortion as well. Both of your waveforms are typical, and you'll have to live with it. It explains your rms/peak discrepancies fully(*).The small delay through TR1 is due to winding resistance (=LR delay), a solution might be a larger transformer.(*): due to a lot of apparatus with rectifier/capacitor power supplies still in use, as well as cheap power transformers running at saturation limit.

author: pcee
author_rank: Regular Contributor
timestamp: June 05, 2023, 12:06:42 am
content: Quote from: Benta on June 04, 2023, 09:53:34 pmI'm not sure I follow. I'm not concerned about a divergence betweentheoreticaland observed Vrms for a given Vpeak -- I know mains voltage won't be a perfect sine wave. Instead, I'm puzzled by the divergence inobservedVrms for a given Vpeak.Specifically, given a specific Vpeak as measured by both the (calibrated) oscilloscope and the DMM (say, 160V), why would they calculate different Vrms? Do you mean that TR1 is filtering out the distortion so that the scope is measuring a different wave than the DMM?Given the difference, should I calibrate to match Vpeak between the scope and DMM, or should I calibrate to match Vrms?

author: Benta
author_rank: Super Contributor
timestamp: June 05, 2023, 07:04:48 pm
content: Sorry, but I'm confused now rereading this whole thing.It's nebulous what you're measuring where and with what.Could you post the schematic with the test points you're using, please?

author: pcee
author_rank: Regular Contributor
timestamp: June 05, 2023, 09:10:54 pm
content: Quote from: Benta on June 05, 2023, 07:04:48 pmSure, it has evolved slightly since the last schematic. I'm moving the dimmer switch to an outboard box so that I can run tests without any phase cuts.MES0 is my DMM probing the actual mains output. MES1 is channel 1 of my oscilloscope.

author: Benta
author_rank: Super Contributor
timestamp: June 05, 2023, 09:44:20 pm
content: The MES1 point should show around 14...14.5 VRMS. I don't understand the plots from your 'scope.Just use the DMM for the MES0 and MES1 RMS values to get the resistor ratio for the TR1 output voltage.When that's done, show us a dual-channel plot of the TR1 (after the divider) and the TR2 outputs to evaluate the phase shift.EDIT: and by the way, this is the internationally correct symbol for "Earth" in this context (KiCAD: "power -> Earth_Protective")

author: pcee
author_rank: Regular Contributor
timestamp: June 13, 2023, 10:30:14 pm
content: Quote from: Benta on June 05, 2023, 09:44:20 pmI was originally getting 16.3Vrms, which I told the scope to scale 10X.QuoteComparing apples to apples would have been smart. I think I was concerned that the voltage variation over time would be a problem so I wanted to measure both simultaneously. But of course measuring with the SAME device is going to be way more reliable than with two different ones.QuoteHere's a zoom-in showing the delay of 158.5µs:I did try adding a (2.07µF) capacitor in parallel with R1, which sometimes got the skew down to ~400ns on a sine wave, but of course that created a LPF that totally mangled the phase cuts of dimmer switches:Is there any other straightforward way to compensate for the LR delay?Overall, with the voltage divider and tweaked resistance for R1 (104Ω to match my DMM's current reading), I get pretty good graphs and numbers even with the minor skew:p.s. That earth symbol is part of the P1 and J1 symbols. I've been wanting to get rid of it there, so thank you for pointing me to the correct replacement.

author: Benta
author_rank: Super Contributor
timestamp: June 13, 2023, 10:48:13 pm
content: Please add some explanation to your plots. I can guess that yellow is the the voltage and pink is the current, but I'm not certain.Also, you seem to be scaling/converting the plot units. Please don't do that, just show the raw voltages at TP1 (I expect your divider is now correct) and TP2. Don't try to be fancy, it causes confusion.

author: pcee
author_rank: Regular Contributor
timestamp: June 13, 2023, 10:55:07 pm
content: Yes, C1 (yellow) is voltage. C2 (pink) is current. F1 (orange) is calculated V*I.The only scaling I'm doing is the 10X to take the readings from their actual TP1/TP2 measurement to the calibrated output values at J1, e.g. 12.0477Vrms at TP1 -> 120.477Vrms at J1 and 38.4487 mVrms at TP2 -> 384.487 mArms at J1.Not trying to be fancy, just doing less math in my head.

author: Benta
author_rank: Super Contributor
timestamp: June 13, 2023, 11:00:19 pm
content: Quote from: pcee on June 13, 2023, 10:55:07 pmThat's fine when working on it, but complicates things when doing circuit analysis.

author: pcee
author_rank: Regular Contributor
timestamp: June 13, 2023, 11:52:43 pm
content: Fair enough. I'm not at the scope now, so it'll take me a little while to regenerate plots with bare voltage.In the mean time, aside from my attempt at delaying the current measurements with an RC circuit, is there any other straightforward way to compensate for the LR delay that wouldn't mess with phase-cut waveforms?

author: Benta
author_rank: Super Contributor
timestamp: June 14, 2023, 12:02:48 am
content: To be honest, it's hard to judge phase skew on a couple of (fuzzy) sine-waves.On the other hand, the vertical phase cut line in the fourth picture looks excellent to me. Both your transformers are behaving really well.The plot also has a couple of artefacts that tell me you may need to trim your 'scope probes.

author: EPAIII
author_rank: Super Contributor
timestamp: June 15, 2023, 08:41:56 am
content: Err, a HV probe, properly used, damn well better isolate you from something as low as mains Voltage. After all, they are designed for thousands, even tens of thousands of Volts. If it doesn't, smash it to pieces (so no one else uses it) and toss it in the trash.And such insulation need not be expensive. Just thick enough and properly designed.BUT most ordinary scope and meter probes are good up to at least 500 or 600 Volts. The only danger is if you touch the exposed conductor.Quote from: Benta on April 25, 2023, 10:10:16 pm

author: pcee
author_rank: Regular Contributor
timestamp: June 16, 2023, 01:40:18 am
content: Quote from: Benta on June 14, 2023, 12:02:48 amWhat artifacts are you seeing? I just double-checked with a 1kHz square wave and the probes seem well trimmed.Per your request, here are plots without any channel scaling, just the actual voltages read by the probes with my 43W incandescent bulb:Here's the measured skew:...which I can correct with a capacitor:...but then look what it does to my phase cut current measurements!Here's what it looks like without the capacitor, much better:It occurred to me that if I really cared about this 160µs skew, I could probably use a second VPL24-210 (like TR1) between R1 and TP2 to produce identical delay in the measured signal, couldn't I? Though to match the number of windings, would I need to use it in the same 10:1 configuration (shrinking small voltages still further), or would it produce the same delay if I used it backwards (1:10 providing amplification)?

author: pcee
author_rank: Regular Contributor
timestamp: August 21, 2023, 09:37:09 pm
content: Now that I've got the design worked out, I'm working on the PCB layout. Since this design originated from my lack of experience with mains voltage, I unsurprisingly have a few questions about the PCB itself.The dashed lines on the silkscreen mark out roughly where the mains wires will pass ~1/2" above the PCB.1. Does the PCB need any protection from current induced by the nearby mains voltage? For example, should the traces be on the bottom of the PCB with some sort of filled copper regions on the top to shield them? (I know you don't want to run low and mains voltage in the same conduit due to induced current, but maybe that's only significant over long distances...)2. Does it make sense to have a ground plane instead of ground traces in this design? Since TP1 and TP2 will go to an oscilloscope that has a shared ground, the two test points will have a common ground (along with the TR1 header).The PCB layout and corresponding schematic are attached.Thanks tocoppice's warningabout dimmer switches, I've moved the dimmer switch out of the probe into its own breakout box. That way I can plug mains into the probe to get a full AC sine wave, and then plug in the dimmer breakout box to test dimming.

author: Circlotron
author_rank: Super Contributor
timestamp: August 21, 2023, 09:49:36 pm
content: Quote from: Benta on April 14, 2023, 08:59:19 pmGood point. I’d also use a toroidal transformer for better frequency and probably phase response. Maybe about 100VA size, not a baby one. And put a small resistive load on the secondary, say 5 or 10 percent so there will be less chance of ringing than if the secondary was open cct. Maybe try different values of load to see if there is any affect on phase shift. And of course, put this transformer upstream of the current sensor, as you have already done.

author: Benta
author_rank: Super Contributor
timestamp: August 21, 2023, 11:37:31 pm
content: Why such anaemic tracks?Go to at least 0.8 mm, but 1.2 mm won't harm. Or even fatter.Apart from that, congrats on your results.

author: pcee
author_rank: Regular Contributor
timestamp: August 22, 2023, 02:45:02 pm
content: Quote from: Benta on August 21, 2023, 11:37:31 pmWhy? My first PCB: I was using a tutorial for an MCU that used 0.3mm for signal, so I just used that.At your recommendation, I've bumped it up to 1.2mm.Since you didn't mention anything about induced current from the mains voltage, should I assume that I don't need to worry about that?Thank you for all your encouragement!

author: pcee
author_rank: Regular Contributor
timestamp: October 07, 2023, 01:26:53 am
content: The PCB arrived, I soldered everything into place, calibrated it, and it works great!What would be a good way to make the end result (KiCad project, parts list, shopping carts?) available for others to use? Attach the KiCad project here? Or is there somewhere else more easily discoverable?Is there some standard repository for project designs?

author: shapirus
author_rank: Super Contributor
timestamp: November 25, 2023, 08:34:57 pm
content: Quote from: pcee on October 07, 2023, 01:26:53 amKiCAD files in a github repository is the way to go.

author: Benta
author_rank: Super Contributor
timestamp: November 25, 2023, 10:29:54 pm
content: Quote from: pcee on October 07, 2023, 01:26:53 amGratulations, I'm glad your design was successful!Concerning design repositories... I like your attitude, but I don't really know of any.GitHub and GitLab are places where projects like yours go to die a quiet death. They're used by programming nerds, but for electronic engineering I don't see any acceptance. They're just too user-unfriendly, cumbersome and geeky.Sorry.

author: shapirus
author_rank: Super Contributor
timestamp: November 26, 2023, 12:36:17 am
content: Quote from: Benta on November 25, 2023, 10:29:54 pm...as long as nobody shows interest in them. They are indexed by search engines and can be found by those looking for what can be considered a match.Quote from: Benta on November 25, 2023, 10:29:54 pmThis is partially true. Git was most definitely created by extraterrestrial aliens, so to use it one has to have a suitable mindset and the desire to learn it without abandoning the learning.On the other hand, that alien creature can be dressed as a normal human to make it look familiar and relatively easy to interact with. That's what hosted repo services like github do, and there's also GUI frontends to git which some people find convenient (I would not recommend touching them though -- if you use git, then use the proper command line tool).Git, being a distributed VCS, is the right tool for the job, which is sharing stuff for others to download and collaborate if they want.But you're right that chances are that the project will sit there and be rarely seen by anyone. However, my opinion is that if at least one person comes there from a search engine and finds it useful, then it's justified.