Can you connect Arduino to both 12V and USB?

I'm not sure if this is in the right area or not, apologies if it isn't!

I'm just wondering as i couldn't find it on the internet, is it possible to power an Arduino Mega, using both 12V (via the power connector) and via USB? If this is possible, is the Vin pin 12V or 5V?

My reason for this is i'm testing a sensor to see its output, and it requires 12V power, so i have a shield that connects it to the Arduino, and powers it if the Arduino is powered through 12V (the 12V power sends Vin to 12V whereby powering the sensor).

To see the output of the sensor, currently im using the EEprom, storing the data, the connecting it to laptop then checking etc.

Im just wondering if i can have both connected, then just Serial.print to the monitor rather than having to store the data..

i didn't just want to connect it and try, incase i fried something.

Thanks

I'm just wondering as i couldn't find it on the internet, is it possible to power an Arduino Mega, using both 12V (via the power connector) and via USB?

from - http://arduino.cc/en/Main/ArduinoBoardUno - The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

If this is possible, is the Vin pin 12V or 5V?

from - http://arduino.cc/en/Main/ArduinoBoardUno - ==> Check - http://arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf -

Vin is before the regulator so I expect it to be somewhere near 12V !!!! so don't connect TTL-level components there !!! I blew up an LCD once

My reason for this is i'm testing a sensor to see its output, and it requires 12V power,

Give the sensor a separate power supply and connect the GND of the sensor with the GND of the Arduino so they share the same reference

then just Serial.print to the monitor rather than having to store the data..

Experiment with both, NB you can do offline measurements with the EEPROM and read them later with another sketch or when connected to PC.

I’m just wondering as i couldn’t find it on the internet, is it possible to power an Arduino Mega, using both 12V (via the power connector) and via USB?

You should be OK as long as you use a 9 to 12 volt supply since there is an FET that disconnects the 5 volt USB power from the rest of the Arduino circuitry if VIN is greater than approximately 6.6 volts.

But… if your external voltage is less than 6.6 volts you may have a problem since both supplies will be powering the Arduino circuitry and they probably will not be providing exactly the same voltage. If you get below the dropout voltage of the voltage regulator then you may have a bigger problem since the USB voltage will be backfeeding the voltage regulator.

There is a diode between the PWRIN connector and VIN so if you feed the Arduino from that connector the voltage will have to be greater than approximately 7.3 volts to activate the FET and anything less than 7.3 volts may cause the problems mentioned above.

Don

I was having problems with power supply from USB, when the circuit activated it would reset and loose comms with PC. However when I tested with separate supply at 7.3v it took only 0.01-0.03A so not sure why the ardiono was resetting when connected to USB.

I connected to USB and the external power and noticed occasionally power consumption of the external supply would jump to 0.56A!! its nothing to do with my circuit so only onboard the nano.

Reading this I upped the voltage of the external supply to 12v and I get a burning smell, looks like the power transistor on the bottom of the board is burnt, not the board has no power at all..

Not sure what is going on here at all I'll try another board now via USB only. Maybe a faulty board?

Please do not attempt to power an Arduino via "Vin" or the "barrel jack". Stock explanation follows.

Remember that when you open the Comms port on the PC with any program, that action always resets the Arduino. That is how it is programmed, but opening the Serial Monitor does the same thing.

The UNO and Mega 2560 have a "polyfuse" between the USB connector and the 5 V line, so if things are drawing more than 500 mA it is likely to shut down sooner or later. The logic circuits operate from the 5 V line, so 5 V is what you really need to provide, and preferably via the "5V" pin as well as to all the external 5 V devices.

General explanation:


A very real danger is that the obsolete tutorials on the Arduino site and others misleadingly imply that the largely ornamental "barrel jack" and "Vin" connections to the on-board regulator allow a usable source of 5 V power. This is absolutely not the case. It is essentially only for demonstration use of the bare board back in the very beginning of the Arduino project when "9V" transformer-rectifier-capacitor power packs were common and this was a practical way to power a lone Arduino board for initial demonstration purposes. And even then it was limited because an unloaded 9 V transformer-rectifier-capacitor supply would generally provide over 12 V which the regulator could barely handle.

If you are asking this question, it is highly likely that you will wish to connect something else. In which case, the answer is regulated 5 V.

This is because the on-board regulator is essentially capable of powering only the microcontroller itself and no more than a couple of indicator LEDs. The on-board regulator might be able to power a few other things if it had a heatsink, but on the (older) Arduinos, it does not.

Powering via the "barrel jack" or "Vin" connections is asking for trouble. The "5V" pin is not by any means an output pin, if anything a "reference" pin but most certainly the preferred pin to which to supply a regulated 5 V.

Paul, Thanks for the clarification.

If something burnt, then something is very wrong.

However unless you provide complete details of what you are doing with circuit schematic and photos taken in daylight rather than in a dark room, I for one have no idea of what the problem is. :cold_sweat: