Arduino UNO, 9V DC adapter and USB.

Good Day!

I need to power my arduino through the barrel plug with a 9V DC adapter, while communicating over USB. When I connect both the 9v and USB simultaneously I run into one of two problems;

  1. Windows reports 'USB device malfunctioned'.
  2. Aruino IDE compiler reads, "avrdude: ser_open(): can't set com-state for "\.\COM".

The board also gets quite hot when 9V and USB are connected, but not if each is connected separately.
However, when blink example is uploaded to arduino it will run no matter the power source. I cannot upload sketches and I cannot use serial monitor.

What am I missing!?

Why would you be connectin both the 9V and USB simultaneously?

I need to reed the values of a multi turn pot while the arduino is powered via the barrel plug. So that I can scale the maximum and minimum values to a particular distance in mm. Because the reference voltage from USB and 9V differ, so does the distance of the scaled equation.

FranPhony:
Because the reference voltage from USB and 9V differ

Which reference voltage are you talking about?

Since you are already connected by USB, the Arduino will get its power via the USB. There is no need for the 9V battery.

But he is right (if you use 5V as reference which is common for pots). The 5V from USB is rarely 5V when measured at the Arduino. Enough voltage drop across the usb cable.

But the Arduino Uno should shut off USB power when powered from the jack. Are you sure you don't try to power it from the 5V line?

And are you powering (via the 5V) other stuff from the Arduino? Because the regulator of the Arduino is only just sufficient to drive itself and some leds, nothing more.

His statement -- the reference voltage from USB and 9V differ -- makes no sense. Again, what reference voltage?

It's not very complete but it kind of does. By default the reference voltage is VCC aka the 5V rail. So when you use USB it's indeed true it's different because it will not be 5V precise.

BUT, this does not matter. Because while the reference is lower, so is the voltage of the pot :slight_smile:

But besides that, it should just work to have power via USB and jack at the same time.

I am wondering whether he is doing something with the AREF pin, because normally people don't refer to 5V as reference voltage (or at least I don't).

But most Arduino people do. It's the Arduino default. And to read a pot it's not that bad and it's a hack lot more convenient then to make a separate ref, because you need to feed that ref to the pots as well.

septillion:
But most Arduino people do. It's the Arduino default.

I will have to take you word for it, because I have not seen it refered to the reference voltage here on these forums.

You don't have to take my word for it, just open the analogReference page :wink:

DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards)

Okay, the things that's missing is that it's Vcc. The ATmega328p only has a real reference voltage of 1,1V build in. But you can find this in the datasheet.

Apologies for my incorrectness, as it were. At times my curiosity may reveal my inexperience but I see no flaw in asking questions even if they are poorly phrased.

So to settle the misinterpretation, when I referred to reference voltage I did indeed mean to say Vcc, as septillion pointed out.

I am wondering whether he is doing something with the AREF pin

Are you sure you don't try to power it from the 5V line?

I am trying to power the arduino with the barrel plug and not 5V pin or AREF.

septillion:
But besides that, it should just work to have power via USB and jack at the same time.

I need power via the jack, and communication over USB. That is all.
It isn't working and I just want to know why not?

Now you neglect two parts of my answer. :wink:

First, you don't NEED barrel jack power to calibrate the pot reading (although it should work, see second). Maybe Vcc is indeed lower when connected to USB. But this means the reference voltage is indeed lower but so is the voltage to the pot aka, limiting the voltage of the pot the same amount. So no error because of that. It would be a problem if you use the 1,1V ref but you don't (and is harder with pots because then you have to limit the output voltage of the pot to 1,1V as well).

Second, like I said, it should work as long as you don't load the 5V line of the Arduino. So:

septillion:
And are you powering (via the 5V) other stuff from the Arduino? Because the regulator of the Arduino is only just sufficient to drive itself and some leds, nothing more.

This question still remains :slight_smile:

Got it, there is no need for jack and USB. Pot values would be the same no matter the input power source to arduino.

And are you powering (via the 5V) other stuff from the Arduino? Because the regulator of the Arduino is only just sufficient to drive itself and some leds, nothing more.

I have my multi-turn pot wired up and that is all.

But lets say I do have a number of peripherals connected to the arduino, maybe a multiplexer for pots and some shift registers for buttons and LEDs. And I'm powering it via the jack in! You are suggesting that the majority of these peripherals would need to be powered from a separate regulated source altogether.? (and share common GND with arduino)

Those can all be powered from the barrel jack. You are only looking at tens of mA, with the LEDs being the highest draw, and if you limit those to 10ma each, which will be plenty bright unless you are using old very low mcd rated parts, there will be no issues. Buttons wired to Gnd to pull inputs pins low with internal pullup resistor for a high use very little current (5V/30K = 0.17mA), 10K pots only 0.5mA, muxes & shift registers very little as well. Then 40-50mA for an Uno under normal running conditions.

Those can all be powered from the barrel jack

My thoughts exactly.

the regulator of the Arduino is only just sufficient to drive itself and some leds, nothing more.

Not so much.

CrossRoads is right, that's not really a load and falls under "drive itself and some leds". So that's okay. But it can't drive motors, relays, servos, transmitters, 10+ leds etc. Then you need an external (switch mode) regulator to drive those.

So it sounds like the Arduino is faulty... Which part exactly gets hot?

The two capacitors beneath the jack in and the atmega chip itself. These componenets only run hot when both usb and jack in are connected.

Those are weird components to get hot... Can you measure the voltage (of the 5V pin) then?