Help for simple USB project

Jun 02, 2004 8 Replies

Hi,



I've tried searching through the newsgroups, but haven't had much luck so far. Hopefully someone here can help.



I need to build a simple device that connects to a Windows system via the USB port. All that the device needs to notify my Windows application of is when a circuit closes. Specifically, when the user presses the button and releases it, the application needs to know about it. Unfortunately, using any other ports is not an option.



I've looked at a number of USB books, but the ones that I've found information on so far require buying development kits. Does anybody know of a good resource that provides the basic information on building a simple USB device and using the Windows HID driver? The cost of the components is an issue, as I may need to buy a large quantity of them.


Thank you for any help or pointers that you can provide! Bryan


Look at

formatting link
that might be of interest to you.

ER

Shameless plug:

formatting link

But also look at Jan Axelson's site:

formatting link

-Rob

Hello Bryan,

I recently developed a USB device for the first time. The documentation regarding this type of interface can be very confusing.

HID is definately the way to go for your project (because it IS a human interface device). The windows driver code has already been written for you. It is included with Window$. All you have to do in your program is find the device, open a file handle to it and read data. The best book I have for how to write this code is Jan Axelson's book "USB Complete". She has an excellent chapter on getting your code to read from the HID device.

As for the device itself, I would recommend the PIC line of USB controllers. They are inexpensive and relatively easy to program. The two chips I know of are the PIC16C745 and the PIC16C765. You can surely get by with the smaller 745 part. They run about $5.50 each for the one-time-programmable version and $11.75 for the JW windowed version which is capable of rewrites. Use the JW part for development, when you have dialed it in, use the OTP part for production. You will need a PIC programmer capable of programming this IC and a UV EPROM eraser for development.

Microchip has an application note on making a USB mouse that twiddles the cursor in a circle. This application note firmware would be a nice place to start. You just need to change the HID report descriptor (and some other descriptors) to make it a vendor defined output and not a standard US mouse class device. Then, setup the host software as described by Jan Axelson, pull out lots of hair and learn alot about USB ;-)

Hope this helps.

Sorry about the obfuscated reply email... don't want more spam :-) Please reply here if you need to.

Keith

I would suggest the FTDI USB chips. I have the evaluation board ($25) for one of their chips and it is easy to breadboard.

-- D. Jay Newman

formatting link
is a USB to serial port adaptor with drivers, which seems to be quite popular. The datasheet says you can use the 8 handshake signals as general purpose input/outputs. You can get it on a small board
formatting link
for about US$33.

Enjoy :) Rich

Thank you VERY much for all of your help!!! I'll start checking out the options provided so far. :)

Thank you! Bryan

I like these. I was considering making something along those lines myself.

-- D. Jay Newman

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required