SOLVED: Problem when plugging heavy load devices on the same outlet as Arduino

seanz2003:
So the Arduino + wifi are working when nothing else is plugged into the AC outlet, then something else gets plugged in and wifi stops functioning, correct?
Can you post a parts list? Which Wifi-shield? (datasheets are helpful too!) and a description of how you have connected everything (schematic).

To answer your first question, that is absolutely correct. It works completely fine until there is a change on the electrical circuit. Even if the arduino loses internet connection, it re-establishes it after a third failed attempt, and reconnects. I have the same exact device running in my office 24/7 with no problems. Sometimes, the client connection fails and it is unable to make HTTP requests, but then it successfully reconnects to the network, and re-sends the failed request and gets a 200OK. Every time a request is made or the arduino is reset, it checks into our server -- marking the device as "Alive." We have only noticed the problem on some specific outlets in the hospital where we know large monitoring equipment is plugged in. Plus, like i said, these said outlets are colored red and labeled "CRITICAL", so i assume its dedicated purpose is to run these monitoring stations. Its only those outlets that we are seeing the problem on.

As for the parts list, absolutely (schematics linked). Here you go:

seanz2003:
So you have multiple Arduinos setup with essentially the same code and the act of plugging in the monitoring equipment puts the arduino on the fritz, correct? Or multiple devices connected to the Arduino? If it's the former, we can probably rule your code out as the direct source of the problem.

Its the former. Its the exact same hardware setup on 20 different devices with exactly the same code except for minor changes with some defined constants used for device identifiers. I believe its safe to assume that the code is not the problem.

sbolel:
Whenever another electronic that puts a heavy load on the circuit is plugged into the same socket as the arduino, something happens and the arduino stalls and/or loses power. This also prevents the watchdog reset from executing somehow...
My question is: how can I prevent / safeguard against this?
...
And why is the board not resetting when it doesnt get a wd_reset() after 8 seconds?

I am having the same problem in my apartment. I have found that whenever I rapidly turn on and off the air compressor, after about 20 toggles, the Arduino Duemilanove will halt. My Arduino is plugged into the same outlet as the fridge and when I unplug and replug the fridge, the Arduino halts after about 2-6 toggles, so it is obviously a power issue.

When I say Arduino Duemilanove "halts", it resets and then does not even execute its setup function. I used some LEDs to verify this, then I eventually used another Arduino to monitor the first with the same results. This is what you are experiencing with the WDT not being turned on. The funny thing is that the second Arduino does not crash, only the first, so it has to do something with my code.

I believe the workaround is to turn on the WDTON fuse with an ISP programmer. That way you don't need to enable the WDT in software.

[/quote]

I am having the same problem in my apartment. I have found that whenever I rapidly turn on and off the air compressor, after about 20 toggles, the Arduino Duemilanove will halt. My Arduino is plugged into the same outlet as the fridge and when I unplug and replug the fridge, the Arduino halts after about 2-6 toggles, so it is obviously a power issue.

When I say Arduino Duemilanove "halts", it resets and then does not even execute its setup function. I used some LEDs to verify this, then I eventually used another Arduino to monitor the first with the same results. This is what you are experiencing with the WDT not being turned on. The funny thing is that the second Arduino does not crash, only the first, so it has to do something with my code.

I believe the workaround is to turn on the WDTON fuse with an ISP programmer. That way you don't need to enable the WDT in software.
[/quote]

we are currently using the arduino bootloader to upload code to the boards. How would you go about turning WDTON?

Also, adding a capacitor sounds like a great idea (effectively a backup power source to flatten the voltage), any way to add that to the Arduino without opening the guts of the wall wart?

I don't think just a capacitor would do anything. The Arduino Duemilanove already has plenty of capacitors to aid the regulation feedback loop and there is one in the wall wart too. I tried that and it didn't solve the problem.

You can turn on WDTON with a ISP programmer like the AVR ISP mkII. Atmel Studio makes it change the fuses. Alternatively, you can just use avrdude in a command-line. You can also use another Arduino as an ISP but I don't like connecting all the wires.

I guess my suggestion is just plain stupid, but... what about a (small) ups ?

Check this thread: http://arduino.cc/forum/index.php/topic,98494.0.html. Similar issue, solved with a capacitor.

wildbill:
Check this thread: http://arduino.cc/forum/index.php/topic,98494.0.html. Similar issue, solved with a capacitor.

Hmm. Same issue I am having with the Arduino crashing near a fridge. He solved it with a 2200uf cap? That's a nice simple solution. The cap will probably be larger than my entire circuit though.

Hey everyone. Here is a quick update...

We purchased and tested a few different surge protectors on a bunch of different devices. Among the five surge protectors we tested, this one seems to solve the problem. The USB input is nice because if someone needs to use the outlet, they dont have to unplug the arduino.

I'm going to give the capacitor a shot and see what happens. This was just a quick-fix solution. Its been a week since I started using the surge protector, and that device is still alive (where as all the other ones are dead).

I tried connecting a 2200uF capacitor 5V>GND, but this did not solve the problem.

I replicated the problem by plugging in a fridge, a microwave, and a water cooler into a power strip and then connecting the arduino usb to the other plug in the same outlet. When I flip the power strip on/off, the arduino eventually hangs and loses connection.

This is a really annoying problem. :confused:

sbolel:
I tried connecting a 2200uF capacitor 5V>GND, but this did not solve the problem.

I replicated the problem by plugging in a fridge, a microwave, and a water cooler into a power strip and then connecting the arduino usb to the other plug in the same outlet. When I flip the power strip on/off, the arduino eventually hangs and loses connection.

This is a really annoying problem. :confused:

I think that is going a little far. You only need to simulate with the appliances that will be used there. (and the microwave does not use any energy when plugged in)

I put my cap across the power supply output, not the 5V. Energy stored in a capacitor varies quadratically with voltage. My circuit ran for three days and never reset. Even if it does, I turned on the WDT for two seconds as a redundant safety measure.

orangeLearner:
I think that is going a little far. You only need to simulate with the appliances that will be used there. (and the microwave does not use any energy when plugged in)

I put my cap across the power supply output, not the 5V. Energy stored in a capacitor varies quadratically with voltage. My circuit ran for three days and never reset. Even if it does, I turned on the WDT for two seconds as a redundant safety measure.

How do you do it across the power supply output? I am using a USB adapter (5V, 1A).
Also, I have the WDT set for 8 seconds, but even with the WDT the arduino doesnt fix itself once it goes down (which is something I cant understand)

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.

sbolel:
UPDATE:
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.

You mentioned:

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.

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.