Safe, and hopefully simple, AC detection - Page 1
Forum section: electronics / projects

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 04:06:56 am
content: Greetings all,Apologies if the post is long winded, but too often than not I see topics change direction because the OP did not provide all the relevant information up front. I know I find that frustrating when I'm reading through it, and would like to avoid that scenario.TL;DR - I need aSAFEcircuit to detect the presence of 24VAC from a mains connected appliance and feed into an MCU.I'm in the beginning stages of project with my son, and am looking for some sound advice. I've built numerous LV DC projects, but openly admit that my AC skills are limited to killing a breaker to replace a receptacle.The problem:Our washer & dryer are located 2 floors below our bedrooms, which leads to my son taking all day to complete 4 loads of laundry due to getting side tracked, not hearing the buzzer, throwing the dryer back on a wrinkle release cycle, not hearing the buzzer, throwing the dryer back on a wrinkle release cycle, ad infinitum...The idea:As we have yet to escape California, chaining him to the washer & dryer until his chores are finished is out of the question.With this in mind, I was leaning towards some sort of wireless notification to alert him when certain events occur: 1 - the washer has completed its cycle (the washer always finishes first, so this will serve as an early warning), 2 - the dryer has signaled the end of its cycle (the dryer sounds off 1 minute prior to actually stopping the heat and tumble), and 3 - the 1 minute since the dryer signaled the end of its cycle has passed (you should have been headed down there already).The solution (or part of it) to date:I'm planning to use a couple of ESP8266s in direct communication for the project. I believe they can handle the comms and the little bit of processing required for the required results. I have the receiving end figured out: 1 - upon receiving signalX, light a green LED, 2 - upon receiving signalY, light a red LED, 3 - 45 seconds after receiving signalY, produce a 50% duty cycle 2.5V PWM to sound a 2kHz buzzer. Throw in a button to stop the buzzer, reset the LEDs, and start monitoring again and we're good. For the sending side, I was thinking a simple voltage follower tapped off the washer's LED (or so I assumed...), and a trigger from the dryer's buzzer, could be used to signal the local ESP to send a message to the remote unit in his room. After hunting down service manuals for the washer and dryer, I was surprised to find that the LED is not an LED, but a 24VAC neon lamp. The dryer's manual does not list voltages, and I have yet to get into it with my meter, but I'm expecting it will be AC as well.The roadblock:I've searched here, as well as Google, for "AC detection circuit" with little success. Most of the threads I've found seem to devolve into forum combat between the "this can be done with $2 worth of passives and a diode" crowd, and the "you really need an opto, MOV, and X/Y caps" crowd. I am inclined to go with the latter, purely for the safety factor. We live within a National Forrest, in a stud frame home, with wood panel siding, in a state in perpetual drought, and fire is always a major concern. I have no issue with the project cost increasing by $20 to prevent the risk of fire, electrocution, etc. However, I do not have the knowledge or experience to determine what qualifies as safe in regards to 24VAC from a mains connected appliance.The research:I've taken a look at the datasheets for the H11AA1, and the HCPL-3700, as they were the most often referenced. I believe the H11AA1 to be adequate for the task, and much easier to implement than the HCPL-3700, but again, am not comfortable making that decision with my limited AC knowledge.I welcome any input, suggestions, alternative solutions, orconstructivecriticism you wish to share. I ask that you share the theory behind your input, and link to any relevant reading that will improve my understanding of the circuit, theory, etc. My son is currently undecided between mechanical or electrical engineering (he's got another year of math to finish before he needs to make up his mind), and I'm excited that he is interested in this project. Although I did see him start to nod off and drool a little while trying to make it through the 15 page app notes for the HCPL-3700...thx,BFJ

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 02, 2018, 04:46:10 am
content: Keep it simple with phototransistors or LDRs over the indicators.

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 04:56:53 am
content: Thank you NiHaoMike for your input.Figures I'd leave something out even after going to lengths not to.I had given this a brief thought. However, while the washer has an indicator light that is on while it is going through a cycle, the dryer does not. Additionally, with the exception of small DC power/signal cable between the 2 units and an antenna, I'd like to keep a clean installation with everything tucked within the washer or dryer control panel.thx,BFJ

author: Phoenix
author_rank: Frequent Contributor
timestamp: March 02, 2018, 05:58:34 am
content: Do you want the 24VAC to power your circuit, or is power independent?What about an ac optocoupler? Full isolation.e.g.https://www.mouser.com/ds/2/427/tclt1600-6534.pdf

author: jbb
author_rank: Super Contributor
timestamp: March 02, 2018, 06:18:43 am
content: Thank you for taking the time to present the background. And caring about electrical safety. Electrical fires are not fun.So, I have two questions:Where are you getting the 24V? Tapping it off something inside the dryer? Do you want the alarm when it turns off?Are you open to a little experimentation and cunning thought?I'm wondering if an accelerometer (as vibration sensor) to detect the vibration of the dryer is reasonable. Might need too much fiddling around to get reliable results...Edit: ... and wouldn't involve messing around inside the dryer of AC cabinets.

author: capt bullshot
author_rank: Super Contributor
timestamp: March 02, 2018, 06:30:27 am
content: Just another suggestion for your growing list of ways how to resolve your problemI've done such stuff before (just an indicator LED in the kitchen that shows when the washer / dryer in the basement has finished). I really didn't like opening up these machines at all and finding the right place to tap the indicators there - so I just left them as they were and put a current transformer on their power outlets. Pretty simple on the "dangerous" AC side (just run the live wire through the CT), fully isolated and safe. The harder part is the low voltage side: you terminate the CT with an appropriate resistor and feed that signal into an uC ADC input. Some data acquisition and calculation ahead gives you the RMS current drawn by the applicance. But observing a typical operation cycles of the particular appliance, you can determine the "finished" state just by monitoring this current.

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 06:56:34 am
content: Thanks Phoenix, an opto is an option I'm looking at. The TCLT1600 you reference looks similar in function to the H11AA1, but we'll be sticking to through hole as this is my son's first project and I don't want him getting discouraged by trying to solder SMD/SOP/etc. out the gate. However, this does bring up an interesting point. The TCLT1600, H11AA1, and the HCPL-3700 all source power for the PD from the AC side, and this leads to one of the issues I ran into looking for answers prior to posting here - safely and properly supplying the PD side of an opto connected to AC. I've seen examples with MOVs, fuses, everything from 1/8W to 2W resistors, and X/Y class caps, with the occasional diode tossed in for good measure. Again, my experience with AC is very limited, and I am unable to separate the wheat from the chaff when it comes to which of these examples are worth pursuing. I honestly wouldn't mind blowing up a few H11AA1s with trial and error at a buck a piece, but I do not want to blow up $5 HCPL-3700s or damage my washer and dryer. Perhaps I'll review datasheets again after some sleep, maybe something will click and I'll have a better grasp.thx,BFJ

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 07:08:36 am
content: Thanks jbb, I figured I'd get as much info as possible out there to start.The 24VAC is coming from a neon "ON" indicator lamp, activated while the washer is running.I did not consider using an accelerometer, but that's a great idea. I used an accelerometer in my telemetry system, so there's no learning curve there, and it keeps me out of the AC! I think I have a few down in the lab and will see about giving them a test run. Thanks for the idea!thx,BFJ

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 07:18:37 am
content: Thank you capt bullshot, another great idea. I have some of those measuring power in server closets at a few of my clients, but they plug into what are probably over-priced data loggers (never cracked one open). I can't get them to spend a $1000 on a decent firewall, but some sales drone will get them to spend $2500 to see how much the local utility is getting from the rack...I'm not sure if the ESP has an ADC or 2, but will review the datasheet tomorrow. All of my other projects have started life on Arduino or R-Pi, and I was looking forward to playing around with a new platform.thx,BFJ

author: Bratster
author_rank: Frequent Contributor
timestamp: March 02, 2018, 08:15:42 am
content: Quote from: BigfootJim on March 02, 2018, 07:08:36 amAre you sure it is a neon indicator lamp?As far as I know the minimum voltage for them is 50 to 70 volts ac.If it is truly a neon lamp then it is probably sitting at line voltage 120/ 240 depending on where you are.Sent from my Nexus 6 using Tapatalk

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: March 02, 2018, 10:16:00 am
content: Use one slave for the washer, another one for the dryer, plus the master. Power the slaves from those 24v, if the master can't find a slave's beacon then it's off.

author: ElectronicCat
author_rank: Regular Contributor
timestamp: March 02, 2018, 12:53:09 pm
content: Quote from: BigfootJim on March 02, 2018, 07:18:37 am+1 for the current sense transformer idea, you can even getclip around typesso it's entirely non-invasive and doesn't involve touching AC. Looks like the ESP is supposed to have one 10-bit ADC which may or may not be exposed depending on the module you are using. This is almost a perfect application for a current sense transformer as it should be very easy to tell when the drums have stopped spinning.

author: Maxlor
author_rank: Frequent Contributor
timestamp: March 02, 2018, 01:19:56 pm
content: If the machines beep when they're done, why don't you just connect to the piezo control lines? You'll have low voltage DC there. You'll see a 3kHz or so signal when the beeper is beeping, not sure what the voltage will be, but probably 3.3V or 5V. It will be no trouble at all for an ESP8266 to detect that. Just be aware that the voltage the appliance's control panel uses might be low, it might be mains referenced. Maybe measure it first to see whether it is, and if it is, don't poke anything while the machine's plugged in!

author: Ian.M
author_rank: Super Contributor
timestamp: March 02, 2018, 01:31:23 pm
content: I really wouldn't want to encourage the O.P. to hack into the machines controller boards. He has no idea whether the controller boards have isolated PSUs, and IMHO its quite likely that they don't. Also his confusion with the voltage for a 'neon indicator' is worrying. Also, good luck getting any sort of warranty support or even paid service on a hacked appliance. IMHO the sensors need to be non-invasive. e.g. photosensors stuck over the appliance panel LEDs or powe3rline current monitoring as already discussedAnother idea would be vibration sensors stuck on the back or side panels of the appliances in question. Seehttps://learn.sparkfun.com/tutorials/piezo-vibration-sensor-hookup-guideIncidentally, if you need more sensitivity for a Pizeo vibration sensor feeding a MCU or similar, I favour a JFET source follower to reduce the loading on the sensor. You still need a load resistor to provide a DC path for gate bias, but 10Meg or even higher is practical. Seehttp://www.microchip.com/forums/m480518.aspx

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 06:09:05 pm
content: Thanks for the input Bratster. I took another look at the service manual, and it does show 24VAC to the neon indicator lamp on the wiring diagram. However, a chart of test points and voltages further down the manual show it as 24VDC. Obviously a typo for one of them, and it will take a screwdriver and meter to determine which.thx,BFJ

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 06:10:26 pm
content: Thank you GeorgeOfTheJungle, that's another interesting approach.thx,BFJ

author: rstofer
author_rank: Super Contributor
timestamp: March 02, 2018, 06:19:07 pm
content: If the indicator is 24VAC, it is not neon.https://hypertextbook.com/facts/2004/PhilipYeung.shtmlYou can get pretty good isolation with a relay with an appropriate coil voltage. Then you are dealing with contact closures on the low voltage side.I would tell him to use the timer app on his cell phone.If I were to build a project like this, I would have it send text messages. Kids will always respond to text messages.

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 06:21:16 pm
content: Thanks ElectronicCat, I was looking at those last night after it was suggested. I did confirm that the ESP we're looking at does have the ADC exposed. Now I'm considering if we should MUX 2 sensors into the 1 ADC, or use 1 CT for the dryer, and an accelerometer on the washer. A big part of this for me is getting my son involved and exposed to different concepts, theory, and approaches. I'll be sitting him down to read the thread to see how others approach the issue as well.thx,BFJ

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 06:28:38 pm
content: Thank you Maxlor. One has a chime, the other doesn't. While it looks like we've got a couple of non-invasive solutions to kick around, I'm going to get into the machines over the weekend with my meter and take a look around.thx,BFJ

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 06:42:06 pm
content: Thanks Ian.M, but I don't need any encouragement to crack open the machines and poke around. Maybe some sound guidance, but not encouragement. The lamp certainly is confusing, given the fact that the SM Parts List identifies it as a "neon indicator lamp", the diagram shows it as 24VAC, and the diagnostic chart says 24VDC. The machines are both well outside of warranty, but I believe we've got a couple of options now that we can look at that won't require interfacing with anything inside the machines.thx,BFJ

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 06:57:45 pm
content: Quote from: rstofer on March 02, 2018, 06:19:07 pmThank you rstofer, for the ideas and the relevant link. I don't think we'll have a definitive answer on the lamp until I get into the machine this weekend. While I don't believe it will be necessary to tap off of it at this time, the confusion from the SM has me irritated and an answer must be found. We've tried timers, but he gets his headphones on, hits the head, or runs downstairs for a minute and misses the timer going off. Not all the time, but often enough. As for text messages, I don't need another host on my network, and he certainly doesn't need another reason to be staring at the small screen anymore than he already does. I've seriously been considering breaking out his old flip phone to kill his obsession with the social media crap. More importantly though, is that it's a nice little project that will serve a practical purpose, and has him interested in spending some time in the lab experimenting.thx,BFJ

author: Ian.M
author_rank: Super Contributor
timestamp: March 02, 2018, 07:03:04 pm
content: Ok. Be safe.The commonly accepted solution for detecting the presence of an arbitrary voltage in some random bit of kit is to use an optocoupler with an appropriate resistor to limit its input side LED current. For AC you either need an anti-parallel diode across the LED, to protect it against reverse voltage, or you need an AC optocoupler that has two LEDs, antiparallel, already inside it, or you need to use a bridge rectifier so the oprocoupler LED only 'sees' DC. It gets more complex if you need to handle a wide input voltage range or need a well-defined threshold voltage between 'On' and 'Off'.On the logic side, the optocoupler's phototransistor output can be treated like a switch, but polarity usually matters. Connect it to pull the input up, or down to a supply rail or ground, and connect a pulldown or pullup resistor to the opposite rail to hold the required input state when the optocoupler isn't active.Safety depends on using an optocoupler with an appropriate isolation rating, maintaining sufficient physical clearance between its input and output sides (don't use Veroboard or matrix board unless you are prepared to peel off all copper under the optocoupler), and preventing any mains (or non-isolated) wiring contacting any part of your added circuit if anything breaks or comes loose.

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 08:39:14 pm
content: Thanks Ian.M, will do. I have a healthy respect for AC, and mains in particular. Having only a semester covering AC, I don't like to mess with it. I have a few memories of getting zapped when I was young and invincible, but with age and a son, mortality becomes a bit more apparent.I agree that an opto would be the way to go if we were to still pursue that route, and was looking at a few options, including the AC capable H11AA1 and HCPL-3700. I believe that some of my uncertainty comes from looking through 30 some odd circuits, none of which were the same. Normally you can look through some circuits and start to see a pattern or standard emerge - sure there are X ways of doing something, but usually there is one design that becomes the "commonly accepted solution" for most cases. The app notes for the HCPL-3700 didn't help, most likely due to my knowledge level and the length and detail they go into regarding filtering input/output.For my understanding, if you don't mind, a couple of current limiting resistors into an AC capable, dual anti-parallel LED opto, is sufficient? This makes sense, and goes with the information from the H11AA1 datasheet, but I was seeing lengthy debate regarding the need for fuses, MOVs, and/or X/Y caps between the AC source and the resistors. Is that all overkill? Or maybe just overkill for 24VAC and good practice for >110VAC?I'm good on the logic side, I've used optos to interface with automotive systems and some industrial controls in the past, but they were all 12-50VDC and relatively straight forward.I doubt we'll pursue this method further for this project, but had planned to install it in an enclosed box inside the machines to keep it safe. That said, I appreciate the warning regarding clearing the copper from beneath the opto, for myself and future readers.thx,BFJ

author: TJ232
author_rank: Frequent Contributor
timestamp: March 02, 2018, 09:18:12 pm
content: Don't over complicate your life: use a AC optocoupler, add the needed resistor in series with the internal LED's to limit the current and that's it. Simple like that. I have used many times, MAINS Line status/ZCD/etc included and never failed.

author: Ian.M
author_rank: Super Contributor
timestamp: March 02, 2018, 09:33:38 pm
content: Extra fusing on the input side of a mains optocoupler circuit is pointless unless you either have a MOV across the input side to clamp mains transient spikes, as the varistor could fail shorted, or if you want to use a smaller wire gauge that wouldn't be adequately protected by upstream over-current protection. Using fusible resistors with an adequate voltage rating, possibly two in series, as the current limiter is sufficient. If you need extra protection against transients, an extra resistor of about 10% of the dropper resistor value directly in series with the opto LED, and either a small capacitor or a TVS diode (or both) shunting it + the LED will do nicely, without the risk of cumulative MOV degradation due to transients, leading to failing short-circuit.X and Y caps and MOVs generally are present for transient suppression though a series class X cap may be used in capacitive dropper circuits when a lot of drive current is required for the opto's LED. e.g. if you need an average If of 30mA, from a 220VAC supply, a resistive dropper would have to dissipate approximately 10W so would usually be impractical. An appropriately designed capacitive dropper could reduce the dissipation by more than an order of magnitude.With a 24V AC supply, the voltage is unlikely to ever rise above double that even under worst case fault conditions (e.g. in USA loss of Neutral putting 220V on a 110V circuit). Its almost certain to be limited by the low voltage supply transformer heavily saturating and blowing a primary side fuse at a lower over-voltage. Its also fairly easy to design a low voltage optocoupler drive circuit to withstand double its normal input voltage for a considerable time without damage.

author: Gregg
author_rank: Super Contributor
timestamp: March 02, 2018, 10:02:48 pm
content: Quote from: BigfootJim on March 02, 2018, 08:39:14 pmLet me guess; another victim of the dreaded spousal veto, the end of many household projects.

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 10:59:22 pm
content: Thanks for the info TJ232.thx,BFJ

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 11:02:29 pm
content: Ian.M, thank you for the in-depth explanation. I appreciate the time and that makes a bit more sense now.thx,BFJ

author: BigfootJim
author_rank: Contributor
timestamp: March 02, 2018, 11:14:59 pm
content: Quote from: Gregg on March 02, 2018, 10:02:48 pmNot at all, it's just my son and I. Our home is like one big man cave - TVs, game consoles, Kodi boxes, server racks, lab, other American pastimes/hobbies, etc. I haven't had to worry about that for 15+ years, and don't plan to encumber myself again. I love my ex-wife to death, she's one of my closest friends and I trust her explicitly; but I like having my freedom, my Jeep, my motorcycle, and all my other toys too much to let someone come in and try to change or veto things.thx,BFJ