UPDATE: I added a 220Ohm resistor from -cap->GND.... AND IT WORKS! no more surge problems!
You will have to use another, higher voltage power supply with your own regulation to reach the stage before the 5V. I used 9V. (this might solve the issue by itself without the giant cap)
The phenomenon we are experiencing resets the Arduino without letting it run any setup code it seems. You need to enable the WDT in hardware so that it is always on by setting the WDTON fuse setting on the ATmega328. You will need an ISP programmer like the AVR ISP mkII for this (preferred) or you can use another Arduino, but the ISP programmer is much cleaner and quicker. After you find your programmer, you can either use the Atmel Studio 6 "Device Programming" panel or just command-line avrdude (quicker but easier to brick your chip). Then the WDT will always be on for I believe 64ms, which you can change in the first line of your setup and throughout your program.
I added a 220Ohm resistor from -cap->GND… AND IT WORKS! no more surge problems!
220 between 5V and ground? Or somewhere else?
orangeLearner: 220 between 5V and ground? Or somewhere else?
Interesting..so in series with the cap. That would limit the rate of charge and discharge to about 22mA max. I wonder why that fixes the problem.
orangeLearner: Interesting..so in series with the cap. That would limit the rate of charge and discharge to about 22mA max. I wonder why that fixes the problem.
Honestly... couldn't tell you. lol.
There are several reasons an Arduino might reset, one of them is power drop-out, but its not the only one.
The reset line might pick up EMI and trigger from that - adding a 1k pull-up on the reset line can really help prevent that.
Large currents switching nearby could induce voltage spikes directly into the Arduino circuit via electro-magnetic induction - without knowing the Arduino circuit's layout and what is connected to it its hard to judge this.
Poor PSU isolation could mean the Arduino is riding at a significant fraction of mains voltage (but at high impedance), so that when you bring an earthed object (yourself) nearby there is significant capacitive coupling - if this is picked up by the reset line, could reset.
We know there are heavy currents switching and presumably some voltage spiking (from the switch arcing). I'd like to know a bit more about the layout of the actual circuitry on the Arduino.
Some large radio antenna on the nRF24
How large? That could be what's picking up voltage spikes.
MarkT: There are several reasons an Arduino might reset, one of them is power drop-out, but its not the only one.
Thank you so much for this information. This is something that never even occurred to me.
- Arduino Uno Rev 3
- Arduino Official wifi Shield
- Antenna: 2.4GHz Duck Antenna RP-SMA - Datasheet
- Enclosure: Arduino Project Enclosure
- 2200uF Capacitor - Datasheet
Here is a crappy photoshop showing how everything is laid out: (i would take a picture to show wirings but the devices are all the way downtown.