mega 2560 usb vs power socket problem

I have a large weather station receiver/uploader running on a mega 2560 which I have upscaled from a UNO system.

The mega 2560 runs an aurel receiver, ads3231 rtc, a bmp280, a ssd1306 oled and an esp8266(ESP01). the esp is run from the mega 3.3v pin with a 1k/1k voltage divider on the mega transmit pin.

The mega 2560 runs perfectly when powered from the usb connected to my pc but when powered from a 12v wallwart it runs for a number of minutes and then locks up with the oled going blank and the pin 13 led blinking about twice per second. there is no diagnostic code that blinks the led at that rate.

the ide is 1.8.11 and as far as I know the mega is genuine.

Has anybody experienced this problem running a mega from the power supply. I have scoured the web for a similar report but so far with no luck.

A few things missing from your post.

Could you take a few moments to Learn How To Use The Forum. Other general help and troubleshooting advice can be found here. It will help you get the best out of the forum in the future.


thankyou ballscrewbob.....I am familiar with the links you posted...

could you be a bit more specific about the things that are missing from my post.

Schematics and code would both be mentioned in those links.

My apologies…herewith schematic

Code runs to 800 lines and I didn’t think it was relevant considering it runs perfectly well on usb power. The wall wart is 12v at 1 amp which I thought would be adequate, and far more than the usb would supply.

the recipient database for the weather info is here : weather logging control
so you can see the code does work…I can put the code up if you think it’s necessary but I’ll have to remove the network addresses and passwords.

(mod edit)

Sometimes there may be a line in the code that relies on the USB connection for proper operations of the sketch. For most people in here that can be easy to spot.

Hence the reason we often ask for the sketch too. It also gives people a chance to run it on thier systems too to spot any other potential bugs.

ok, thanks.

I think anybody else running the code would be impractical because they'd need to reconfigure an internet connection and be able to receive signals from a fine offset weather transmitter and then have a web server config to send the data to......

but you do raise an interesting point....what happens to Serial.print output if you don't have a serial output mechanism, i.e the usb connection.

I do have unos out in the field which upload via GPRS and are run by 12v power systems and I'm sure I've left the odd Serial.print debug statements in them without any probs...

ballscrewbob: Sometimes there may be a line in the code that relies on the USB connection for proper operations of the sketch. For most people in here that can be easy to spot.

the system has been running for some time now on a phone charger with USB lead. No glitches whatsoever. From the outset I was suspicious of the power supply input on the mega, hence my question leaning towards the hardware. I am now more than ever suspecting the regulator on the power socket input.

The power supply mentioned in the first post has been running a UNO for some months so I don't think that is the problem.

As no one has offered any replies I'm suspecting it may just be my board and not something that other mega2560 users might have seen.

I suppose I could hook up elaborate voltage and current measurements while the power supply is operating but right now I'm thinking life's too short.

All the Arduinos have limits in the CURRENT they can supply. if you are even close to that then it may be time to upgrade the PSU.

USB chargers for the most have a max of 500mA but the board may have a lower limit than that in its ability to supply current.

It is certainly worth trying a larger current supply and separating out any positive feeds to any external components with of course a common ground back to the Arduino.

Hi ballscrewbob

I fear I may not have explained this at all well. My understanding of mega 2560:

max current from USB input limited to 500ma (maybe as that is pc USB spec) max current from VCC dc socket 800ma (fused at 1amp)

SSD OLED 20ma consumption max ESP 170ma consumption max BMP280 single figure uamps DS3231 300 uamps max

the program runs perfectly from USB socket connected to PC the program runs perfectly from USB socket connected to 1amp USB wall charger

the program doesn't run more than 5 minutes from VCC DC socket with 12v 1amp wallwart. the 12v 1amp wallwart runs a uno with similar load but not exactly, quite happily.

I am still suspicious of the regulator on the VCC Dc socket on the mega 2560

as an aside I was hoping for responses to my original post along the lines of .....12v may be border line for input to the VIN socket..

which would have been meaningful, but I have read that the 2560 VIN can take up to 20v....

oh I have it running quite happily on the USB charger plug I think I'll let it drop...

but many thanks for the interest anyway.

Ah... There was a clue in that last post.

Try reducing the VOLTAGE to below 10 volts (doesn't matter about amps)

It may well be that you are pushing the Arduino's on-board regulator too hard.

It has to reduce that voltage to 5 volts and that is a lot for the on-board regulator to do as it simply does it via HEAT.

Hopefully that will fix both boards and make them a little happier. All the boards here run between 7-10 volts and never seen an issue with the life of the boards (apart from my own mistake a couple of times)