1. Michael Nusair

    Thread Starter New Member

    Oct 21, 2015
    16
    0
    Hi, i have a basic question. sorry for bad English.
    I have a product, which has a usb connector, and it only uses power, and it doesn't really communicate with the computer.
    my question is, how can i make this cable recognized by the computer? i have the D- D+ lines free, but what shoud the connect to? do i need a microcontroller to present itself with usb ids? i only need to see the name of the device on the computer and than i can make a software that will autorun when its connected but no really communication is necessary.
     
  2. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,771
    971
  3. Michael Nusair

    Thread Starter New Member

    Oct 21, 2015
    16
    0
    Thanks, but can you shortly answer this question?:
    What is the cheapest and easiest way to make identify a simple cable as a device?
    i can only think about putting a microcontroller, program my app to recognize specific vendor and product id, and the microcontroller wont actually be used except presenting itself.
     
  4. GS3

    Senior Member

    Sep 21, 2007
    408
    35
    In general, if it only draws power then the computer will give a limited amount without asking. You only need two wires. I have many devices like that. Like a rechargeable shaver which recharges with USB. The cable that came with it only has two wires and cannot be used by devices which use data.

    If the device needs more power then it needs to negotiate that with the computer using data wires.
     
  5. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    You want a short and quick answer? Here you go:

    Learn how USB works.
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,155
    1,795
    If you can figure out a way to negotiate with the upstream device without a microcontroller, then you might actually have something worthwhile.
     
  7. Michael Nusair

    Thread Starter New Member

    Oct 21, 2015
    16
    0
    and if i don't, what is the simplest microcontroller that i can program his ids (at least some of them, of course not the vendor id) or even if i cant program, what is the simplest electronic component that will send ids?
     
  8. GS3

    Senior Member

    Sep 21, 2007
    408
    35
    If all you want to do is charge you are better off just getting a USB charger for a couple bucks and save the computer USB port for better uses.
     
  9. Michael Nusair

    Thread Starter New Member

    Oct 21, 2015
    16
    0
    Lets say i have a simple LED lamp that needs 5v, and i don't care how much power (current)
    i just want my screen brightness to change automatically when its connected, i don't need data from the lamp, i only need to know when its connected.
     
  10. GS3

    Senior Member

    Sep 21, 2007
    408
    35
    Oh, I see. Well why don't you use any device which already has or you add the LED. Any old webcam or other discarded device. The computer recognizes it. Now you have to write the driver so that it does what you want.
     
  11. Papabravo

    Expert

    Feb 24, 2006
    10,155
    1,795
    USB allows for one-way data transfer after a connection has been established. Establishing a connection is a two way thing. The short sad truth is that there is no simple way to do this. This was not one of the design requirements as articulated by the original consortium of companies that put the first specification together in the early 1990's. If you want minimal and no requirements you're just going to have to roll your own.
     
  12. Michael Nusair

    Thread Starter New Member

    Oct 21, 2015
    16
    0
    Because, this isn't my real problem, i gave an equal problem just that you will understand, in my problem i need to do the correct solution.
    can you shortly explain how can it be done?
    Tank you very much anyway
     
  13. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,771
    971
    pullup resistor on the data pin
     
    cmartinez likes this.
  14. Michael Nusair

    Thread Starter New Member

    Oct 21, 2015
    16
    0
    and how will i identify my device? how can a pullup resistor present ids?
    if there isn't a way without a microcontroller its ok, but what is the simplest way with a microcontroller?
     
  15. Papabravo

    Expert

    Feb 24, 2006
    10,155
    1,795
    The simplest way with a microcontroller is to engage in the bidirectional handshake as described in the USB specification to establish a one-way data connection. AFAIK the USB 2.0 specification is now a free download. Read, learn, and enjoy.

    http://www.usb.org/developers/docs/usb20_docs/
     
  16. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,771
    971
    But he already said no actual reading/learning :rolleyes:
     
    DerStrom8 likes this.
  17. GS3

    Senior Member

    Sep 21, 2007
    408
    35
    So you have a device the computer can identify. Now what? Are you going to write the necessary driver and program yourself? Because that's the most important part.
     
  18. Michael Nusair

    Thread Starter New Member

    Oct 21, 2015
    16
    0
    i will write a very basic driver only to see the name of the device and than the app will run independently
     
  19. GS3

    Senior Member

    Sep 21, 2007
    408
    35
    If you are capable of writing a driver for a USB device I would think the part you are asking would be very easy for you. You should be familiar with the whole USB protocol and specs.
     
    DerStrom8 likes this.
  20. Michael Nusair

    Thread Starter New Member

    Oct 21, 2015
    16
    0
    i know it sounds weird, that because i did not explain my project exactly, thanks for the help
     
Loading...