Another reboot question....

Hello all, am puzzled - have read all reboot-related questions but cannot solve mine yet.

On my mega I have a 1600 lines piece of SW running, and all is well. Added external power 12V 5A to the socket, and still all is well. Made all serial communication conditional with one global parameter debug_print "if (debug_print) then serial.print(...);" in order to be able to disable all serial comms.

I even made the serial.begin conditional if debug_print=0.

Now when the USB and external power are both plugged in, all is well. I disable all serial print, so nothing to see when I look at the serial monitor. It runs perfectly for hours and hours.

However, when I start the Mega with external power only (so USB unplugged) then after about 15 minutes of uptime it starts to reboot each 15 secs. I measure input (12V) and on board (4,8V).

While it is doing the reboots I can plug the USB in again and reboot stops immediately (even if I use no monitor on my Windows screen).

When I then unplug the USB again, reboot restarts immediately, each 15 secs.

Then I plug the USB in again: reboot stops immediately.

As you may have guessed: I will want to run the sketch in the field without a PC attached.... In the sketch I disabled all serial.print communication. What does the USB port provide to the Mega to stop the reboots?

The external power seems to be ok and stabile, because it should have priority over the USB power, and together they work nicely.

Hope you can help.

Thanks, Ton

(deleted)

(deleted)

If I knew how to upload neatly it still would not help - It's 1600 lines of code, which works day and night if the USB is plugged in.

I am searching for the logic why a USB plug in could affect the reboots if there is no serial communication at all and power is stabile at 12V.

Thanks,

ps: the debug_print example above was indeed a typo here, not in the code. :-)

TonVeenhof: I measure input (12V) and on board (4,8V).

Using?

Have you written any stuff in raw C? Or some unusual libraries? It could be a coding error with memory management or buffer overflows. Have you tried eliminating the huge code base and replacing it with something that just prints numbers to the serial monitor, using plain Arduino language? I guess I'm trying to say that it might be useful to try and decide whether it's a hardware or software issue. That would be the first step.

Could it be that the onboard regulator shuts down because it is overheating?

You could try to feed it with 7V.

Quite possibly. If you have a scope, monitor the regulatory output.

Could there be noise on your reset pin, for some reason. When the USB is connected, it is also connected to the reset pin, so maybe it suppresses the noise.

jrdoner: Could there be noise on your reset pin, for some reason. When the USB is connected, it is also connected to the reset pin, so maybe it suppresses the noise.

Possible but not likely. OP said about 15 minutes after powerup. If only OP could try and turn off the system after the resets for only a few minutes and back on to see if he still needs 15 minutes before the first symptom, we'd be able to say whether thermal shutdown may or may not be the issue.

Thanks for your questions and tips. Tried out startup with external power only, and found indeed (thanks liudr!) that the first occurence of the reboot started this morning after one hour. Then I powered off for 30 secs and restarted the lot.

Then the reboots returned after less than 15 minutes.

So temperature may be an issue. What puzzles me though is that the reboots stop as soon as I plug in the USB. Now again, after the second try in the middle of the reboots I plug in the USB and all is well again. No more reboots.

Libraries used:
<LiquidCrystal.h>
<SoftwareSerial.h>
<DCF77.h>
<Time.h>
<SD.h>

And DCF interrupt is 5 on pin 18.

So my question remains: what does the USB do to the Mega that stops the reboots?

Ton

Do you have the possibilty to measure the current which is used by your configuration? If you have not many peripherals connected which are being powered by the Arduino, your Mega should not draw that much mA, maybe less than 250mA which is fine with the specs.

But as you are using a mega, I suspect you might have quite a lot of devices connected, so current mightbe an issue. And if your Mega has to deliver, let's say, 500mA, then the voltage regulator is faced with a load of: 12V - 5V = 7V; 7V x 0,5A = 3,5W, which will drive the temperature of the regulator high until it stops delivering power to protect itself.

As said above, if my suspicion is right, consider either to go with another external power supply (7V..9Vmax) or go with a step down converter to reduce the voltage input from 12V to 7V before supplying the Mega.

This link gives you a comprehensive insight of powering Arduinos.

Following a max amps calculation based on the max watts that the regulator is able to cope: (Details in the link above)

– 12 V Power Supply: I = 2 / (12-5) = 2 / 7 = 285mA

– 9V Power Supply: I = 2 / (9-5) = 2/4 = 500mA

– 7 V Power Supply: I = 2 / (7-5) = 2/2 = 1A

Hope that helps if it is a powering issue in your project.

Thanks RPT, I will ask a friend who understands current (which means I do not) to follow your advice and measure the configuration.

Now, I have 10 LEDs and 1 LCD 16X2, 2 relais, 1 DCF77 antenna and 10 push-buttons with pull down resistors active. other peripherals as on a UNO that talks to the Mega with mySerial. No issues there.

Having said this: how could plugging in the USB cure heat?

I am now running for 2 hours again with USB + external without reboots...

Thanks again, Ton

The USB supplys power when the reguator fails, preventing resets.

Ton,

I could try to calculate the power consumption if you could give me some more details:

  1. how did you connect the LEDs to the Mega? (i.e. what is the value of the resistors in series with the LEDs ?)
  2. are the 2 relays always ON? (do you use those typical blue relays which you can buy for a few bucks each or 2..4 in a row on one pcb?)
  3. can you either post the datasheet of the DCF77 antenna or a link or a detailled product name

I am now running for 2 hours again with USB + external without reboots...

The USB supplys power when the reguator fails, preventing resets.

And yes, it goes into the direction that you have a power issue, no coding problem.

Whandall: The USB supplys power when the reguator fails, preventing resets.

Looking at the schematic, I think it supplies power if half Vin drops below 3.3V; not when the regulator fails. Might be wrong though.

Vin is either the power supplied via the barrel minus the voltage drop over the protection diode or the power supplied via the Vin pin.

Locate the regulator chip (SOT23?). put your finger on it while the reboots are occurring. If you say "Ouch!", or something similarly extolling surprise, as in IT's HOT, you have an overloaded regulator shutting down....

you could try a heatsink, but 3+W is way, way, over what the IC regulator is designed for. Follow the power reduction suggestions.

Golly! Thank you all for the questions and tips - I reduced power of the external feed to 10.5V (the supply allows for manual reduction) and all is stabile again with external feed only.

Being unexperienced in power management I am amazed! Thought that the Cotek DN-60-12 would be a great fit and 12V would be better than 5. Life is not as simple as it looks! Never took heat into consideration. Bearing in mind that this thing will run in Southern Spain I may need to plan a ventilator.

Anyways: to answer the last questions: 20 LEDs are attached to the Arduino pins with pull-down 220 ohm. 10 burning simultaneously BN641138 DCF77 receiver (3mA) 1 Arduino LCD display (supply current 3mA) - it is on (another one is connected but always off in the test) And indeed 2 relais of the 4-in-a-row-blue-box-few-bucks type.

I'm ever so glad! can now focus on the logic of the SW again.

Thanks a million, Ton

Ton,

Not so quick. You owe us one last answer. Did your Arduino come with a sticker that says "download IDE from arduino.org", note the org, not cc?

Hi, can't say any more, because I removed them and threw them away. Does your question imply there are two versions?

Am located in the Netherlands and purchased the starter kit as well as the Mega 2560 online at Conrad in April.

Hope this helps, Ton