Results 1 to 4 of 4

Thread: Building a simple USB counter

  1. #1
    Join Date
    Mar 2005

    Building a simple USB counter

    Hi all,

    I've been thinking of building a simple switch (3-pins, I suppose) that connects to the USB port and have something keep track of the number of presses. Now, I briefly skimmed USB specs and it's got four wires (Vdd+, Vdd-, Data+ and Data-) and I figured that letting the switch push a voltage across the data lines would do the job. But when trying to find a simple tutorial to get started, the simplest I could find involved PICs (I don't count the ones that hook an LED to the USB port).

    The more I dig, the harder this seems. What could be built straight forward using a parallel port for example, turned out to be much trickier. I'll give up for now, but if I missed anything or you have some litterature you would recommend, please chime in.

    Thanks for your time,


  2. #2
    Join Date
    Feb 2007
    Ubuntu 10.04 Lucid Lynx

    Re: Building a simple USB counter

    Yes, using to switch to cross the usb data pins would definitely not work.

    The usb protocol defined by the usb specifications, can downloaded (free of charge) at However, I reckoned you wouldn't want to built a full usb controller from scratch.

    The easiest way, I think, would be to hack a usb device like a keyboard or mouse.
    Last edited by chewearn; October 2nd, 2008 at 01:37 PM.

  3. #3
    Join Date
    Jul 2008

    Re: Building a simple USB counter

    a search for "usb digital i o" found this:

    yeah, i think you'd be better off with a USB device that has the same logic type and impedance matched inputs. high speed digital lines are a lot different from old school TTL logic.

    only other thing that comes to mind at the moment is that you may want to "debounce" your switch. otherwise, you may drive yourself crazy trying to figure out why you get several counts for every one.

  4. #4
    Join Date
    Apr 2007

    Re: Building a simple USB counter

    Get a usb-serial conversion cable, you could use one of the flow-control pins to read the state of a switch.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts