I'm working on a project where my arduino talks to another device that uses serial communication. I've connected my USB cable to a USB-to-serial adapter, so it can communicate with the device.
The problem I'm running into is powering the device: if I'm using the USB for serial, I can't use it for power. I have made sure that the device isn't turning on by putting
pinMode(13, OUTPUT);
for (int i = 0; i < 10; i ++) {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
at the start of the setup
function: if it works, it should start by blinking LED 13.
I tried powering it with a 5V power supply through the power jack, next to the USB connector, but that didn't work. Is there something I'm missing? Do I need a different type of power supply?
-
1The documentation is quite explicit about this.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams03/18/2017 00:13:00Commented Mar 18, 2017 at 0:13
-
In that case, can you point me to what you're referring to? I don't think I found that page.SarcasticSully– SarcasticSully03/18/2017 00:14:58Commented Mar 18, 2017 at 0:14
-
arduino.cc/en/main/arduinoBoardUnoIgnacio Vazquez-Abrams– Ignacio Vazquez-Abrams03/18/2017 00:15:54Commented Mar 18, 2017 at 0:15
2 Answers 2
my arduino talks to another device that uses serial communication
What other device? You haven't said which Arduino, but Arduinos are generally "devices" which talk to a "controller" (host) which is generally a PC / Mac.
The host has the job of supplying power (via the USB cable) to the device. Thus your Arduino will be powered by the device it is plugged into.
Disregarding this issue for the moment, you can supply regulated 5V power directly to the 5V pin on the Arduino. On the Uno (and many others) this is labelled "5V".
The power jack is to supply 7V to 12V (eg. from a wall-wart) which then goes through the voltage regulator on the Arduino (depending on the model in question).
There is quite a discussion about this on https://www.arduino.cc/en/main/arduinoBoardUno. On that it mentions:
Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.
This is true. Directly supplying 5V to the 5V pin bypasses the regulator and also bypasses the reverse-voltage protection diode. However it is possible to do it.
What about the Vin pin?
For a Uno you can see from the reference schematic what happens:
The power jack (on the left) goes into the reverse-voltage protection diode (D1). The other side of that becomes Vin. Then it goes into the 5V voltage regulator (U1). The other side of that becomes the 5V line.
Thus to supply 5V you can provide 5V power to the pin marked 5V. It is probably not ideal, because the voltage regulator may not be designed to have power applied on its "output" side.
There is more circuitry to decide whether to use the USB power or the Vin power (not shown above).
-
What about the Vin pin? I'm a noob, so maybe I don't understand that pin well.user16971– user1697103/20/2017 19:59:30Commented Mar 20, 2017 at 19:59
-
The Vin pin bypasses the reverse-protection diode but still goes into the voltage regulator. See my amended answer.03/20/2017 20:25:11Commented Mar 20, 2017 at 20:25
-
I suppose the Vin pin is to let you "get at" the input voltage. For example, if you supplied 9V to the power jack them 8.3V would be available at Vin, for example to power a motor. (It is less than 9V because of the diode).03/20/2017 20:26:12Commented Mar 20, 2017 at 20:26
-
From what I can read, Vin can used to power the board - via modmypi.com/blog/how-do-i-power-my-arduino. Vin can be utilised as a voltage input (instead of using the barrel adaptor or USB). The voltage should within the 9V – 12V, and it is regulated internally by the board to 5V. Vin can also be used as a voltage output, copying the voltage supplied via the barrel adaptor or USB.user16971– user1697103/20/2017 20:33:48Commented Mar 20, 2017 at 20:33
-
I agree it can power the board, providing you supply 7V to 12V to it. The only difference between that and the power jack is that it bypasses the protection diode.03/21/2017 04:03:07Commented Mar 21, 2017 at 4:03
The kind of voltage regulator on the Arduino board will need about 7v to give 5v out to the board. If you trust that your 5v supply is well regulated - at least that it won't exceed 5v, no spikes, etc. - you can connect it directly to the 5v pin on the board edge. Just be aware that you'll be bypassing the protection of the voltage regulator so it will be on you to make sure you're providing the proper polarity, well regulated 5v. Exceed that value and you'll stand a good chance of damaging the board.