I have ~26 parallel inputs that I would like serialize and send to a computer over USB. I decided to chain together 4 LS165 parallel-in serial-out shift registers, but I don't know how I would send this serial signal over USB. I considered using an FTDI FT232RL, but I'm not sure how I would make my serial signal into UART. I would like to avoid using a microcontroller in the middle if possible, but I will if it will make my life easier. Is there a simple way to take this basic serial stream and send it over USB?

  • \$\begingroup\$ Maybe you can use FT232H. It's a USB-GPIO chip, IIRC. \$\endgroup\$
    – Long Pham
    Sep 2 '18 at 7:33
  • \$\begingroup\$ FT232R has "synchronous bitbang" mode for some IOs. Maybe you can make use of it? \$\endgroup\$
    – Long Pham
    Sep 2 '18 at 7:37
  • 1
    \$\begingroup\$ There is a simple way to transfer 26 inputs over an RS232 to USB converter: Use a microprocessor. \$\endgroup\$
    – JRE
    Sep 2 '18 at 12:27
  • \$\begingroup\$ USB serial converters are MCUs, just running fixed programs from the factory (though there was one that secretly turned out to be reprogrammable). It's likely the most compact and performant solution would be a USB-enabled MCU. However your requirement is not really clear; in particular, what control do you need over the timing? Generally USB is bad for "ask a question, get a response" interfaces (especially at bit level) and much better at data fed on the gadget's own timing, ie, "here, have this" "and this" "and this..." \$\endgroup\$ Sep 2 '18 at 19:06
  • \$\begingroup\$ @ChrisStratton There does not need to be any communication back to the device from the computer. Basically I want the PC to be constantly listening for data to know which inputs were received \$\endgroup\$
    – 00728M
    Sep 3 '18 at 3:10

A relatively straightforward problem:

  1. Create a small state machine to drive your parallel capture, serial clock and character serializer. This is very easy with a small ROM/EEPROM and a couple of multiplexers.

  2. Transfer 3 bits at a time into another 4 * LS165 configured as a 3 character serializer. Configure the three characters as 'group' (char 'A' to 'I'), 'Value' (char '0' to '8'), CR (chare carriage return).

  3. Create a baud rate generator to transfer your characters from the serializer and provide a clock for the state machine.

  4. Clock the serial data into an FT232H configured as a UART to provide your serial to USB conversion.

  5. For extra points, receive a serial command from the PC to start and stop your serializer.

All up about 15+ chips, but easy to layout.


Use something like an Arduino Nano for about $4 (including USB connectors and cable) and write a few lines of code to transfer the data. You could even use the newer Arduino Micro based on the ATMega32u4 and get a single chip solution with USB connectivity for about the same price.

Instead of using TTL shift registers you'd be far better using something like the 16bit MCP23017 or the PCA9671 I2C expanders, both readily supported and relatively cheap.

  • \$\begingroup\$ So it seems like the most cost effective approach would be to use a microcontroller like an arduino. I would still need to use some shift registers to serialize my data though, right? The arduino doesn't have 26 inputs I don't think. \$\endgroup\$
    – 00728M
    Sep 3 '18 at 3:02
  • \$\begingroup\$ There are plenty of MCUs which do have 26 inputs. Depending on the nature of your input sensors you may be able to create a matrix like a keyboard uses. Using shift registers as an I/O expander may yield lower parts cost than a high pin count MCU, but it will mean more complexity and that may dominate cost if you are not building many. \$\endgroup\$ Sep 3 '18 at 4:45
  • 3
    \$\begingroup\$ I decided to go with an AT90USB1286 because it has 46 I/O pins and integrated USB. Although it's a bit more expensive it will make my design really simple. \$\endgroup\$
    – 00728M
    Sep 3 '18 at 6:10
  • \$\begingroup\$ @sigsegv Good choice, I assume your are buying a Teensy++. \$\endgroup\$ Sep 3 '18 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.