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

Hello everyone,

I am having a problem with my Arduino device. It is plugged into a wall socket with a 1A usb phone charger using a usb AtoB cable.

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? Maybe some sort of RC circuit? or should I try a wall wart? could it be a that the usb phone charger i am using is just a crappy one?

And why is the board not resetting when it doesnt get a wd_reset() after 8 seconds? I would appreciate any help I can get. I am not sure what code would be relevant here since this happens regardless of the sketch.

Thanks.

Solved this problem by adding an RC circuit to the 5V rail as below:

Whenever another electronic that puts a heavy load

how heavy? what kind of load?

could it be a that the usb phone charger i am using is just a crappy one?

possibly...

I am not sure what code would be relevant here since this happens regardless of the sketch.

how exactly does it happen? is there a repeatable sequence of events. Details, please and please post the code anyway?

seanz2003:
Whenever another electronic that puts a heavy load

how heavy? what kind of load?
So the arduino is plugged into an outlet labeled "critical" in a hospital. this is the plug they use for their monitoring and testing stations (not too sure what they are called). Its a laptop, plus monitoring equipment. I can get an estimate for an actual measurement tomorrow since i am not too sure what exactly is plugged into it.

seanz2003:
could it be a that the usb phone charger i am using is just a crappy one?

possibly...
I ordered some usb chargers that are supposed to be of better quality, so i will test those tomorrow and see if there is any difference.

seanz2003:
I am not sure what code would be relevant here since this happens regardless of the sketch.

how exactly does it happen? is there a repeatable sequence of events. Details, please and please post the code anyway?
Alright, so I cant monitor the plug all the time. There is code on the arduino that sends a heartbeat signal via an HTTP get request to a server every 30 minutes. The server checks to see if that message has been received, and marks the device as alive. When the monitoring equipment is plugged in, it somehow causes a connection failure on the arduino wifi shield (the green light disappears and only the yellow is shown). So we unplugged and replugged in the equipment, and all the lights then turned off so i am assuming the wifi shield lost power.

Here is the code for the main sketch:

void setup() {

  /* Start WATCHDOG Timer at 8 Sec */
  setupTimer();
  wdt_enable(WDTO_8S);

  Wire.begin();
  radio.begin();

  /* Check WiFi Shield and Start */
  checkShield();

  connectToTheInternet();
  delay(1500);

  /* Delay the loop for 5 seconds to make sure
    the setup is complete  */
  delayFirstRun();

  /* Initial Check-in */
  hourlyCheck();
}


ISR(TIMER1_COMPA_vect) {
  wd_seconds++;
  if (wd_seconds >= WD_RESET_SECONDS) {
    wdt_reset();
    wd_seconds = 0;
  }
  seconds++;
  if (seconds >= TIMER_RESET_SECONDS) {
    timeToCheck = true;
    seconds = 0;
  }
}


void loop() {

  do {
    ** some radio / http request code here, unrelated to hourlyCheck() **
  } while (!timeToCheck);

  hourlyCheck();

}

Functions:

void setupTimer() {
  // initialize Timer1
  cli();          // disable global interrupts
  TCCR1A = 0;     // set entire TCCR1A register to 0
  TCCR1B = 0;     // same for TCCR1B

  // set compare match register to desired timer count:
  OCR1A = 15624;
  // turn on CTC mode:
  TCCR1B |= (1 << WGM12);
  // Set CS10 and CS12 bits for 1024 prescaler:
  TCCR1B |= (1 << CS10);
  TCCR1B |= (1 << CS12);
  // enable timer compare interrupt:
  TIMSK1 |= (1 << OCIE1A);
  sei();          // enable global interrupts
}

void hourlyCheck () {
  timeToCheck = false;

  if (clientConnect()) {
    ** GET REQUEST FOR HEARTBEAT CODE HERE **
  }
  else {
    requestRetry(); // code that retries the request three times, then resets internet connection, then retries the request
  }
}

And there are over 20 of the same devices plugged into different outlets, and i am only having the problem on the outlets with the monitoring equipment plugged in, so I know it has to be a power related problem.

When the monitoring equipment is plugged in, it somehow causes a connection failure on the Arduino wifi shield (the green light disappears and only the yellow is shown). So we unplugged and replugged in the equipment, and all the lights then turned off so i am assuming the wifi shield lost power.

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).

And there are over 20 of the same devices plugged into different outlets, and i am only having the problem on the outlets with the monitoring equipment plugged in, so I know it has to be a power related problem.

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.

Have you tried plugging the equipment into a different wall socket ? Maybe the "monitoring" power line (or that specific socket) can't handle the temporary load increase you have when plugging the equipment, so the voltage momentarily drops, making the usb charger drop the power to the arduino long enough to have it reset.

just my 2 cents.

Quick possibility is add large external capacitor on the 5V from the adapter. Say 4700uf at 10V or more...

Please advise which hospital you are plugging into - I need to stay clear !

tuxduino:
Have you tried plugging the equipment into a different wall socket ? Maybe the "monitoring" power line (or that specific socket) can't handle the temporary load increase you have when plugging the equipment, so the voltage momentarily drops, making the usb charger drop the power to the arduino long enough to have it reset.
just my 2 cents.

Hello. We have many of the same exact devices plugged into many different wall sockets. I think what you are saying is the exact problem. It makes the voltage jump down and back up, causing the arduino to go haywire. The weird thing is that it completely messes up the instruction cycle. Im guessing even the memory containing instruction location is also getting corrupted. Its weird because i would guess the watchdog timer would still work, but it does not.

terryking228:
Quick possibility is add large external capacitor on the 5V from the adapter. Say 4700uf at 10V or more...

I was thinking something along the same lines. Or a recharging internal battery with enough charge to keep it going until the electricity is stable once again, so that watchdog can reset it. Or have some sort of hardware monitoring for voltage, and have it send a reset signal to the reset pin of the arduino when the voltage stops fluctuating.

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)