Arduino R3 battery power and USB cable at same time?

1,644 views
Skip to first unread message

Rudy Rimland, CISSP

unread,
Apr 7, 2015, 6:49:26 PM4/7/15
to hbrob...@googlegroups.com
I feel like a noob for asking, but...

I added a 9V battery and power switch to Vin on an Arduino R3 project
(including wifi shield, and about 40mA on a proto shield). Works great.

Just wondering if anyone has any experience with connecting to a
computer with a USB cable while power to the device is from battery?

Am I at risk of damaging either the Arduino or the computer? Or is it
safe to connect to the computer via USB while the battery is powering
the Arduino?

I googled, perhaps using wrong search terms and could not find a clear
answer. If there is a risk, would a steering diode provide isolation,
and how should it be connected?

Regards,
Rudy

Mark Johnston

unread,
Apr 7, 2015, 7:27:39 PM4/7/15
to hbrob...@googlegroups.com

I use 9V adapter into arduino and hook usb port to pc.  The USB port is defined to be 5V so that is ok.
That jack properly converts from 7V to 12V DC down to regulated 5V for the Arduino Uno (some Arduinos it does that but for cpu voltage of 3.3V but even those have USB safe for computer as USB is a defined standard and runs off of on-board 5V.    Ground is common to all the voltages and the USB I have mentioned.

What you have to look out for is the circuits of 3.3V devices hooked to the cuircuits (like IO ports, I2C, Serial) of 5V devices.  That is important but you have not asked about that.  That is very important to be aware of for assorted little breakout boards and so on from AdaFruit and so on.

When you say 'the power to the device is from battery' is that some other thing or are you talking about the Arduino?  I'm not clear on your meaning of battery.
You can power the Arduino power jack with 7.4V battery (because just like the 9V wall wart, the Arduino kicks it down to 5V in my case with the Uno or in a few Arduinos onboard regulators kick it down to 3.3V like on the Due.     I use 7.4V battery into that jack for mobile and again, the USB is still ok to a computer for that case.

Mark 

Rudy Rimland, CISSP

unread,
Apr 7, 2015, 8:15:10 PM4/7/15
to hbrob...@googlegroups.com
Mark, thank you for a complete answer, it may help others too.

And somehow I left the Uno out of Arduino Uno R3 in the subject.  My typo...


On 4/7/15 7:27 PM, Mark Johnston wrote:

I use 9V adapter into arduino and hook usb port to pc.  The USB port is defined to be 5V so that is ok.
That jack properly converts from 7V to 12V DC down to regulated 5V for the Arduino Uno (some Arduinos it does that but for cpu voltage of 3.3V but even those have USB safe for computer as USB is a defined standard and runs off of on-board 5V.    Ground is common to all the voltages and the USB I have mentioned.
Got that.


What you have to look out for is the circuits of 3.3V devices hooked to the cuircuits (like IO ports, I2C, Serial) of 5V devices.  That is important but you have not asked about that.  That is very important to be aware of for assorted little breakout boards and so on from AdaFruit and so on.
Doing that too, I2C is great and easy to work with; my accelerometer runs off of the Arduino on-board 3.3V.  I am using a breakout board with a couple of transistors to translate the I2C signals between 3.3 and 5V.

When you say 'the power to the device is from battery' is that some other thing or are you talking about the Arduino?  I'm not clear on your meaning of battery.
I am powering the Arduino using a "standard" 9V battery (like for smoke detectors and that archaic device called a "portable transistor radio."  I connected it to the Arduino Vin pin, and ground to the common ground.  The Arduino on-board regulator turns this into 5V for the CPU and shields.  That is all good.  I used a 9V since it is readily available and I happened to have a bunch of connectors in my junk box.  A 7.4 would be more efficient, and I may change it later.  I'll also be looking at using a rechargeable battery at some point, no later than when I I run out of my stock of alkaline 9Vs.

Initially, I ran the project off of USB power, then a wall wart, and am now going wireless/mobile.  But have never connected to both the laptop USB and a second power source to the Arduino at the same time.  Having let the magic smoke out of too many devices over the years, I have become cautious...

You can power the Arduino power jack with 7.4V battery (because just like the 9V wall wart, the Arduino kicks it down to 5V in my case with the Uno or in a few Arduinos onboard regulators kick it down to 3.3V like on the Due.     I use 7.4V battery into that jack for mobile and again, the USB is still ok to a computer for that case.
So the to 5V sources do not "fight" each other then.  Looking at the schematic again ( http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf ), it looks like there is an isolation transistor with integral diode (T1) controlled by a comparator (U5A) between USBVCC and +5V.  I had not noticed it before.  I think I got confused by the diode (D1) between PWRin and Vin, and wondered if I needed another between Vin and the battery, or if I should be connecting the battery to PWRin and thus through D1.  Maybe a better question is if D1 is for steering/isolation purposes, or just protection against a reverse polarity connection.

Mark 
--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at http://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.

Chris Albertson

unread,
Apr 7, 2015, 9:10:20 PM4/7/15
to hbrob...@googlegroups.com
not only can you do this but some projects it is required. The USB
port will sometimes refuse to supply enough current to the Arduino.
USB devices when you plug them it negotiate an upper limit on how much
current is to be available and your USB hub may not have enough power
to drive a project that uses something like stepper motors or serves.
I've had hubs decide to shut down the current and then had to use
either a battery of power cube.
> --
> You received this message because you are subscribed to the Google Groups
> "HomeBrew Robotics Club" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to hbrobotics+...@googlegroups.com.
> To post to this group, send email to hbrob...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hbrobotics.
> For more options, visit https://groups.google.com/d/optout.



--

Chris Albertson
Redondo Beach, California

Mark Johnston

unread,
Apr 7, 2015, 10:25:20 PM4/7/15
to hbrob...@googlegroups.com
9V battery is 'wimpy' and with only 0.5amp-hour your arduino doing nothing will drain it in around 7-10 hours.   I like and encourage recharables and that is partly why I use the 7.4v but I use LiPo batterys for most things as they hold charge a very long time and charge fairly fast too.  LiPos also don't have the nasty 'history' problem that NiCads and even the more recent NiMH do but I digress.

If you do a lot of I2C and other stuff and need really cheap level converters with only one or two lines it is sometimes nice to use a discrete 1 transistor and 2 resistor solution if you have space it only takes about a square quarter of an inch for one circuit.   The circuit uses 2 10k resistors and one 2N7000 fet and one nice write-up on it is here:   http://www.hobbytronics.co.uk/mosfet-voltage-level-converter  but you can find this simple circuit in a lot of places and chances are it is exactly what you have on that breakout.    There are also ICs with 8 channels and other solutions but I think you know all this already.

Cheers
Mark Johnston


Marco Walther

unread,
Apr 8, 2015, 9:50:48 AM4/8/15
to hbrob...@googlegroups.com
On 04/07/2015 03:49 PM, Rudy Rimland, CISSP wrote:
> I feel like a noob for asking, but...
>
> I added a 9V battery and power switch to Vin on an Arduino R3 project
> (including wifi shield, and about 40mA on a proto shield). Works great.
>
> Just wondering if anyone has any experience with connecting to a
> computer with a USB cable while power to the device is from battery?

I've done it and without negative effects so far.;-)

From

http://arduino.cc/en/Main/ArduinoBoardUno
and
http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf

it looks like it should be safe. But I don't give any guaranties;-)

-- Marco

Alan Marconett

unread,
Apr 8, 2015, 8:43:53 PM4/8/15
to hbrob...@googlegroups.com, KM6VV
There should be no problem. I've run that way a lot of times.

Alan KM6VV

Rudy Rimland, CISSP

unread,
Apr 8, 2015, 9:55:23 PM4/8/15
to hbrob...@googlegroups.com
I think I am getting there. I was confused by diode D1, and what role
it serves in isolating the power multiple sources of power. After
reviewing all of the comments in this thread, I was able to search for
and find method 4 in:

http://www.ruggedcircuits.com/10-ways-to-destroy-an-arduino/

It seems D1 is not for isolation as such, it is there to protect against
reversed power supply polarity. As a result of this information, I will
either add a blocking diode to Vin or reconnect my 9V battery connector
to PWRin. D1 is in the path between PWRin and Vin, a direct connection
to Vin is not protected against reversed polarity.

Right now, a simple touch of the 9V battery with reversed connection and
with the power switch in the on position will destroy the Arduino. In
theory, T1 would isolate the connection to the host computer over USB,
but this depends on the output of a comparator which might also get
fried by the reversed connection...

Thanks for your input, it helped me sort out why my hack made me
nervous. It put me just two mistakes away from a $100 minimum error.

Thanks,
Rudy
Reply all
Reply to author
Forward
0 new messages