Arduino Forum

Using Arduino => General Electronics => Topic started by: MrGarak on Mar 01, 2013, 05:32 am

Title: Serial communication failure when using power supply
Post by: MrGarak on Mar 01, 2013, 05:32 am
I'm working on a project that requires the arduino uno r3 to be powered by a separate power supply AND have the usb cable connected to a PC for serial communication. When using a separate power supply, the board will reset sporadically and serial communication will fail after a few minutes. To isolate any cause I have disconnected all wiring from the arduino pins, and am just running a bare board. It still resets randomly and has serial communication failure when using the separate power supply. Any ideas where I can start troubleshooting this? The tx/rx lights still activate when it has failed, but my terminal receives nothing. Thought it might be a grounding issue but I measure 0V from USB ground to the barrel -.

My search terms for this problem brought up nothing, but I think I remember reading something about people frying their uno r3 serial chips by using a separate power supply while having it plugged into USB.

EDIT: Power supply is 12V 1.5A regulated. Reads 12.3V on a dmm. under arduino load, 12.27v. I will attempt using a different supply but suspect the problem will remain.
Title: Re: Serial communication failure when using power supply
Post by: spatula on Mar 01, 2013, 05:43 am

I think I remember reading something about people frying their uno r3 serial chips by using a separate power supply while having it plugged into USB.


I read them as well, but if your board works as expected when powered by USB only this shouldn't be the issue. Actually the reset may be caused by the failure on serial communication, i.e. whenever you open a serial communication (e.g., the serial monitor) the Uno resets (this is normal). So it may be an issue related to your PC - maybe you are using a baud rate that causes some instability, the PC resets the COM port and this in turn resets the Arduino. I don't know however how to investigate this. Maybe some message in the system logs?
Title: Re: Serial communication failure when using power supply
Post by: retrolefty on Mar 01, 2013, 05:43 am

I'm working on a project that requires the arduino uno r3 to be powered by a separate power supply AND have the usb cable connected to a PC for serial communication. When using a separate power supply, the board will reset sporadically and serial communication will fail after a few minutes. To isolate any cause I have disconnected all wiring from the arduino pins, and am just running a bare board. It still resets randomly and has serial communication failure when using the separate power supply. Any ideas where I can start troubleshooting this? The tx/rx lights still activate when it has failed, but my terminal receives nothing. Thought it might be a grounding issue but I measure 0V from USB ground to the barrel -.

My search terms for this problem brought up nothing, but I think I remember reading something about people frying their uno r3 serial chips by using a separate power supply while having it plugged into USB.

EDIT: Power supply is 12V 1.5A regulated. Reads 12.3V on a dmm. under arduino load, 12.27v. I will attempt using a different supply but suspect the problem will remain.


Might look into seeing if any application running on the PC might be scanning (blue-tooth driver?) for active/inactive serial comm ports as this can sometime cause a closing/opening of the serial port and cause a DTR initiated auto reset condition being sent to the attached arduino board.

I can't do a good job of explaining the specific cause or the cure, but the symptom sure sounds like a auto-reset problem. One way to test for this is to defeat auto reset by temporarily installing a 150 ohm resistor between the reset pin and the 5V pin. If the symptoms disappear you will know it's a PC caused thing.

Lefty
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 01, 2013, 05:49 am
Will try the capacitor trick for the reset, i heard the resister doesn't work on uno r3. Could very well be a reset problem. I am now testing an unregulated 7.4v supply (puts out 10.3v under arduino load), and so far no resets, but it hasn't been a long time yet. I don't think it's my machine since I've had the terminal open for hours normally without any issues.
Title: Re: Serial communication failure when using power supply
Post by: faurek on Mar 01, 2013, 12:59 pm
That´s strange, check current values out of power source.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 01, 2013, 06:20 pm
Looks like it was the power supply. I've tried using two others, and no reset or serial failures now. Really odd.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 11, 2013, 05:07 am
Unfortunately, I seem to have spoken too soon. The problem is back, and it doesn't matter what power supply I use. As long as I use any power supply, be it switching or unregulated, serial communication fails after a period of between 20 minutes and 4 hours.

The failure happens either with the arduino's response not being received and its tx/rx lights staying solid for that duration, or, the com port in windows simply refuses to work anymore "A device attached to the system is not functioning." The only fix is unplugging and replugging the USB cable, and all is well again. Note, the uno does not need to be power cycled. I even put in an uptime seconds counter in my code to verify it wasn't being reset, and it isn't. So, it's a really strange problem. It only happens when using any power supply in the barrel jack. If I leave it on the usb connection for hours, there's no serial communication failure. I verified my circuit isn't causing the problem by running the trials without any connection to pins and a power supply directly into the barrel jack. At this point I am wondering if my board is somehow damaged. The 16u2 chip has rev 0001 on it, is that rev known for failures like this in windows?

It really seems like a waste to have to get an ethernet shield or some other way to communicate with the uno when there's an existing way already built in. It should work without failing like this, and requiring physical disconnection and reconnection of the USB cable to (only temporarily until it happens again) resolve.

Addendum: My code is flashed onto the 328p through the ICSP so there shouldn't be any reset problem being caused by DTR. As mentioned, I've verified via an uptime counter that the board is not being reset.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 11, 2013, 07:25 pm
Ok, I wasn't sure if it was the board that was bad so I just tried swapping it with a mega 2560, and the same exact problem occurs. This is really weird. I would say "it's my computer" but for the fact that the problem never happens when the arduino is being powered solely from the usb connection.

I guess my next step is seeing if the problem occurs on a different machine. I have a vista and a linux machine to test. Should be informative at least.
Title: Re: Serial communication failure when using power supply
Post by: spatula on Mar 12, 2013, 03:24 am
Just thinking out loud... are you using interrupts in your sketch? Apparently (not sure whether this info is still current) there is a BADISR routine that handles interrupts having no handlers of their own. When this routine is invoked it resets the Arduino. If you wish to check whether this is your case you can define an ISR(BADISR_vect) routine and make it do some logging.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 12, 2013, 06:44 am
Nope, no interrupts, the sketch is pretty straightforward and simple. And I've verified it's not being reset through use of an uptime counter. I still have to test the other machines though, but the weird thing is, it's very much power supply related, since I've ran it for over 12 hours without it crashing the serial port when there's no external power supply being used. Also verified on a separate mega r3 that the problem doesn't happen. Makes me want to try the older arduinos with FTDI based serial chips, but I don't have any of those unfortunately. When I'm able to test the other machines that should be insightful.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 13, 2013, 12:14 am
I'm currently testing on a linux machine. Uptime is about 30 minutes so far, no serial port crash yet. I tested earlier with a 12V SLA battery in place of the power supply. This also crashed the serial port after about 3 hours on the win7 machine. Hopefully the linux test is informative.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 13, 2013, 10:07 pm
Progress. The linux test had no problems with the serial port not working, it ran for about 24 hours and was just fine with the 12v DC power supply. I am now suspecting EMI issues, so I will be making changes to cable routing, as well as putting the uno in a metal box enclosure, and retesting on the win7 machine.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 15, 2013, 02:17 am
Problem "appears" to be gone now after a change of USB cable and 24 hour run on the win7 machine. Not sure if I've run it long enough to get a conclusive result yet. The odd thing is I tried changing the USB cable before and it didn't help, so I'm not yet ready to say it's truly fixed.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 15, 2013, 06:37 pm
Ok, so it's now at 40 hours uptime, and still no serial port crashes. I think the problem is truly fixed. Still not exactly sure what the cause was, however the fix came via a combination of enclosing the uno in a metal box attached to ground (EMI suppression) and changing the USB cable. I noted the old USB cable had an issue with its ground, the resistance was unstable. It varied from ~70ohms to over 300ohms. That could definitely cause problems. Swapping with a normal USB cable (0.2 ohm resistance in ground) seems to have fixed the problem. However, one of the first steps I tried before was swapping that cable, which didn't fix the problem at the time. So, I believe there were also some EMI issues which the metal box seems to have resolved nicely now. Hopefully this information is helpful for anyone else who runs into a similar situation.
Title: Re: Serial communication failure when using power supply
Post by: mcasale on Mar 15, 2013, 09:16 pm
Hello. I am seeing a very similar problem. I'm running an Arduino Duemilanove that is talking to a "Processing" app on my Windows 7 machine. I have run the combined application for DAYS without any comm problems. However, if I STOP the Processing app, the Arduino resets itself (over and over). If I restart the Processing app, all is well again. This happens regardless of where the power comes from.

With the app running normally, if I simply disconnect the USB cable, the Arduino is happy and does not scram. This tells me the problem is coming from the PC, but I don't know how to prevent the resets on the Arduino side.

I see this as a big problem in my particular application. I hope a solution comes soon.
Title: Re: Serial communication failure when using power supply
Post by: retrolefty on Mar 15, 2013, 10:44 pm
Quote
This tells me the problem is coming from the PC, but I don't know how to prevent the resets on the Arduino side.

I see this as a big problem in my particular application. I hope a solution comes soon.


Sounds to me like your PC has something in it that is scanning for unconnected comm ports, such that as long as the comm port is opened and assigned to an application like your processing program then all is well. But when you quit the app and the comm port is released something is scanning for it by opening it and then closing it at a periodic rate. Do you have any bluetooth drivers active, or something like that, that would be searching for comm ports?

Lefty
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 24, 2013, 09:19 pm
Problem is back from the dead again  :~

Though it's not occurring nearly as frequently, it's still happening. I've noticed a lot of "serial noise" on the arduino through the fact that it executes a command occasionally. The command is executed upon receiving a "0" over the serial stream. Yes, probably not a good idea for that to execute a function, so I should change the code for that.

Some interesting things I've noticed:

- My desktop PC randomly powers itself up when shut off. I suspect this is related to the same EMI issue that is causing the arduino to get serial noise and corrupt the com port in windows. Wake on LAN is not turned on. Probably some kind of EMI causing the ATX power on signal to go high. Solution right now is turning off the switch on the ATX power supply.

- The serial noise sometimes corresponds with an inductive load (mini fridge) cycling. This fridge is on the same circuit but a different outlet in the room. Might be related perhaps.

- Sometimes the serial noise occurs when the PC has been powered off and I then switch the ATX switch to on.


Wish I could track this down. I don't have a scope, and suspect in order to really get any further I'd need one. I will try taking the mini fridge off that circuit, however, and see if that makes any difference.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Mar 29, 2013, 06:52 pm
gah. so annoying. It's still happening even when moving the mini fridge to a separate circuit and leg (it's now on an outlet which is on the other 120V AC rail). At least it doesn't happen as often.

Would be useful if there was a software way to restart the usb port in windows without physically unplugging the USB cable. Then at least I could detect the problem and solve it programmatically.
Title: Re: Serial communication failure when using power supply
Post by: MrGarak on Apr 12, 2013, 06:48 pm
I hate to seem like I keep bumping this or whatever, but I did want to share what I found out from my extensive troubleshooting on this problem, hopefully it's helpful information to anyone with a similar issue.

I've now had things running without any serial port crashes for over a week. I cannot say for certain what exactly "fixed" the problem, but it was one of two things:

1) I added a MOV in parallel with the mini fridge to get rid of the inductive kick when it switches off. Even though I moved the fridge to a different circuit and the other 120V leg, I still noticed a clear correlation between when it shut off and noise on the serial port.

2) I needed to get a new case for my desktop system since a video card I was upgrading did not fit in the old one. Obviously this changes the grounding characteristics and etc of the system. It's possible the old case had a fault that caused random noise on the USB ports.

I strongly suspect the MOV is what solved the problem, but I have no way of knowing since I don't have a scope. I'm sure this would have been a lot easier to track down if I did have one. Of course I'm still not 100% certain it's truly fixed either.