Saturday, 27 February 2016

usb - Best PC interface for simple custom hardware



What interface of your PC do you use in order to connect to simple custom hardware?


The most commonly used interface was RS232 some while ago and today is probably USB, but wouldn't it be simpler for beginners to use the parallel port to control really simple circuits like step motors or LEDs? I have the impression from what I have read so far that the parallel port was not really designed for things like that, but I am not sure about possible limitations with respect to that.


Unfortunately, I can find very little literature on how to use the parallel port probably because it is somewhat outdated for professional hardware.


Does it make a difference for the decision on the most suitable interface whether I will just use output or also input?


I should add that I do of course know about Arduino, but I don't want to have any complexity hidden from me.


Moerover, I am using Linux and have a parallel port available. So I am currently biased towards the parallel port.



Answer



The parallel port is great when you're using Windows 98 or DOS. All modern Windows operating systems have drastically changed how the parallel port interface works making it almost impossible to interface with anything other than a printer. And the parallel port is basically obsolete at this point anyway. Also, it's basically impossible to do any precisely timed control from a general purpose computer. If your target is milliseconds, it's not too bad. But if you want to get down much lower, it gets very, very hard to do so reliably. You're better off sending high level commands to a microcontroller or similar. I would get an Arduino if you have never used a microcontroller before.


If you want to do any serious interfacing with hardware, you're probably going to be using USB. If you need RS232 serial, get a USB to serial converter chip. These are readily available from companies like FTDI and Exar. Most of the boards I make have a header I can plug a small USB-serial adapter board in to, or they have a USB-serial chip on board. Ethernet is another option if you need higher speed communication, but supporting Ethernet on your device is usually quite a bit more complicated than a simple serial interface. It's also possible to interface with PCI, PCI express, and Serial ATA if you really need the performance.


Edit: I can no longer recommend FTDI with a clean conscience without also mentioning that FTDI has released a driver which contains code to intentionally (and likely illegally) destroy "counterfeit" FTDI chips. See http://www.eevblog.com/forum/reviews/ftdi-driver-kills-fake-ftdi-ft232/ and http://www.eevblog.com/forum/reviews/ftdi-driver-kills-fake-ftdi-ft232/msg535270/#msg535270 for more details. If you are considering using FTDI, then you need to weigh the risks of your devices failing in the field due to this driver, either due to counterfeit chips slipping into your production somehow or some issue with the counterfeit detection in the FTDI driver.



No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...