Self Powered USB, Cannot Connect Arduino Via Internal USB

Z87X-UD3H motherboard, arduino micro, w7 x64. It works when I use normal usb line…

so what I’m trying to do, is have the data lines hook up to the motherboard internal usb 2.0 lines, and then have the power/grnd hooked up to a battery source. So you can think of it as a Y, as in the cable goes from motherboard and from battery, meet up, and then go to the usb header on the arduino micro.

I’m having difficulty connecting the arduino, and get different results on differnet usb headers. So I plugged i turn on computer, I get a prompt saying installing device software, but the it just doesnt happen. In device manager, the arduino micro is listed, but it has a yellow triangle alert on it. It says apply the fix, it doesnt have a driver installed, but it can’t be automatically fixed. I link to my program files->arduino drivers folder but it says windows was unable to install drivers, could not find driver software. On the other header, it just lists as an unnamed usb device, not recognized as arduino micro.

I’m wondering if it has something to do with the power/grnd lines on the motheboard header being empty. If that’s the case, how do I make the motherboard think they are occupied? I can’t run the arduino off the motherboard, it has to be powered by battery.

Data lines without a ground connection are useless. The motherboard ground needs to be connected to the voltage potential that is considered 0 volt for the data lines, which is arduino ground. If the ground only goes to a battery, and not connected to the motherboard, then the data lines are at a floating voltage level. Basic electronics 101: grounds must be connected.

USB in a nutshel:

http://www.beyondlogic.org/usbnutshell/usb1.shtml

[EDIT]I’m not sure about USB Vcc needing to be connected. The datalines must be within certain ranges between Vcc and ground to be considered high or low. If it is not connected then it might notwork. Also the host (PC) might measure the current flowing out of the Vcc line and based on how much it is, determine if a device is connected, or somehow faulty if not. The battery source is definitely prohibited from powering the host/pc though. So no current may flow that way. You are definitely using it out-of-spec.

[EDIT2]Why would you want to do this anyway? The Vin power input is for battery powersources. On the Arduino Micro (and alot of other arduinos too) this Vin shuts off a Mosfet which cuts the USB power off as a 5 volt supply if it is high enough. The Vin then powers the 5 volt regulator. But the USB 5 volt is still connected to the Atmega32u4 pins that are (needed) for the USB connection. So all you need is a battery source with sufficiently high voltage (above 5 volt regulator drop). Then the USB connection is only used for data transmission.

http://arduino.cc/en/uploads/Main/ardui … ematic.pdf

Okay, so I plugged it to my case’s usb ports (which are hooked up to internal mobo usb header). Works, right. So I looked at the usb cables to the case’s usb header circuit board, and pulled the red line, and then stuck a 4.8 battery in there (and grounded the battery to the usb ground line). Arduino no longer recognized, doesnt work as described!

So the problem is somehow related to the red line!

Also, note, the battery that I have, it’s ground was hooked up to the motherboard/psu ground in the first place, because it’s a rechargeable battery that is recharged by the system’s psu, so all grounds have always been shared.

[EDIT2]Why would you want to do this anyway? The Vin power input is for battery powersources. On the Arduino Micro (and alot of other arduinos too) this Vin shuts off a Mosfet which cuts the USB power off as a 5 volt supply if it is high enough. The Vin then powers the 5 volt regulator. But the USB 5 volt is still connected to the Atmega32u4 pins that are (needed) for the USB connection. So all you need is a battery source with sufficiently high voltage (above 5 volt regulator drop). Then the USB connection is only used for data transmission.

I want to run my arduino to run when the computer is on, and when it’s off. I want it on when the PC is on because it displays computer data on to an LCD. I want it off when the PC is off because I also use the arduino to power a servo to open/close my computer.

I suppose I could use 2 MCUs, I even have an extra adafruit trinket…i dont know, that’s not what I’ve worked on the last year, i dont want to do that unless I absolutely have no choice.

Anyways, are you saying I could plug the USB battery to the VIN pin on the arduino, and have it plugged straight USB to the motherboard, for continuous power even with the power sources switching?

That would be an interesting solution.

http://i.imgur.com/w7tWkxUl.png

so you are telling me I should instead run red/black/green/white from usb-arduino to usb-motherboard, and then the battery to just vin/grnd?

Is it possible to do this another way, like trick the motherboard’s 5v into thinking its working normally? Because it’d be a huge PITA to do the whole VIN thing.

Thank you for making that circuit drawing. That helps to understand how all the things are connected.

However, it is not clear to me why you would need a battery. According to your on/off requirements it seems that it could simply be supplied power by the PSU. As you say the arduino needs to be on when the PC is on, and off when the PC is off. Is that it? Or does the arduino also need to be powered when the pc is off?

so you are telling me I should instead run red/black/green/white from usb-arduino to usb-motherboard, and then the battery to just vin/grnd?

If the battery voltage is high enough. In your earlier post you never mentioned the specifications of the battery pack to which the arduino was connected for power source. (still not) I might have inferred that it was 5 volt because you wanted to connect it to the USB port of the arduino, but that would be a risky assumption to make. So without knowing the output voltage I suggested to connect it to the Vin power input, IF the voltage was high enough. Higher than the input requirement of the voltage regulator, or 5 volt plus Gate-threshold of the mosfets, which I don’t know exactly what it is. But probably higher than 7 volt.

You say the batterypack is a rechargeable battery, from a cellphone according to the image. Since most if not all of those are based on Lithium Ion technology I doubt it is outputting 5 volts anyway. Unless it has some kind of step-up switching circuitry in it. Either way, it is likely less than the 7 odd volts that the Vin needs, so this is not likely going to work.

The question to ask is “is the battery power (red line) going to the Vin pin or to the 5V pin** on the micro” ? Also please remind me, is this an Arduino Micro or a SFE ProMicro ? IIRC it’s the former. I have occasional but repeatable problems with my Micro getting lost by Win7. It seems that when I do a reset of the Micro via it’s reset button, I sometimes loose the USB connection even after the Micro has done it’s whole bootloader and boot process. Physically unplugging the USB cable (thereby removing power) always works to restore the connection. So there’s some odd timing issue about getting Win7 to recognize that the port is back. Yet when the bootloader runs, and I can see COM port 4 (on my machine) is being used, and then finishes, also releasing the port, my code will then run and Win7 never fails to see COM port 4 go away and recognize COM port 5. If it sees the bootlader, it’ll see the application code. It’s just that sometimes Win7 doesn’t recognize the bootloader.

http://arduino.cc/en/Guide/ArduinoLeona … nardo#toc3

So if you’ve got 5V from the PC/battery wired to the correct 5V pin (not Vin) then perhaps it’s this whole software compatibility thing. Perhaps the code has to do something to recognize that the PC power went away (and thus USB communication) and then came back ? Does Win require that all the USB devices re-enumerate after a Win reboot/restart and the Micro is not doing that ?

**Or I suppose that the PC’s USB/battery 5V could go to the 5V pin on the Micro’s USB connector.

However, it is not clear to me why you would need a battery. According to your on/off requirements it seems that it could simply be supplied power by the PSU. As you say the arduino needs to be on when the PC is on, and off when the PC is off. Is that it? Or does the arduino also need to be powered when the pc is off?

Because the arduino needs to be on when the PC is not only off, but uinstalled. Think of the arduino as a system integrated into the case, not the computer. It needs to be on regardless of the PC’s, and PSU’s, on/off status.

If the battery voltage is high enough. In your earlier post you never mentioned the specifications of the battery pack to which the arduino was connected for power source. (still not) I might have inferred that it was 5 volt because you wanted to connect it to the USB port of the arduino, but that would be a risky assumption to make. So without knowing the output voltage I suggested to connect it to the Vin power input, IF the voltage was high enough. Higher than the input requirement of the voltage regulator, or 5 volt plus Gate-threshold of the mosfets, which I don’t know exactly what it is. But probably higher than 7 volt.

It’s a usb rechargeable battery pack, usually used for on-the-go cell phone charging. it’s usb, so yea 5v.

This is off the arduino micro.

When it’s plugged into usb, like how normal people do it and all, works fine. It’s when I do the whole data lines straight to motherboard usb, and then the power/grnd lines to the battery, that it’s not recognized, doesnt work. So there’s some sort of problem where the computer won’t recognize it unless it supplies the voltage. So i need to trick the computer into thinking it’s supplying voltage or something.

or, if the that whole vin thing works, I could do that. But I’m not sure if that will work, ie plug the battery to VIN, and usb is just normally hooked up, and the arduino would switch power sources just fine if i shut off the computer and turn it back on.

I think I’d rather trick the computer, because it’d be a pain to wire up the usb like a normal cable after all ive done.

Bump. Is there some sort of dummy plug or resistor I can add to the usb 5v line here? Why does the USB not work if the red line isn’t hooked up?

And if I just plugged USB in normally, and then battery to arduino VIN, would it switch between power sources normally?

I mean would it be safe to attach an LED, or some kind of resistor, to the 5v line on the usb? What if I shorted the 5v with ground? Would that be okay? Surely it’d recognize the arduino then?

i hooked up a fan to the 5v and grnd (funny, when i hooked it up to a random molex grnd, didn’t work, had to be to the ground of the usb port i was using) with the arduino hooked up to the data lines, and it worked!

So is there a resistor i can use, or can i short the 5v/grnd?

What if I shorted the 5v with ground?

You are kidding, right!?! This better not happen! In the sense that things won’t work to your liking. The PC might likely disable the USB port as it senses an over-current, cutting off power going to the Arduino. Or worse, your nose will start to smell something. Either on the Arduino, or PC motherbord. Or your PC will reset itself.

!!! If you want to try stuff out without knowing what you are doing, then at least do it with a cheap add-on PCI USB card. It would be a shame to lose a onboard USB port.

But better, learn how the insides of your USB ports work! Thats why I gave the “USB in a nutshel” link. Study it! At least the parts about how the voltages on the lines are used. The 5 volt of the usb port is actively managed by the PC. And this 5 volt and GND is also used by the USB device to signal the host what sort of USB device it is. The datalines D+ and D- are pulled to certain levels using these voltages. So if there isn’t current going through the 5 volt line, then the device can’t signal what it is, and communication isn’t possible.

Battery into Vin:

By connecting the 5 volt (USB) battery pack to the Vin pin you’ll get regulator losses on the arduino 5 volt line. According to the schematic I linked earlier, there is no direct path from Vin to the 5 volt line on the micro. Vin can enter the 5 volt regulator through the body-diode of the T2 P-channel Mostfet (enhanced). Only if Vin is above the regulator output by the amount of the GateSource threshold (it’s gate is connected to the +5v trace) will the mosfet conduct and short the diode drop. So the 5 volt out of the USB battery pack going into Vin will always be reduced by the diode drop, and has to go through a starved 5 volt regulator. I don’t know how this regulator behaves under this condition. But it won’t hurt. Infact, it might even avoid the next problem, current flow back into the pc USB port. But Vin is also tied to ground via the resistor R9, so there is a small drain on the battery by 0.5 milliamp.

Connecting the USB batterypack directly to the 5 volt pin of the Arduino micro is unlikely to work either when the PC is running. The 5 volt from the PC USB port can go through the body diode of T1 (P-channel mosfet) into the +5volt of the Arduino bord. Since an unconnected Vin is pulled down to ground via 10 k resistor, the mosfet T1 (p-channel) conducts and shorts it’s body diode. But mosfets can have current flow bi-directionally. So, if the +5 volt from the Arduino (supplied by the battery pack) happens to be higher than the voltage of the PC USB port, then current flows into the PC. And that is a no-no according to USB rules. The PC may shut down the port, thinking there is a fault of some sort, and your communication with the Arduino will break down. Since you cannot predict when this happens, this makes for a unreliable solution.
Only if Vin is high enough to make the T1 P-mosfet be open (higher than Arduino +5 volt pin minus the GateSource threshold of P-mosfet T2) will this be prevented. This could be done by connecting Vin to the Arduino 5 volt. But then the pc will not be able to power the Arduino either ( and I suspect, be able to charge the batterypack thruough this connection). And also, the battery will be continuously drained again through the R9 resistor. Not good if the PC is in storage or something, or if battery life is an issue.
So, I don’t see a neat efficient solution to this. Not with the Arduino micro schematic as it is. You could try connecting the battery into the Vin line, and see how long it works.

Okay, so the Battery Pack I have can be charged and charging at the same time - it can provide power to something while being charged, and that’s basically how i have it set up - it’s attached to the PSU’s 5VSB rail (provides 5v, it is what allows you to do things like charge your phone even when your pc is off or to power on your pc by mouse/keyboard/network even when it’s off, not all PCs, or rather motherboards, have these abilities but every PSU has this rail - this way I can charge this battery even when the PC is off).

Anyways, you said a lot of stuff but I’m not really sure what your suggestion is. Should I connect the micro by plain USB to the computer basically and then the battery to VIN, and then when the PC is off, the micro will run off VIN, ie the battery? I can’t tell if you are saying this will work or not.

Someone mentioned a powered hub?

I also have 2 compromises I could consider:

  1. Just run off 5vsb and that’s that, no battery power. But I dont know how to do that… sometimes certain usb lines will work when the pc is off on the z87x-ud3h but they are only usb 3.0 ones i think.

  2. I could run the arduino micro with only the lcd/lcd-voltmeter, just plug it into the usb and that’s that, end of story. Then, I can use the adafruit trinket, and have it run off the backup battery, no data lines necessary, for the servo control (the only reason I need this all to work when the pc is off). No power issues to worry about.

Valen:

So, I don’t see a neat efficient solution to this. Not with the Arduino micro schematic as it is. You could try connecting the battery into the Vin line, and see how long it works.

Belial88:
… Anyways, you said a lot of stuff but I’m not really sure what your suggestion is. Should I connect the micro by plain USB to the computer basically and then the battery to VIN, and then when the PC is off, the micro will run off VIN, ie the battery? I can’t tell if you are saying this will work or not.

If you've read through to then end, then you would have noticed that I don't have a working good solution either. The wall of text was intended to explain how the Vin/USB 5v switching works. But trying to find a hack in this, is either too risky for your motherboard/USB ports, or would simply be prevented by the OS shutting of the port making it unreliable. Or if it does work, then the battery will be drained when the pc is powered off for extended periods. How long that takes I don't know, because I do not know what current the Arduino and servo and stuff is drawing on average. Or otherwise I'm just not smart enough to see the solution.

At the very least I would suggest you read that very first link that I gave, “USB in a nutshell”. In side and out, in regards to how the powermanangement works in the USB specifications. And take some time to understand the schematic of the Arduino. Just simply splicing cables and connecting stuff might cause sorrowness in the end, if you do not know what you are doing. And I do not want to lend a helping hand in destroying stuff. Make sure you test this on a replaceable USB-PCI(e)-card, not your onboard ports. Or even better, an old pc that is allowed to die.

then the battery will be drained when the pc is powered off for extended periods

I’m going to put an SPST switch in-line on the power line of the cell phone battery out, it auto-shuts-off when nothing is draining on it and is sensitive enough to stay on with an idle arduino micro. So for extended periods, I just flip the switch and the battery pack will basically turn off on it’s own. The battery pack also has a button on it to turn it off (i suppose that’d be the easier thing to do but not as cool, I want to avoid touching the battery pack, aesthetic choice).

I’ve done the math and it’d take like a month for the battery to drain… in the real world it was like half a week or so, but could be something else going on when that happened anyways.

Would a powered usb hub not be a good choice, one that was powered by the battery that was being charged?

And I’m considering just using the adafruit trinket for the servo control, that might be the easiest way to do this…

Not sure how to do the trinket code thing :X

I don’t know about a powered usb hub. It likely needs more than the 5 volt comming out of your USB battery.

The trinket works on 3.3 volt internally. So you need to make sure the servo you use can work with signals at that level. (Or insert a level shifter circuit) If you connect a battery and the USB plug to the pc at the same time then the battery will not be charged by it. There are Schottky diodes to both preventing current to flow into the other end. And there will be a small drop across the diodes.