Arduino Duemilanove setup with a pushbutton on digital pin 3 and a solid state relay on pin 4. When the pushbutton is pressed, Pin 3 goes high, pin 4 then also goes high and turns on a fluorescent lamp over the SSR.
Now comes the interesting part, the pushbutton is about 5 feet away, connected like in the playground example. If I use this set up with a flurescent lamp, the arduino immediately freezes or "reboots" when I push the pushbutton. When I remove the pushbutton connection on the arduino and use a short jumper wire and connect it directly to +5v for a half second or so, everything works as expected, nothing freezes.
It seems that the startup intereference of the fluorescent lamp somehow inducts in the pushbutton wire and brings the arduino to crash.
How can I decouple the pushbutton from the arduino ?
I've read something about a 100nF ceramic oder foil capacitor with a 100ohms resistor ?
How's that meant, I connect one leg of the 100nf capacitor directly to pin 3 (my pushbutton pin) and the other leg over the resistor directly to ground ?
Sadly that is not a good way to wire up push buttons. For your application I would wire the button between ground and the input. Then at the arduino end put a resistor from the input to +5. This will invert the logic. Then put a 0.1uF capacitor (ceramic not foil) between the input and ground at the arduino end.
@Senso: The Relay is a Solid State Relay, there is no or there can be no noise inducted by the relay, its not mechanical.
@Grumpy_Mike: Thanks a lot, the ceramic capacitor did the trick. I simply connected it directly to my pushbutton pin and ground.
The Arduino now works flawlessly, no more "reboots".
Just a quick question, could someone explain me why I use a ceramic capacitor and not a foil ? I always thought foil capacitors would be perfect for eliminating spikes/noises.
could someone explain me why I use a ceramic capacitor and not a foil ?
A foil capacitor is like a Swiss Roll it has lots of inductance, a ceramic capacitor is more like two plates very close together it has a very little inductance.
The more inductance you have in a capacitor the lower the frequency of signals it will squash. So to squash the highest range of frequencies you need a ceramic capacitor.
The board is worked flawless or the main board is still working flawless, but my Arduino Ethernet Shield (Wiznet) is still crashing when I switch on the lights.
Is there anything more I can denoise by adding a capacitor ? I think the ethernet shield is connected through pins 13,12,11,10, should I give it a try and add capacitors there ?
Do you mean the power supply from the arduino to the shield or from the shield to the wiznet module ? Again with ceramic capacitors ? As there are already two electrolytic and two ceramic (?) capacitors on the shield. Could swapping them against some with higher values help ?
I've added a ceramic capacitor between 5v and GND on the Shield - no change at all.
I've tied up my wiring and replaced everyhting a little so I have more distance between the SSR and the arduino - no change.
I had a big fat 470uF electrolytic capacitor lying around and thought I could give it a try, added it between +5V and GND the same way I had the ceramic capacitor before and now only every third or forth try crashed my arduino ethernet shield, so most of the time it ran fine even when turning the lights on.
As my understanding of all this decoupling and noise-things, my 470uF capacitor is too big. What would be a good value to start with ? Just plug and pray, I could vary from 1uF to 1000uF ?
And because the difference of a polarized capacitor versus a non-polarized capacitor helps me, I assume that my problem seems to be some kind of AC on the 5v DC line ?!? :-? How can that be? Or am I wrong ?
Oh and before I forget, I had a scope running on +5v and GND and saw a really big "ripple" for a very short time when the lights where turned on. Maybe it helps, I have no experience with oscilloscopes..
And because the difference of a polarized capacitor versus a non-polarized capacitor helps me,
Non-polarised capacitors are better than polarised but they don't come in big values. It is almost impossible to have a capacitor that is too big.
From your scope observations it is looking like you are getting mains born interference. You can add a mains filter to your lights and if necessary another to your power supply.