Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: dbmonkey on June 27, 2013, 10:45:14 PM

Title: USB IO card suggestions
Post by: dbmonkey on June 27, 2013, 10:45:14 PM
I need an external USB I/O card that has
-at least 16 out digital (on/off) wires
-can change all 16 bits every ms
-can be easily controlled with c++

Thanks! I had to ask the experts on this forum  ;D
Title: Re: USB IO card suggestions
Post by: jwatte on June 28, 2013, 11:49:58 AM
Sounds like a slam dunk for an Arduino Uno. Note that the "analog input" pins can be used as digital pins, too. So, 18 total digital pins, plus the serial port which will talk to the computer. Another option that's about equivalent would be the Arduino Leonardo -- it doesn't need the serial port for computer comms AFAIK, so it has 20 total digital pins.
Title: Re: USB IO card suggestions
Post by: waltr on June 28, 2013, 05:33:54 PM
There are some FTDI chips that have GPIO pins and are easy to use.
http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232H.pdf (http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232H.pdf)

 [quote[-can change all 16 bits every ms[/quote]
This might be a problem with using USB and any OS like Windows, Linux etc due to the Time-sliced task manger. 

Title: Re: USB IO card suggestions
Post by: Tommy on June 28, 2013, 07:38:51 PM
Quote
I need an external USB I/O card that has
-at least 16 out digital (on/off) wires
-can change all 16 bits every ms
-can be easily controlled with c++

http://labjack.com/u3 (http://labjack.com/u3)

Not sure about every ms?

Tommy
Title: Re: USB IO card suggestions
Post by: waltr on June 28, 2013, 07:57:46 PM
Not a bad device. From the user's guide:
Quote
Command/Response:  Software command to set it high followed by command to set it low.  Per Section 3.1 the best you can do is about 600us per command.
http://labjack.com/support/u3/users-guide/2.8 (http://labjack.com/support/u3/users-guide/2.8)

So maybe you can get the 1ms although at times this could be much slower.
Title: Re: USB IO card suggestions
Post by: jwatte on June 28, 2013, 08:37:42 PM
The Arduino Leonardo can do 1 ms pin timing easily. The best thing to do would be to define your own USB protocol and write your own USB decoding code using the LUFA library, although that's going to be more work.

If you are OK with scheduling pin on/offs a bit in advance, you can send data for the next 10 milliseconds in each packet, and easily keep up a 100 Hz command rate from the host with a Leonardo (or similar clone, such as the MattairTech 32u4 board that I really like: http://www.mattairtech.com/index.php/development-boards/atmega32u4-usb-development-board-arduino-compatible.html (http://www.mattairtech.com/index.php/development-boards/atmega32u4-usb-development-board-arduino-compatible.html) ) Being under $20, it's hard to get a better price than that :-)