15

I'm making a small project which will take +5v from USB, What should I do with the D+ and D-, keep it open or short them to ground or do I have to add some components?

I want to run ATMEGA168 and 16x2 LCD with back light.

Hemal Chevli
  • 986
  • 1
  • 6
  • 19
  • 1
    You're only using this for power, presumably? How much power are you drawing? What are you supplying? iPods require the D+ and D- lines connected in a certain way to charge, while cell phones require a different way, and the USB charging spec requires yet a different way. – endolith Apr 17 '12 at 15:23
  • @endolith This would be relevant if he was designing a charger. But the power user needs nothing. – Rocketmagnet Apr 17 '12 at 16:06
  • 1
    if he wants to be compliant and draw more then 100mA he'll need to negotiate with the controller, although I don't think I've seen a single host interface that actually gives a variable current limit. :-) – akohlsmith Apr 17 '12 at 16:38
  • 1
    @AndrewKohlsmith they might not implement a variable current limit, but the USB Host Controller Driver is keeping an eye on the required amount of current for all connected devices, and will fail enumeration for a device that asks for more current than what remains for a given bus. Even if you use less than 100 mA, by not enumerating you create a mismatch between what the host controller thinks is being consumed and what is actually being consumed. – ajs410 Apr 17 '12 at 17:02
  • 1
    @ajs410 that's not been my experience. Most motherboards I have have the V+ line tied to the system +5 through a self-resetting fuse. – akohlsmith Apr 17 '12 at 17:11
  • I'm running a ATMEGA168 and a 16x2 LCD with back light.I don't think it exceeds the current limit. – Hemal Chevli Apr 18 '12 at 07:11
  • @AndrewKohlsmith You can't just go by motherboards, you must also consider cases where the user has a hub. Plug a 500 mA device into a bus-powered hub and you will see the host controller complain about a lack of power. Also, there is a difference between "failing enumeration" and "cutting off power"; the hub will still probably provide power even if the device fails enumeration. Not enumerating at all still prevents the host controller from tracking the power budget, though. – ajs410 Apr 19 '12 at 22:00

1 Answers1

13

Don't do anything to them.

They refer to differentially encoded transmission scheme that USB uses. Leave them alone, floating.

All you need to power your circuit is the ground and power pins coming from the USB. Many devices that are purely USB powered only have wire connections for those two pins and nothing for the +/-D

Also, be aware of the maximum current draw of your USB port, its something like 500 mA. If you draw too much your port will shut off to prevent short circuiting.

CyberMen
  • 858
  • 9
  • 16
  • 2
    He's intending to have 0mb speed - ie not send any data. – pjc50 Apr 17 '12 at 16:09
  • @stevenvh so? The host should be able to cope with a USB lead plugged into a port with no device or termination at the end. – Rocketmagnet Apr 17 '12 at 16:22
  • 2
    Sometimes some USB hubs, motherboards or laptops will not supply +5v if there is no load sensed. Leaving it floating is not a good idea, especially with ones that have power on usb during sleep. – Piotr Kula Apr 17 '12 at 16:22
  • 3
    The data lines are pulled down to ground through 15k by the host. The host will not attempt to negotiate until it detects device's 1k5 pullup on one of the lines. – avakar Apr 17 '12 at 16:34
  • 3
    @ppumkin, the host will, of course, supply 5V always, otherwise the USB client could not bootstrap. – avakar Apr 17 '12 at 16:35
  • 5
    Do note that according to the specifications, the maximum current a device can pull without negotiation is 100 mA for USB 2.0 and 150 or USB 3.0. If that limit is exceeded, the host can shut the power down. – AndrejaKo Apr 17 '12 at 16:44
  • 1
    Also note that USB OTG spec uses a capacitance-sensing mechanism on the 5V bus to determine when a device is connected. Also, I'm not 100% sure, but I think the 100 mA spec is for pre-enumeration, and that a device is always required to enumerate within so many ms of connection so that the host controller can track the current required by the system. – ajs410 Apr 17 '12 at 17:07
  • @allofyou it's not a specification, but rather its been my experience using it for a power supply. (I determined the max current by shorting it out with a really small resistor (2 Ohms)) – CyberMen Apr 17 '12 at 17:09
  • Technically, you can only draw 100 mA without negotiating over the D± lines. Many things violate this, though. – endolith Apr 17 '12 at 17:47
  • I think I was using an intermediate device to draw power. (it was the power pin to a microcontroller attachement set up. – CyberMen Apr 18 '12 at 12:41