Sending signals via USB?

Just starting out? Need help? Post your questions and find answers here.
User avatar
treebolt
User
User
Posts: 50
Joined: Thu Feb 21, 2008 4:38 pm
Location: Palm Harbor, FL

Sending signals via USB?

Post by treebolt »

I'm in an electronics class and I thought it would be awesome for a class project if I could build a circuit that my computer can interact with via USB cable. I've never done anything like this before. I was wondering if it was at all possible to use Purebasic to change the voltages on the USB pins.
Mahan
User
User
Posts: 35
Joined: Sun Jan 25, 2009 10:12 am
Location: Sweden

Post by Mahan »

First of all the usb interface is a simple (hi-speed) serial communications bus/interface. You've got vcc (+5v), ground, data in and data out. There is no option for changning voltages on the usb itself. Secondly usb-controllers are abstracted by modern OS'es.

I've heard many people that use the HID-standard to get an easy to talk to device on USB (Hid is short for human interface device and basically you tell the computer that you are a keyboard or mouse kind of thing). Google for HID +USB to know more about it.

If your ultimate goal is to change voltages with usb you should look at wellemans kits. I've seen one kit that implements several low-voltage inputs and outputs and that is controlled by usb + a dll on the pc-side. Using this kit and interfacing PureBasic to the .dll would give you the possibility to change voltages and stuff through PB. and even to make readings from the circuit into your pb program.

edit:spelling.

edit2: Oh and btw electronics tend to be very expensive in the beginning. It like if you do an error or bug you don't get an error message and just need to rewrite stuff. It's more like things going *pooof* and black smoke fills your room, and then you have to go to the store. Guess why I started programming after toying with electronics as a kid :D
User avatar
treebolt
User
User
Posts: 50
Joined: Thu Feb 21, 2008 4:38 pm
Location: Palm Harbor, FL

Post by treebolt »

Thanks for the help, Mahan.

I'm actually 2 semesters from finishing my associate electronics degree so there's no turning back now haha.

I understand about the +5V / ground / I / O, If i can just figure out an easy way to change the USB output voltage on the one pin then I can design a circuit to work with that.

I'll look into the tips you gave, thanks again! =)
aaron
Enthusiast
Enthusiast
Posts: 267
Joined: Mon Apr 19, 2004 3:04 am
Location: Canada
Contact:

Post by aaron »

treebolt wrote:I understand about the +5V / ground / I / O, If i can just figure out an easy way to change the USB output voltage on the one pin then I can design a circuit to work with that.
There is no way to 'change the voltage level' on just one pin of the USB. The signals are called D+ and D-... they are a differential serial line. The PC sends a packet of information down this line every 1ms when there is an active device on the other side. It doesn't have direct pin control over the levels.

You can use something like the FTDI FT245 if you just need some generic I/O, or the FT232R if you need serial control. http://www.ftdichip.com/ Sparkfun (http://www.sparkfun.com/commerce/produc ... ts_id=7841) has some great breakout boards that will save you time.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

Pin1=+5VDC, pin2=data-, pin3=data+, pin4=ground

you could use something like the PIC USB-capable microcontroller (maybe the PIC18F4550). Also, theres a page here with some interfacing stuff and some free sample code written in liberty basic (somewhere on the page, a little messy...shouldn't be too hard to convert to PureBasic) > http://www.schmalzhaus.com/UBW/

the link that aaron posted above is good for stuff too
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

http://www.velleman.be/ot/en/product/view/?id=351346

Comes with a dll that takes care of all the important (but uninteresting low level) stuff for you.
infratec
Always Here
Always Here
Posts: 7583
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Post by infratec »

Hi,

the easiest way is to connect a R/2R ladder to the databits of a parallel-port.
Than you can 'print' your values and you can generate 256 different voltagelevels.

http://en.wikipedia.org/wiki/Resistor_Ladder

The pins of the parallel port are 2 to 9 (bit0 to bit7)

If you need USB, than use a USB to parallel cable.

Bernd
User avatar
treebolt
User
User
Posts: 50
Joined: Thu Feb 21, 2008 4:38 pm
Location: Palm Harbor, FL

Post by treebolt »

Wow, thanks for all the great tips everyone ^_^
mueckerich
User
User
Posts: 22
Joined: Thu Dec 16, 2004 10:36 am
Location: Germany/Allgaeu

Post by mueckerich »

Sorry for the late response, hope this will still help you.
Try the IO-Warrior http://www.codemercs.com/index.php?id=41&L=1
Believe means you don't know
Post Reply