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.