[Ladyada] takes some time out of her day to explain the common options available for connecting projects through USB. You may be thinking that you already do this with an Arduino. Well, yes and no. The Arduino uses one of these options, an FTDI chip that handles the USB on one side and spits out microcontroller-friendly voltage signals on the other. This chip can be used with your projects, a topic that [Phil Burgess] covered in great detail.
In the video after the break you’ll also hear about USB to serial converters which connect to the Universal Serial Bus and output the traditional 12-20V serial signals (with the exception of cheap knockoff cables like the one from last week). These need to be stepped down to 5 volts or less using a MAX232 chip to work with your project.
Finally there’s the option of using a microcontroller running the V-USB firmware package. This is how the USBtinyISP works and I’ve used it in my own projects to build a LIRC compatible IR receiver.
27 thoughts on “USB Adapter Options”
sweet just ordered a MSP430 and hopefully i can use this info for a project i’ll be working on.
Interesting and useful.
Or you can man up and learn how to use real USB on a real microcontroller!
USB itself really isn’t that hard to understand. Effectively USB is a standard asyncronous serial interface that has some protocol running on top of it. From an application perspective (depending on how it has be implemented) USB can be made to look and act just like a good ole serial port (only much faster). Check out “Bulk Endpoints”, or if you’d like to give it a shot yourself, the Stellaris microcontrollers from Texas Instruments provide Full speed OTG functionality and their driver stack is almost readable by a human being.
I second suggesting people check out true USB microcontrollers. Sparkfun sells an ATMEL SAM7 header board for $35 that would get you into ARM programming and USB. There is an example on the web for configuring it to just show up as a COM port so you can use it how you’re familiar at first. Then, once you’re comfortable, do what Trey above suggests and use Bulk Endpoint transfer.
If you want to make a real product for someone some day, COM ports just aren’t acceptable anymore.
That’s definitely educational to try, but it’s not always the best solution. The uC has finite resources which are often better spent elsewhere.
Very helpful thank you. I spent a hours trying to figure out this very issue a while back and couldn’t find much help on the web. I had bought an Arduino clone and had a hell of a time trying to find any info on how to program the thing.
RS232 standards specify signals of +3 to +24 and -3 to -24 – in the old days most devices used +12v and -12v as they needed those voltages internally – these days the Max232 will handle +3 to +24 and -3 to -24 on the input from the port, and take 5v and double it to nearly 10v and invert it to nearly -10v (That is what the caps are needed for)
That’s great, and all, but there are lots of other microprocessors in the world besides the Atmel AVR series. This list is a little myopic. I would at least suggest you mention the LPCUSB project.
Another thing to consider is that if you want anything besides a USB-to-serial solution, you have many more options when you implement your own USB firmware. That way, you can build HID devices (joysticks, mice, keyboards, etc), sound controllers, mass storage devices, video input or output devices, devices that act as printers, and a whole array of other real-world USB devices besides a serial port. This also lifts the constraints of sending all your data back and forth at the mind-numbingly slow pace of a serial port.
if only M$ would stop their driver signing USB would be a great option for a DIY project without licenses but your own.
PIC18F series with USB hardware built in and the chips can be had for under 5 bucks, and in DIP packages.
If you want USB pick a better micro and expand your options for future projects.
@t&p: USB HID class devices don’t require drivers, and V-USB provides you with VID/PID pairs you can use freely in your projects (subject to including other information to differentiate between multiple devices using the shared IDs as per the documentation).
When is someone going to come up with an simple interface to allow me to connect my phone up to my external USB drive without that interface being my PC?
USB HID class devices don’t require drivers
shared ID, is prevalent in printers, hp is prime example, most cheap printers used their drivers so much, although i wish to see rs232 stick around maybe another decade, would be nice.
when your phone gets USB host
useful, thank you.
“Or you can man up and learn how to use real USB on a real microcontroller!”
If the project calls for a low cost micro controller and you only need some way of debugging, an FTDI USB to TTL cable (cost £12) is a really quick and easy way to do this. Just stick a 6 way header on your PCB, connect RX and TX and away you go.
Once development is finished, you are not left with an overspecified processor which is costing you money.
“When is someone going to come up with an simple interface to allow me to connect my phone up to my external USB drive without that interface being my PC?”
Buy an el-cheapo router box with a USB port and stick Linux on it (OpenWRT or DD-WRT for example). Now with a little hacking, via a little USB hub you can connect your phone and your USB drive together. Make the USB drive look like a mass storage device to the phone. (I’m not exactly sure how to do that last bit though or if it is even possible.)
The router can also act as network attached storage and/or run a torrent client in the background (wheeeee this is fun!)
The ASUS WL-5200GU WiFi router can be found super cheap sometimes (around $25 USD) and it has a USB port. But there is some debate as to whether the USB port is 2.0 or not. The ASUS WL-5200GU has a firmware upload button on it that makes it almost impossible to brick.
Good Luck, David
You could use Teensy AVR as host and controller for prototyping. You’d also have to develop a software interface for the phone itself. Alternately, if it already has some sort of file navigation, manipulation, and transfer facility, you could try to masquerade your interface as whatever it’s expecting to see then piggyback.
@t&p: I guess driver signing is based on some sort of cryptography. It is probably crackable, like the rest of it. If DVD is busted and blue-ray is busted, and even GSM is busted, not to mention every last program protection and music DRM, then I guess driver signing is probably even easier to defeat and sign your drivers yourself. However, a tinkerer should choose an OS which trusts one and completely avoid playing stupid games over control of one’s own computer.
Have to admit that for the vast majority of projects I look at/want to do, the USB functionality is by far the largest overhead I have to spec for and as such is a massive waste. I end up using COM ports as normal with an FTDI cable. It seems daft to spec a processor because of its interface type, rather than the job it’s doing, but I suppose it’s a must.
MY favorite solution was one all ready featured by HAD using a pic with usb.
A USBmicro module from CircuitGizmos that uses the Windows built-in driver might be all that is needed. It has input/output, I2C, SPI, 1-wire, LCD, stepper motor functions. If a project uses these signals, then all of the USB work is done for you. A free program like RobotBASIC even interfaces to the module to control it.
Does anybody know a good pre-assembled option with opto-isolators built in so that there is 0 chance of me frying my computer?
I’m pretty sure, in theory, that, since your computer would likely require an input of positive or negative current flow to signify a signal transition(as opposed to an input that has it’s own pull up resistor and can be simply grounded to signify a signal transition), so that a positive and negative supply would be present on the computer side of the opto-isolator. This seems like it would negate the benefit of the isolation, other than protection from high-voltage spikes. If you think your project may damage the serial port built into your computer, test it first on an external USB to serial adapter…
Also, I should add, in response to the comments above, that the purpose of the higher signaling levels and positive/negative shift is to increase the distance that an RS-232 signal can reliably reach. Of course, this isn’t necessary for local microcontroller programming, but it has it’s place…
How about using a Nokia data cable like the DKU-5 or CA-42
As a matter of fact, USBtinyISP uses usbtiny (http://www.xs4all.nl/~dicks/avr/usbtiny/) and not V-USB.
I thought the name made it sort of obvious..
MAX233 for me please, built in caps. :D
Please be kind and respectful to help make the comments section excellent. (Comment Policy)