reverse polarity control system with indicator and output for ESP32 managment - Page 1
Forum section: electronics / beginners

author: pereplex
author_rank: Newbie
timestamp: October 15, 2024, 09:45:51 am
content: Hi everybody,My name is Michel (I'm French...) and it's my first post on this forum. I will take some time and read some of the topics but first, I would like to expose my problem.I've realized a reverse polarity system for 220V AC inputs on boats. we often have 2 lines, one dediacted for the normal loads, one dedicated for aircon system. each line is equiped with a reverse polarity detector. in case of reverse polarity, the relay will not engage and the boat will not be connected to the shore.the schematic is attached.The idea is to measure the voltage between Neutral and ground. the ground come from a ground plate located in the water under the boat so, it's normally a correct ground. if the voltage between the neutral and the ground doesn't exceed 36V, everything should be fine, after 36 V, the LED on the primary part of the circuit start to light up and the opto is sending a negative information to the ESP32 and the main relay will not engage.most of the time this circuit works fine but, sometimes the RCD breaker trips, mainly on the aircon line, (RCD type ABB 35A 30 mA).I'm not too bad in DC system but I'm not sure how to calculate the resistance R1 and how to choose the right value for D2 on AC, specially withD3 which remove half alternance...maybe I need to reduce the sensitivity of this circuit but I also don't want to loose too much on the luminausity of the LED.I will really appreciate your help and suggestion. It's probably possible to make a much better circuit.Thank you.

author: PGPG
author_rank: Frequent Contributor
timestamp: October 15, 2024, 11:03:11 am
content: I suppose you speak about AC220 coming from the land and not from some onboard power generator.For me surprising is D4 as after D3 the farther current rectification seems not needed at all.Any current flowing from neutral somewhere (like your Ground) adds to other such currents (may be other boats) and if their sum exceeds 30mA it should trip breaker.I would expect the reason of trips is C1 charging current that is not limited by anything.Your circuit consumes current for lighting the LED and separate current for lighting the transoptor LED. If both LEDs were in serie only one current would be enough.I would start this circuit from D4 (without D3) and moved everything after it. But to make current into LEDs being DC I would not use C+R, but R+C+R so dramatically reducing the C1 charging current.I suppose LED takes separate current to not make circuit not work when LED is disconnected by any reason (probably LED is far from this circuit). If so than it have to be separate current, but it can be also taken after D4.

author: pereplex
author_rank: Newbie
timestamp: October 16, 2024, 09:50:52 am
content: Hi PGPG, thank you for your answer.Yes, 220V is coming from land.You're completly right, how I didn't see that... Following your advises, I've made a new schematic, I've changed the classic LED by a 220V LED indicator.I didn't test it yet, please let me know if there is something wrong.Thank you again for your help.

author: PGPG
author_rank: Frequent Contributor
timestamp: October 16, 2024, 03:10:43 pm
content: Quote from: pereplex on October 16, 2024, 09:50:52 amAs usualQuote from: pereplex on October 16, 2024, 09:50:52 amYou still don't see error in your new schematic.Read once more what I have written.If you will not find it I will tell you, but try yourself.I don't know what is 220V LED indicator so don't know if it can consume less current than simple modern LED. The consumed current is our main concern.

author: pereplex
author_rank: Newbie
timestamp: October 17, 2024, 04:55:15 am
content: Hi PGPG, Thank you again for your time and your answer.The LED 220 V is a 220V panel mount red LED indicator. in 220V, when it's ON, it onsume <20mA. after a 47K and with less than 36V (which is the case if we are not in revese polarity), I believe the consuption should be negligeable.here is the link of the indicator (datasheet available) :https://th.rs-online.com/web/p/pilot-lights/9092455For the new error on my new schematic, I can't find it this time. Except if you want me to move D1 after D4 (but I don't see why it's important). or maybe balancing the value of R1 and R2... but I need a C1 to be fully charged in less than 2 seconds, else the system may engage if the optocoupler didn't send the information on time. I was thinking to adjust the value of R1/R2 during the tests.Once again, Thank you very much for your help. I wish you a beautiful day.

author: PGPG
author_rank: Frequent Contributor
timestamp: October 17, 2024, 10:54:32 am
content: Quote from: pereplex on October 17, 2024, 04:55:15 amThe question is if the light will be then visible.Just do some experiments before making final decision.In 90s I had to use 10mA to drive indicator red LEDs to be visible.Then, around 2000, changing LED, I reduced current to 5mA so as not to hit the eyes.Now I am using Wurth: 151031SS04000 red LED driving it with 1.8mA.But I use it with no direct sunlight on it.If your system is guaranteed to be powered all the time you can consider not having this LED here but drive it on the optocoupler output side from much lover voltage.Quote from: pereplex on October 17, 2024, 04:55:15 amI have a problem to believe in:Quote from: pereplex on October 15, 2024, 09:45:51 amIn this case AC can be analysed as two DC systems (with two opposite supply of the same peak value) so if what you say is true you should have no problems to understand it.When GROUND1 is positive relative to Earth you drive D4 with 36V drop on D1 and when it is negative you drive D4 with 0.7V drop on D1.To simplify let us assume for the moment R1=0 (like in your first schematic).In one sinus half (with 0.7V drop on D1) C1 is charged practically to peak AC voltage.With 20mA load during 10ms C1 voltage drop (I understand it is 10uF capacitor) is (20mA*10ms)/10uF = 200/10 = 20V.So during second sinus half with 36V drop on D1 voltage will be too small to even start to charge C1.So your circuit never uses the 36V value of D1. It works like D1 would be standard diode and not Zener diode. This also means that D4 is practically used only in one sinus half so works like two diodes in serie. So the whole input is like you charge C1 through 3 diodes in serie.With R1 not being 0 things are little more complicated but generally the problem is the same.Quote from: pereplex on October 17, 2024, 04:55:15 amIf your system could accept 100Hz pulses from optocoupler (instead of stable state) you can not use C1 at all (or have here much smaller value just to filter out disturbances) and you will get the information in less then 10ms (great progress compared to 2s). If it is too complicated to make such change in software than you can also (not using C1) make signal 'stable' on the optocoupler output side. If optocoupler could charge some capacitor 100 times faster than it than be discharged than you will also be able to get the information after one or two AC periods. It can also be done with digital gate having OC output.

author: pereplex
author_rank: Newbie
timestamp: October 18, 2024, 02:42:14 am
content: Hi PGPG,Thank you for this clear explaination. I understand now and I will move the zener after the rectifier.and yes, moving the regulation after the optocoupler is also a good idea.I will work on those improvements this weekend and I will post the result.Thank you again for your help.Have a beautiful day