How to measure this circuit with an oscilloscope? - Page 1
Forum section: electronics / beginners

author: crgarcia
author_rank: Regular Contributor
timestamp: March 13, 2022, 11:59:05 am
content: I just bought my first oscilloscope, a Rigol MSO5074.I built a circuit similar than this one, that I use to sense mains voltages with an ESP32. I have now connected it to the new oscilloscope:(full project schematics and layout link)Since the PCB is powered by mains, I am using an isolation transformer and a differential probe set to 1/10 (datasheet link)I was expecting to see something like this:But instead, this is what I seeIs this normal, or is there anything I am missing?Thanks!

author: Ian.M
author_rank: Super Contributor
timestamp: March 13, 2022, 01:22:33 pm
content: Assuming your differential probes input leads are *BOTH* connected to the circuit, with one on 'Gnd' and the other on the terminal you called 'Oscilloscope', and the probe is working correctly (try it on a signal generator, or the secondary of a low voltage mains transformer, or even on the Oscilloscope's probe test output), it seems likely you either have a problem with the circuit design, the measurement setup, or your expectations. As theLDA210is a Darlington output optocoupler, it has very high CTRR, (max. 30000) so may not be turning off long enough for C11 to charge significantly. If the desired function is detecting the presence of mains, its likely that your scope trace shows the optocoupler on all the time so operating correctly. If you are trying to do zero crossing detection, remove C7 and C11 and put a resistor across the optocoupler LEDs for a sharper turnoff. Try 10K between pins 3 and 4.

author: Bud
author_rank: Super Contributor
timestamp: March 13, 2022, 01:41:18 pm
content: Also turn BW Limit to ON on the scope to reduce noise, as well as enable averaging.

author: rstofer
author_rank: Super Contributor
timestamp: March 13, 2022, 01:45:52 pm
content: and try Single trigger capture

author: bdunham7
author_rank: Super Contributor
timestamp: March 13, 2022, 02:57:37 pm
content: Start by taking a snapshot of what you see with everything set up the exact same way except the mains power turned off. I think you'll see a lot of noise!Why isn't the output of the optoisolator circuit safe to feed directly into the oscilloscope?

author: crgarcia
author_rank: Regular Contributor
timestamp: March 13, 2022, 04:17:39 pm
content: Quote from: rstofer on March 13, 2022, 01:45:52 pmThis does not change the graph unfortunately.Quote from: Bud on March 13, 2022, 01:41:18 pmI enabled BW, not sure what it does but it look the same to me. No clue how to enable averaging either. I will take these two as homework to figure outQuote from: bdunham7 on March 13, 2022, 02:57:37 pmI tested the differential probe (yellow) and the normal probe (blue) at the same time with the scope calibration point (not sure if it is called like this). Both look very similar to me, I cannot say if they are right or wrong because this is the fist time I see an oscilloscope in my lifeI measured the 3.3v with the same probe, and this is what I get:I tried enabling and disabling the mains sensing, and you are right! They both look the same (AC coupled), I guess that means I do have a lot of noiseWith mains connected:Without mains:I can try to connect the oscilloscope directly. The problem is that the 3.3v are coming from a Power Supply in the PCB (RAC-05-05SK) and I am not sure if GND is at earth potential. What can I do to make sure it is safe?Thanks all!

author: Terry Bites
author_rank: Super Contributor
timestamp: March 13, 2022, 05:07:37 pm
content: N an E are very often bonded together at the breaker box or at the utilty company fuse(s). This means that there is no electrical separation of N and E. N is E (kinda) I havent read the IRAM/AEA standards I'm ashamed to say. To get this measurement done without an electroboom and blown scope incident, use an isolation transformer to break the connection between N and E on the mains input to your rectifier.Probe safely.

author: Ian.M
author_rank: Super Contributor
timestamp: March 13, 2022, 05:10:37 pm
content: You said earlier that you are powering your board from an isolation transformer, and you are using aRacom RAC05-05SKPCB mount PSU module which is approved for Class II installations (without FG). Therefore its safe to ground your PCB's logic side 0V rail. If in doubt, use a DMM with a mains rated low impedance voltage test mode to check for significant AC and/or DC voltage between your scope probe ground and where you want to connect it, with the power on, before connecting it.Incidentally, I don't like the way you run Neutral to the optocouplers on the opposite side of the board to and under low voltage tracks to the relays. If the board is of adequate thickness and the FR4 has certification for its insulation breakdown voltage, that's technically permissible, but unless the low voltage side is grounded, I still wouldn't do it.

author: CaptDon
author_rank: Super Contributor
timestamp: March 13, 2022, 05:42:12 pm
content: With that much capacitive filtering you are basically pulling the 3.3v to gnd and the capacitance is holding it there. That little bit of noise is to be expected and some of it is probably noise created by the active differential probe itself. What you have shown in your captures is not out of line with what I would expect to see.

author: crgarcia
author_rank: Regular Contributor
timestamp: March 15, 2022, 08:22:59 am
content: Quote from: Ian.M on March 13, 2022, 05:10:37 pmThanks a lot for the feedback. I really appreciate it! !I have redesigned the N line through the high voltage part, keeping the 1.5mm clearance.Schematics:https://github.com/crgarcia12/electronics-homeassistant-lightscontroll/tree/main/PCB/schematics-v17#device-schematicsClearance:https://github.com/crgarcia12/electronics-homeassistant-lightscontroll/tree/main/PCB/schematics-v17#clearanceQuote from: CaptDon on March 13, 2022, 05:42:12 pmIt is not clear to me if what you mean is that this noise is always present in PCBs, or it is due to my design.Can this affect the ESP32? Should I add other inductor/capacitor at the LD1117v33 (5 to 3v converter)?Thank you all!

author: Ian.M
author_rank: Super Contributor
timestamp: March 15, 2022, 11:00:38 am
content: Errrr..... 1.5mm clearance? You are in a 220V country and min. 4mm would be what is normally used for safety, and 2mm just for function (e.g. L to N). The creepage and clearance calculators athttp://www.creepage.com/can help you get it right!N.B. Relays, optocouplers etc. intended for use at mains voltage are generally designed so their pins have enough creepage and clearance distance with a normal sized pad. If you don't do anything stupid like running tracks under them in the isolation zone, you can usually avoid the need for long slots, which are undesirable because they mechanically weaken your board. Short slots between individual pairs of pins may still be needed if you need higher creepage distances.

author: crgarcia
author_rank: Regular Contributor
timestamp: March 18, 2022, 01:02:46 pm
content: Quote from: Ian.M on March 15, 2022, 11:00:38 amThanks for the tip!I'm wondering why does Kicad has a completely different calculation?I was using this:https://github.com/crgarcia12/electronics-homeassistant-lightscontroll/tree/main/PCB/schematics-v17#clearanceI was also planning to coat the PCB, with a 97kV/mm2insulator.Anyways, based on your link. I think it will be better to rethink completely the project, and probably do not use mains at all. Thanks a lot for your helpThanks!Carlos

author: Ian.M
author_rank: Super Contributor
timestamp: March 18, 2022, 02:44:38 pm
content: Its complying to a different standard. IPC-2221A <> IEC-60950-1.Both are big and complex standards, but electrical creepage and clearance is only a page and a half of IPC-2221A whereas I believe IEC-60950-1 has 30 pages on it!IPC-2221A can be found here:http://www-eng.lbl.gov/~shuman/NEXT/CURRENT_DESIGN/TP/MATERIALS/IPC-2221A(L).pdfUnfortunately IEC-60950-1 is payware, but the closely aligned UL-60950-1, based on it, is available:https://composter.com.ua/documents/IEC60950-1.pdfPlease *DON'T let this put you off the project - its already safer than a lot of mains powered electronics out of China! You just need to shuffle stuff around a bit to reach IEC-60950-1 creepage/clearance distance standards.

author: crgarcia
author_rank: Regular Contributor
timestamp: March 20, 2022, 06:42:32 pm
content: Quote from: Ian.M on March 18, 2022, 02:44:38 pmThank you very much Ian for all the info and tips.This is my very first project, and I am learning electronics while doing it. As a newbie without any professional around I can ask questions or get a review, it's very hard to know if this is safe or not and what I should add. Hence your advices are highly appreciated.Before your last answer, I was decided to quit the project, now I think I will give it another try and see if I can make it better.Thanks a lot again!