Help with first "high" voltage project - Page 1
Forum section: electronics / projects

author: ksoviero
author_rank: Contributor
timestamp: February 17, 2021, 05:44:53 am
content: I'm working on a personal project to monitor the real-time current draw of an appliance that's plugged into it. Similar to some of the smart plugs on the market that allow you to monitor energy usage. However, in my case I'm trying to monitor real-time current usage, rather than the longer-term averages those smart plugs offer. I've never worked with high voltage before (assuming 110VAC counts as "high" voltage around here, I know some of you are working with vacuum tubes, so...)Now then, I have a few requirements I'm trying to fulfill:- 15A max current draw- 110VAC @ 60Hz- 1 sample per second- Small amount of power siphoned off for powering MCUNow, everything from the MCU on (the wifi, API calls, etc.) I can handle no problem, that's smack dab in the center of my wheel house. But everything before that, like the power supply, current sensing, amplification of the current sense resistor values, etc. are way outside of what I have experience with.First of all, here's the schematic:https://i.ibb.co/HqVJYjt/Screenshot-from-2021-02-16-23-37-44.pngAs you can see, it's broken into two parts. The top part is the current sensing and amplification. The lower part is the 3.3v power supply for the MCU, et al.So, I have done my best to come up with what I think is the right approach, and I'd love for some feed back and recommendations.

author: bob91343
author_rank: Super Contributor
timestamp: February 17, 2021, 06:50:21 am
content: It seems overly complex. But that doesn't mean it won't work. You don't show the sampling circuit.Basically you want a recording ammeter. So what you have produces a signal that is proportional to the current being sensed. Now what?

author: ksoviero
author_rank: Contributor
timestamp: February 17, 2021, 06:58:16 am
content: Quote from: bob91343 on February 17, 2021, 06:50:21 amWell, that's partially because it doesn't exist yet. My current, and terrible, plan is to do it in software. Basically CS_OUT will connect to an ADC input on the MCU and when it needs to get a sample, it will sample repeatedly for 1/60th of a second and store the highest value.

author: uer166
author_rank: Super Contributor
timestamp: February 17, 2021, 07:36:14 am
content: Is "GND" in your schematic really GND? As in, the one you're standing on? If so, you've shorted the DC link negative to Earth thru the half-wave rectifier D1 and D3. At best, it'll blow the power supply section up, at worst, you'll get a nasty shock. 120VAC is not usually fatal, but it can be.First step would be to fully isolate the 120V mains from your circuit. Use an off-line fully isolated switching converter. I'd recommend an off-the-shelf module that has AC input and DC output to not fuck around, look for "reinforced isolation" (MeanWell makes some PCB-mount units). The ASC758 is already rated for reinforced isolation, so you're good there. Can't comment on the performance of anything, but step one would be to make everything safe and easy to probe.

author: EEauroro
author_rank: Contributor
timestamp: February 17, 2021, 07:54:00 am
content: 1) I would suggest to include a fuse on your AC input2) Those capacitors on the AC line has to be X1/X2 rated capacitors2) Galvanically isolate the AC side to your Logic side (MCU) as this will make things safer and easier. If you do not do that, your MCU side is considered hazardous live and attaching a debugger/ oscilloscope is a dangerous state of affairs. Isolated AC/DC supplies belowhttps://www.digikey.com/en/products/filter/power-supplies-board-mount/923?s=N4IgjCBcoCwAwFYqgMZQGYEMA2BnApgDQgD2UA2iAMwIBsATAJwDsIxNDjAHG9XU415VaYWiyEjmcekIRda8EAF1iABwAuUEAGV1AJwCWAOwDmIAL7Ew3QdBBpIWPEVIUQcZWs2Qd%2B42fNAoA3) Also, measuring the AC voltage is useful if you want to monitor the real power consumed (active power vs apparent power). The voltage measuring circuit will need to be galvanically isolated from your MCU as well, things can become complex.

author: richard.cs
author_rank: Super Contributor
timestamp: February 17, 2021, 09:57:07 am
content: The ACS758 is an isolated current sensor, why throw that away with a non-isolated power supply unless you're building some extremely cost-constrained high-volume product?

author: strawberry
author_rank: Super Contributor
timestamp: February 17, 2021, 11:05:05 am
content: you need 50A bidirectional ACS758 for 15AC measurementthen need true RMS multiplier IC to get accurate measurement result

author: jonpaul
author_rank: Super Contributor
timestamp: February 17, 2021, 11:10:05 am
content: Bravo for your efforts!But You are in mains voltage 120/240 VAC not "high voltage" usually > 1000V.You can buy plugin monitors for ! $15, watts, volts, current PF etc.Beware that pawer analysis needs to account for power factor, as V x A = VA but NOT watts unless a resistive load.Kind Regards,Jon

author: Circlotron
author_rank: Super Contributor
timestamp: February 17, 2021, 11:16:37 am
content: D3 is not strictly necessary but won't hurt.For D4 and D5 use a 1N5819 40V 1A schottky.

author: larsdenmark
author_rank: Regular Contributor
timestamp: February 17, 2021, 11:22:00 am
content: I would choose an IC with a higher sensitivity (mV/A) since your maximum current is 15 A. If the sensitivity is high enough you may be able to remove the opamp and you can then feed the output directly into the MCU. If the MCU allows you to set the reference voltage to e.g. 1.1 V you can get away with having a lower sensitivity.If you choose to use the ACS37800 you get simultaneous voltage, current and power measurements and 16-bit AD conversion - and a I2C or SPI interface.

author: fcb
author_rank: Super Contributor
timestamp: February 17, 2021, 11:38:12 am
content: Buy an IC that does it all. If you just need basic info from your device. CS5463 will do what you want, but there are easier ones to interface to.

author: ksoviero
author_rank: Contributor
timestamp: February 17, 2021, 03:30:08 pm
content: Quote from: EEauroro on February 17, 2021, 07:54:00 amOh man, I wish I knew about these before now.

author: ksoviero
author_rank: Contributor
timestamp: February 17, 2021, 04:52:58 pm
content: Quote from: richard.cs on February 17, 2021, 09:57:07 amMostly cause I didn't know that was a thing. However, I've since switched it to use one of these:https://www.digikey.com/en/products/detail/mean-well-usa-inc/IRM-02-5/7704628

author: ksoviero
author_rank: Contributor
timestamp: February 17, 2021, 04:55:30 pm
content: Quote from: EEauroro on February 17, 2021, 07:54:00 amI suppose by your phrasing that my plan of using a diode and a 1/50 voltage divider to measure the AC voltage on an ADC pin is a no-go?

author: ksoviero
author_rank: Contributor
timestamp: February 17, 2021, 05:07:44 pm
content: Quote from: jonpaul on February 17, 2021, 11:10:05 amSo, I sorta touched on the reason I can't use one of the $15 off-the-shelf plugin monitors, but basically I want to make this:https://www.digikey.com/en/articles/use-a-current-sensor-to-efficiently-acquire-dataHowever, I want to make it into a more professional, plugin form factor rather than... what they did. Thus my version ends up being a bit more complex.

author: ksoviero
author_rank: Contributor
timestamp: February 17, 2021, 05:09:47 pm
content: Quote from: Circlotron on February 17, 2021, 11:16:37 amI've since moved to an off-the-shelf PCB mounted power supply (they're amazing, I wish I'd known about them for some of my previous projects.) Having said that, the values were taken directly from the datasheet, and they explicitly recommended a "fast recovery" diode and not a schottky one. I don't know what the difference is, but I figured they knew better than me.

author: NiHaoMike
author_rank: Super Contributor
timestamp: February 18, 2021, 02:43:05 am
content: Do it the simple way by taking the circuit board out of a cheap Bluetooth headset and wiring it to transmit the signal from a shunt rather than the microphone. No isolation needed since you can just package it in a plastic case and your phone or PC safely connects wirelessly.

author: uer166
author_rank: Super Contributor
timestamp: February 18, 2021, 03:15:33 am
content: Quote from: NiHaoMike on February 18, 2021, 02:43:05 amUntil you need to debug, program, scope some signals, or otherwise do any hands-on work. Just power it from an isolated PSU, it's the persos't first mains project for christssake.

author: NiHaoMike
author_rank: Super Contributor
timestamp: February 18, 2021, 04:27:14 am
content: What is there to "debug" or "program" with a cheap off the shelf Bluetooth headset?