Shop OBEX P1 Docs P2 Docs Learn Events
Simple USB Device — Parallax Forums

Simple USB Device

Wayne FulcherWayne Fulcher Posts: 3
edited 2010-06-19 17:45 in General Discussion
I have no idea where to start, I have some experience programming the basic stamp and building simple circuts. I have a lot of experience writing software to run on a Windows PC. What I want to do is build a really small circut that is powered by a USB port on a PC that will simply communicate to some software I will write on the PC.

All I want it to do is this. Have the USB port connect to some type of Stamp, pic chip, micro controller (I'm not sure which I should use) and have 2 wires from my circut·go to a manual switch. One wire will be +5v from the USB power source and the other wire go to an Input pin on the chip. The two wires will be connected to a "usually open" push button switch. So when someone or something pushes the button my software on the chip will detect the pin is now High·and send a message to the PC saying "1" or "High" or whatever. Then when the switch is no longer pressed and the input pin goes low it can send a message to the PC saying "0" or "Low" or whatever.

I have attached a drawing of how I imagin this would be connect but I am sure it will take more than just what I have written. What I am specifically asking for in this thread is recommendation to what type of chip will do what I need and if possible a circut diagram for how to build it. I would be very impressed if someone could then give me a code example of what I would need to burn to the chip to make it do what I want.
711 x 311 - 19K

Comments

  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2010-06-18 22:10
    Why not keep it simple? Try hacking a keyboard or gamepad or use a keyboard encoder (www.ultimarc.com or www.groovygamegear.com) and you can avoid having to communicate and program a microcontroller altogether. Your program can monitor for a certain keypress or gamepad button press.

    Another approach is to use a stamp or SX chip hooked to a serial port or to USB with a USB-Serial adapter since parallax microcontrollers aren't a good match for USB.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Talbot
    New Market, MD, USA
  • FranklinFranklin Posts: 4,747
    edited 2010-06-18 22:17
    You could do this with a usb to serial chip (FTDI comes to mind) and a switch.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Wayne FulcherWayne Fulcher Posts: 3
    edited 2010-06-18 22:19
    Actually I did already hack a USB mouse and solider two wire to the circut board of the mouse and ran the wires out the side. It works great but there is more to this than I have posted. If I can do what I posted then I will be able to do the rest my self. I need to research the USB-Serial Adapter. I had not heard of that before but then I guess I will still have to write the PC software side to detect the device as normal right?
  • Wayne FulcherWayne Fulcher Posts: 3
    edited 2010-06-19 13:28
    The BS1USB was exactly what I was looking for, I ordered 2 of them because I think it will be fun to play with. (I cant believe how much of a nerd I really must be smile.gif ) It appears to be totally ready for me to start programming. Although the manual for that device was only 2 pages and didn't give much by way of explaining how to use.

    Do I just write all my code for the BS1 with the assumption that I am talking serial?

    How do I burn my code to the BS1?
    I have a couple of BasicStamp2 chips and have used them a bit so I know how connect those in order to burn using the BasicStamp Editor version 2.4 but I usually have the stamp plugged into a bread board so I dont know how I would connect the BS1USB so that the editor could see it.

    After I install the FTDI USB drivers on my Windows PC what do I do in my windows based software to talk to the device? Do I try using something like COM1 or COM2?

    Thanks a million for your help, this is going to be awesome.
  • ForrestForrest Posts: 1,341
    edited 2010-06-19 17:03
    I think the reason the BS1USB datasheet is only two pages long because it's simply a BS1 with a built-in FTDI USB-Serial Interface. The BS1 treats the USB interface as a serial interface. You should be able to connect your switch to the BS1B with a 10K pulldown resistor and use the Button command. Check the PBasic Reference Manual and the Stampworks books for more info.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2010-06-19 17:45
    I'd use something like a cheap(1.30) tiny85 running
    the open source V-USB to do this sort of thing.
    Or for many more I/O pins a tiny88 (1.60) would work
    well. Both tinys would easily operate directly from the
    USB 5.0v

    Come to think of it a tiny88 would perhaps make a nice and
    really cheap USB propeller chip programmer device...hmmm
    You could add usb programming to a prop board for nearly
    nothing, and still have use of the tiny88 for other things.

    www.obdev.at/products/vusb/index.html
Sign In or Register to comment.