How do I deal with 220v switch noise?

Hi everyone!

I have a refrigerator in which the microcontroller board died (programmed obsolecence, actually)
and into which I am trying to replace with an Arduino.

The main problem is that when I open the door, there is a cheap switch that turns on a
220 volt light bulb inside the refrigerator. Same thing for the freezer compartment (but without
the light bulb).

So I have 3 wires, one common and one for the fridge door and one for the freezer door.

I thought, ok, I will deal with these guys with an optocoupler. So I did a really basic circuit with two
2 watt resistors directly into the 220 volts yielding the needed 20 ma needed to fire the optocoupler.

Of course the result is a 50 Hz square wave, but with a few reads at 13 ms intervals I can deal
with it and know when a door has been opened.

The problem is that the switches make a lot of "noise". So much as to freeze the Arduino and have the
watchdog restart the board. What is incredible is that the noise cannot cross the optocoupler and the
arduino has it's own linear power supply. So the noise generated at the door must be going through
the tranny and into the Arduino.

How do I deal with this? It is driving me crazy.

I was thinking about building a simple snubber with a resistor and a cap, but I do not know exactly
what freqs the switch and 15 watt lighr bulb combo is generating. I have a 100 Mhz oscilloscope but,
it is not the storage type and this event happens so fast I can't see it.

Any ideas?

sounds like you need some new switches . If they are micro switches the noise simply should not exist. If they are simply “touch-face” type contacts you may be able to clean them up using a fibreglass cleaning pencil

Noise can enter the system wirelessly by electromagnetic induction so you are best trying to eliminate it at source. Some high voltage capacitance across the switch contacts would be the first thing I would try.

Thank you for the answers. I dissassembled the switch. It was bipolar and one pole was never
used. The used pole had wear signs.

I made a simple snubber with a 10nF 630 volt cap and a 2k2 2 watt resistor.

So far it has been running fine...

The problem with EMI is that you never know... sometimes the switches would reset the fridge
twice a day, sometimes it would be stable for a week or so.

Regards

Running mains and low voltage wiring in parallel is enough to get massive interference from mains switching transients - shielded twisted pairs become essential for sensor wiring runs in that case. The shield diverts the capacitive coupling currents and the twisted pair balances out the magnetic induced voltages.

Extra decoupling can also help.

The snubber is a good idea, since all those spikes were generating RFI anyway.

MarkT:
Running mains and low voltage wiring in parallel is enough to get massive interference from mains switching transients - shielded twisted pairs become essential for sensor wiring runs in that case. The shield diverts the capacitive coupling currents and the twisted pair balances out the magnetic induced voltages.

Extra decoupling can also help.

The snubber is a good idea, since all those spikes were generating RFI anyway.

Thank you for this information. In this case I cannot replace the original wiring as the refrigerator
has panels of some epoxy compound that cannot be dissassembled without completely trashing it.

It has wiring for a really cheap microcontroller board that actually did not have a crystal but an rc
oscillator. I suspect that it was running in the 20/30 Khz... so EMI was not a big problem.

What happened to the original board was that it had a trhystor running the force air cooling fan.
It was calculated at the limit. With time the cooling fan gets heavier to start and the whole board
blows.

Is is possible that air humidity is playing a major role? I noticed that in dry days the problem was less
severe.

So far, after the snubber it has not resetted.

Placing a small capacitor between pin 1 (vcc) of the microprocessor and ground and has worked for me on breadboard projects. I think my problem was either 60hz hum or TTL chip noise, but it sure made my project roll better. I think it was only .01pf
--Jim

jimuino:
Placing a small capacitor between pin 1 (vcc) of the microprocessor and ground and has worked for me on breadboard projects. I think my problem was either 60hz hum or TTL chip noise, but it sure made my project roll better. I think it was only .01pf
--Jim

That is called a decoupling cap. Yes I have one right after my power supply (LM7805) and one on the board. they are 100nF ceramic.

On the breadboard everything works fine, but there is a huge gap to a real world app.

Thanks and regards

I think it was only .01pf

It wasn't you know. I don't think they make one that small. The smallest I have ever seen is 0.1uF and that is a stupidly silly value. It is silly because the stray capacitance between two wires is bigger than this.

See this for decoupling:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Grumpy_Mike:

I think it was only .01pf

It wasn't you know. I don't think they make one that small. The smallest I have ever seen is 0.1uF and that is a stupidly silly value. It is silly because the stray capacitance between two wires is bigger than this.

See this for decoupling:-
De-coupling

Typo's are contagious it seems! 0.1pF I presume. capacitors built-in to a silicon wafer can be much smaller in value (and much much smaller in size), measured in femto farads in fact. But something a few um long has very little stray capacitance to deal with!

In RF circuitry where a small capacitance value is needed it is often done by twisting two short pieces of insulated wire together (and easy to trim to the right value with tweezers!)