Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

AC relay interference with processor

Status
Not open for further replies.

edrean

New Member
Hi guys and girls!

I found a thread on this topic on the forum, but it does not answer a couple of questions I have. I am quite a newbie in the world of electronics and that will probably be evident from what I did. So here goes :

The project is a pump controller. It uses a processor with built-in HTTP to control pumps via web interface. The project also has a 433 MHz receiver that can receive a dam's water level information, which is then interpreted by the processor. The processor can then decide to start certain pumps based on whatever criteria is provided. The processor activates AC relays through 2N2222A transistors.

Everything works great until I actually connect a load to the relays and try to switch them on. Sometimes it works, but a lot of the time it restarts the processor. I assume it is because of the noise generated by the AC being switched that somehow travels all the way back to my processor. It doesn't matter if the load is resistive (incandescent light bulb) or inductive (another relay).

Now, I think my biggest problem comes from the fact that I have a ground plane covering all of my unused board real-estate (even under the relays). Could this be the biggest problem here? :confused:

Then, the biggest question. Can I fix this without changing the board (eg. soldering caps onto certain pins on the underside of the board)?

This is a prototype board for the project, but I would like to make certain that everything is perfect before submitting the final board layout to the manufacturers.

I have included excerpts from my board layout and schematic. All the spaces between tracks is ground plane (on both sides). K1 - K4 are the relays.
 

Attachments

  • layout.JPG
    layout.JPG
    71.8 KB · Views: 677
  • schematic.JPG
    schematic.JPG
    50.2 KB · Views: 1,191
Last edited:
Some suggestions:
(1) power your relays before the 7805 of your controller or from a different 7805
(2) use a varistor with correct voltage (130Vac or 250Vac) in parallel with the NO contact of each relay
 
You didn't show the part of the schematic/layout which might shed some light on your problem. Where is the processor chip ground connected?

Is the power for the processor derived from the same supply as powers the relay coils?

What base resistors are you using between the processor and the transistor bases?
 
OK, I can see that I should have included more of the schematic. I tried to prevent an overload of information. I'll post the complete layout and schematic.

(1) power your relays before the 7805 of your controller or from a different 7805

Is the power for the processor derived from the same supply as powers the relay coils?
As you can see now (with the full schematic), the processor runs off 3.3v which it gets from a LM2576-3.3 switching power supply. The 7805 exclusively supplies the relays at this stage.

(2) use a varistor with correct voltage (130Vac or 250Vac) in parallel with the NO contact of each relay
I don't know anything about varistors, so I will investigate this option. Thank you!

Where is the processor chip ground connected?
To the same ground plane that runs under the relays and where everything else is also grounded.... :eek:

What base resistors are you using between the processor and the transistor bases?
1K 1/4W

Some more info :
The relays are Rayex LT-5GS. Their info can be found at **broken link removed**
I have also included the component and solder sides Gerber view so you can see the ground planes on both sides of the PCB. Red is component side (top) and Blue is solder side (bottom).

Thanks very much for your kind help so far!
 

Attachments

  • layout1.JPG
    layout1.JPG
    207.5 KB · Views: 554
  • schematic1.png
    schematic1.png
    57.8 KB · Views: 662
  • component.JPG
    component.JPG
    242.8 KB · Views: 371
  • solder.JPG
    solder.JPG
    248.2 KB · Views: 320
...
To the same ground plane that runs under the relays and where everything else is also grounded.... :eek:

You ain't gonna like this; but that is likely the problem. The relay power circuit, including its 7805 and the 2222s, should have its own ground, completely separate from the ground for the processor and any analog circuits. These two grounds (call them RGND and AGND) should have their own respective ground traces on the PC board, never touching each other. At the power supply connector that connects the PC board to the main power supply, there should be two ground pins: RGND and AGND. There should be two wires running to the negative pin on the main power supply. THAT is the only place the two grounds should be CONNECTED TOGETHER!

Most likely, the problem stems from the fact that when the relays are switched on/off, the common-mode voltage developed across the common-ground impedance (because the relay current flows under the processor) bounces the ground pin on the processor, causing the reset. Separating the grounds as described above eliminates the common-mode coupling.

Since in your application, the problem gets worse when you connect the AC loads, is the ground on the board connected back to earth ground? I am not familiar with how they do AC power distribution in your country, but it is possible that the pumps are inducing a ground current some of which flows through your pc board. That would require a thorough analysis of where every wire that touches your PC board ground goes...
 
Last edited:
Just as an update, I tried what a previous thread suggested. I mounted the same relay setup as I have on the PC board (relay, LED, 2N2222A, diode), on a piece of stripboard. From the stripboard I then pulled the needed 5V, the signal as well as ground from the RELAUX box header on the PCB (that's what it's there for :D). I then wired a 240V 60W incandescent lamp through the relay. This seemed to work fine. I couldn't get the processor to act up again. If this works for a resistive load, I am hoping it will work for something inductive. I will go to the pumps in about 12 hours (tomorrow morning for me) and see what happens when I try to switch the relays that switch the pumps. Will post back then.

You ain't gonna like this; but that is likely the problem.
I expected it, so the news isn't that bad. In hindsight I wonder how I didn't see this coming. Lack of experience, I reckon. Your advice regarding separate grounds makes a lot of sense and I will definitely be doing that with the next version of the PCB.

In the meantime, is there something I can hack up to deal with this on the PCB as it is at the moment?

Since in your application, the problem gets worse when you connect the AC loads, is the ground on the board connected back to earth ground? I am not familiar with how they do AC power distribution in your country, but it is possible that the pumps are inducing a ground current some of which flows through your pc board. That would require a thorough analysis of where every wire that touches your PC board ground goes...
I hope I understand your question here correctly. Let me first say that the pumps won't be directly switched by the relays on the PCB. Each PCB relay will switch another external relay which in turn switch 3-phase contactors which finally turns on the 3-phase pump motor. Single phase AC is 240V/50Hz in South Africa. In a distribution panel the neutral bus bar will be connected to earth, normally via a copper rod that is driven into the ground.
 
The gist of my question about the power distribution grounds is this: Does your PB circuit board connect to multiple external devices, each of which find their own respective paths to earth ground?

If so, if there is any significant voltage gradient between the disparate ground locations, then you might have current(s) flowing from one edge of your pc board to the other which are induced externally, such as the inrush during motor starting.
 
In addition to electrical noise, you have a fire and electrocution hazard. I don't know about your country. We always isolated all AC mains from any low voltage (including the ground plane) by the greatest available "creepage" distance, typically 5 mm, and in all cases never less than 3mm.

This was 20 years ago,, and it appears that standards have gotten tougher. Look up "creepage and clearance". A quick check on Google found this: PCB Printed Circuit Board Layout Design. Note item 9, requiring 6.4 mm between mains and logic! (I don't know who this guy is, and I don't have the UL/IEC 60950 document so the circumstances might be special.) But you get the idea - - no ground plane or logic under the relay.

[edit] Apparently 6.4 mm was a special case. I found a calculator at http://www.creepage.com which claims to be based on UL/IEC 60950. For your circumstance as I understand it, mains to logic is only 4.8 mm and mains to mains is 2.4 mm.

[disclaimer] Your mileage may vary, I just looked this stuff up and it could be all wrong, if you get zapped it's still your responsibility, somebody probably stole my password and wrote this while I was drunk.
 
Last edited:
Sorry for taking so long to reply, but unfortunately I had to attend to some other things first.

The gist of my question about the power distribution grounds is this: Does your PB circuit board connect to multiple external devices, each of which find their own respective paths to earth ground?

If so, if there is any significant voltage gradient between the disparate ground locations, then you might have current(s) flowing from one edge of your pc board to the other which are induced externally, such as the inrush during motor starting.

The only external devices connected to my PCB are the external AC coil relays. These are switched by the DC coil relays on my PCB. The external relays are therefor electrically isolated from my PCB. There should be no difference in ground potential across the PCB as far as my limited knowledge can determine.

I have hand-drawn a picture of the external setup for better understanding. The diagram flows from left to right, with the PCB relay depicted on the left and the external AC coil relay depicted to the right of it (in the middle of the diagram). To the far right is the 3-phase contactor that switches the pump. The diagram is drawn in the off state (processor IO pin is low).

edrean said:
I mounted the same relay setup as I have on the PC board (relay, LED, 2N2222A, diode), on a piece of stripboard. From the stripboard I then pulled the needed 5V, the signal as well as ground from the RELAUX box header on the PCB (that's what it's there for ). I then wired a 240V 60W incandescent lamp through the relay. This seemed to work fine. I couldn't get the processor to act up again.

When testing this setup with the external relays, I experienced the processor reboot again. I assumed it might be because the ground on the stripboard still returns via the ground plane on the PCB. So I opted to change the ground setup a bit. This time round the ground on the stripboard was wired directly to the 12VDC power supply socket's negative pin. At first it seemed to be better, but it didn't really solve my problem. I found that my processor reset everytime when I switched both relays off simultaneously.

This all after it worked with switching a light bulb without hassles. So it must be something particular to switching an inductive load now? Any ideas what I can try next?
 

Attachments

  • relay-diagram.jpg
    relay-diagram.jpg
    88.7 KB · Views: 2,515
Extend your simplified drawing a little. Add the power supply which runs the processor. Where is it's AC input connected? Line to Neutral or Line to Line?

Is there an Ohmic connection from the processor ground symbol to "earth" ground, either directly or indirectly?
 
Extend your simplified drawing a little. Add the power supply which runs the processor. Where is it's AC input connected? Line to Neutral or Line to Line?

Is there an Ohmic connection from the processor ground symbol to "earth" ground, either directly or indirectly?

You will see on the schematic, posted previously, that there are two voltage regulators. One is a linear 5V regulator (7805) and the other is a 3.3v switching regulator. The processor runs off 3.3V and the relays run off 5v (thus different regulators). Both regulators get their input voltage from the PWR connector (refer schematic). A regular (transformer type) 12v DC adapter is used to provide +-12v to the PWR connector and subsequently to the regulators. The processor's ground is ultimately connected to the negative of the 12V adapter. The adapter is plugged into a regular mains wall socket.

Am I answering your questions?

I don't think I am getting a spike caused by the pumps from the power input side, because nothing happens when I start the pumps manually.... :confused:

If I connect the leftmost relay's coil ground directly to the adapter's negative pin I still get reboots when switching the relay off while it's connected to the AC coiled relay.
 
You will see on the schematic, posted previously, that there are two voltage regulators. One is a linear 5V regulator (7805) and the other is a 3.3v switching regulator. The processor runs off 3.3V and the relays run off 5v (thus different regulators). Both regulators get their input voltage from the PWR connector (refer schematic). A regular (transformer type) 12v DC adapter is used to provide +-12v to the PWR connector and subsequently to the regulators. The processor's ground is ultimately connected to the negative of the 12V adapter. The adapter is plugged into a regular mains wall socket.
...

Could you temporarily supply the 12Vdc to the processor board from a small 12V SLA battery? That would eliminate the possibility that a transient is being coupled through the wall-wart's transformer (either inductively, or due to capacitance between primary and secondary windings).

I'm still trying to get you to tell me if the neg side of the 12V DC supply (when plugged into the processor board) has Ohmic continuity to the ground pin on the AC socket that the Wall-Wart is plugged into?
 
Last edited:
Could you temporarily supply the 12Vdc to the processor board from a small 12V SLA battery? That would eliminate the possibility that a transient is being coupled through the wall-wart's transformer (either inductively, or due to capacitance between primary and secondary windings).

I'm still trying to get you to tell me if the neg side of the 12V DC supply (when plugged into the processor board) has Ohmic continuity to the ground pin on the AC socket that the Wall-Wart is plugged into?

I just want to thank you again for sticking it out with me on this one!

I will try to test the whole setup ASAP by powering the PCB from a battery. Will let you know the outcome.

I cannot measure any continuity between the DC ground pin and any of the AC side prongs with my multimeter. In other words, there seem to be no continuity from the negative pin on the DC side to any prong on the AC side. My guess is that the two sides are isolated by a transformer inside the adapter ("wall-wart") housing. The adapter is also unregulated, so I assume it basically consists of a transformer and a rectifier.

For your information, we mostly use 3 prongs in South Africa. One is live (I think you call it "hot") and one is neutral. The third one we call earth, which will trip a circuit breaker if it conducts current.

[EDIT]I previously said that I would like to fix this problem on my current design. My goal with this whole exercise is to establish with much certainty what will have to be done on the next design/layout to prevent this from happening. I can't afford to submit a new layout to the PCB manufacturers which will produce the same problem in the end. So It would be great if we can solve the problem on the current design, so that I can know exactly what has to be done on the new design. I reckon the largest problem stems from the fact that I have only one large ground plane instead of separating the grounds for the processor from the relay's. But it worries me that the reboot still happens even when I use an off-board relay with it's ground returning directly to the adapter's negative pin. This just to let you know how I'm thinking about this. I'll try the battery suggestion next. Thanks again for your valuable input!
 
Last edited:
OK. It's been a year since my last post to this topic and I am pleased to announce that I seem to have solved the problem with the help of you lot.

I went back to the pumps with my PCB. I powered the PCB from a vehicle mounted inverter so as to isolate it completely from the mains on the power side. I also fitted a MOV rated for 250VAC with one leg on the common pin of the PCB relay and the other leg on the NO pin. When I fired everything up I couldn't get the processor to reboot again using this setup, so I was happy. I decided to disconnect the PCB power (wall-wart) from the inverter and plugged it into the mains power. After I did this I still couldn't get it to act up. So my conclusion is that the relay contacts must have arced on switching the relay which caused a spike on my ground plane. This was significant enough to cause the processor voltage supply to drop (by bumping up the ground potential) and probably triggered the brown-out detect and caused a reboot. So the MOV did the trick. This is how I understand it anyway....please correct me if I am wrong.

I will now redesign the layout to include MOV's at each relay and to remove the ground plane. I will also use separate ground tracks for the processor and 433MHz receiver part than for the relays and transistors part. I am thinking of incorporating a transformer and rectifier into my PCB as well so that it can be powered by mains directly (and not a wall-wart anymore). I will therefor connect the two grounds together at the negative pin of the rectifier.

I will appreciate any comments with regards to my new design.

Thanks again for helping a newbie out! I have learned a lot.
 
In the past i had a same problem... what i did was to put a MOV in my AC Power supply (not in each relay) and a ceramic capacitor neer to microprocessor supply. It solved the problem...
 
Yes. If I incorporate a tranformer into my design to power from mains it might be a good idea to also put an MOV there (maybe together with a thermal fuse?).

I'll also probably decouple the power supply at the positive pin of the rectifier. A bypass cap at the supply pin of the processor will probably also not hurt. I'll use my oscilloscope to check for and reduce noise using caps as much as possible to try and keep everything clean and solid for noisy environments.
 
Please keep posting for improvements, because this is a common problem and any approach should be taken in consideration!

By the way, which processor (microprocessor) are you using?
 
I'm using the EM1000 from Tibbo. **broken link removed**

I am beginning to wonder about the ground plane. What would be the smartest thing to do here. Should I create two separate ground planes (one for relays and one for processor)? Or should I trash the ground plane idea altogether? Basically, when is a ground plane a pro and when is it a con?
 
Hi,
When i had the problem, i was using the same ground plane (and i keep it) and with the modification it solved...
But in nowdays design i use a different ground plane when i have 2 or more relays... always keeping MOV and decoupling capacitors.
In my opinion the better approach when using inductive loads is to use different ground planes.
 
hi i had the same problem.... made me to completely isolate the circuit...(in another board)
ioopopo.png
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top