8
\$\begingroup\$

I need a number of digital outputs to connect my computer to the real world, however it seems that this job is not nearly as easy as I had hoped.

I've looked into a number of different methods, ranging from dedicated digital I/O cards, micro controllers with USB interfaces, serial ports, parallel ports, ect. However all of the solutions seem to be either too expensive, too much work, or the technology is too dated.

I hope to have 64+ digital outputs running at approximately 1khz each, individually controllable. So far the best idea I can come up with is sticking the outputs of a serial port to an 8-bit serial to parallel shift register and sending chars down the serial connection whenever I wish to change and output (run from a USB to serial port adaptor). I haven't tested this yet so i don't know if it will work.

Is there any other quick and dirty method of getting a fairly large number of inexpensive digital outputs from the computer of which I can easy control with very basic C++ commands?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Somewhat related: electronics.stackexchange.com/questions/3475/… \$\endgroup\$
    – endolith
    Sep 30, 2010 at 14:16
  • \$\begingroup\$ Have you done some math? Simple non-usb RS232 usually has max speed of 115200bps, which is approximately 10KB. Let's say that each channel needs just 1 byte (which I doubt). You want to send 64 x 1000 bytes each second which is around 64KB. Much more then your serial throughput. There are some high speed USB serial cables with 921600bps, and although theoretically possible I doubt this is useful since this is on the edge and as I said 1 byte will hardy be enough, and micro controller will hardly have time for anything else. You will either have to lower your demands or prepare your wallet. \$\endgroup\$
    – avra
    May 19, 2011 at 8:44
  • 3
    \$\begingroup\$ Maybe you should reread your comments for obvious errors before you bash someone...GPOI pins output bits not bytes. That means 64 kiloBITS/s, well under the max 115.2kbs \$\endgroup\$
    – Faken
    May 22, 2011 at 21:48

3 Answers 3

7
\$\begingroup\$

Sounds like you intend to flash some christmas lights. :-)

Anything wrong with using an arduino or similar? It would be fairly easy to expand the number of IO ports if the number of ports say on the mega 1280/2560 aren't enough. You can drive it via serial/USB terminal. You could use shift registers on the output pins of the arduino or you could use the i2c port expander and drive through that.

Using standard components like that will give you the shortest amount of prototyping time.

Note, my way may not be the cheapest. But it's effective and will actually get you rolling quickly.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Not quite with the flashing lights, I'm trying to control 32 stepper motors on a prototype automated universal fixturing device, except I don't have any funding...or knowledge of electronics whatsoever. Maybe I dismissed the micro controller too quickly, got any good step by step resources on how to get up to speed from the ground up with practical examples? (and I do mean from the ground up, I have a rather strange knowledge base that is way too theoretical and not enough practical, you can assume I know absolutely nothing...feels like it most the time anyways, heh) \$\endgroup\$
    – Faken
    Sep 30, 2010 at 7:21
  • 1
    \$\begingroup\$ Controlling stepper motors is going to require a bit of extra throught. You won't be able to drive them directly from microcontroller output pins. You'll need to use some electronics 'glue' in between the pin and the motor so you don't fry the micro. Like anything its best to start off small and work your way up to more advanced examples. One of the more avid enthusiasts I've seen around is tronixstuff.wordpress.com has some good step by step beginners stuff. I know the guy that runs it also frequents this stack exchange. \$\endgroup\$
    – Rob
    Sep 30, 2010 at 8:03
  • 1
    \$\begingroup\$ Yup, I found a very nice stepper motor driver to use in between the control signals and motor (just uses 2 inputs, step and direction). I'll look through that tutorial you linked, thanks. Btw, just to make sure, I want it to be my computer that sends the commands real time via a c++ program to the micro controller to move the motors. Is this possible or very easy to do with this micro controller? \$\endgroup\$
    – Faken
    Sep 30, 2010 at 8:40
  • 1
    \$\begingroup\$ Of course. The microcontroller acts as the buffer between computer and stepper motor driver board. It can interpret the commands that you send and act on them as well as provide feedback to the PC if required. The other benefit of using something a bit conventional is that you can get a lot of support/advice from the community, the chances are always good that someone has done something similar. So thats pretty handy in itself. The micro just provides a really nice low cost interface between pc and your driver boards. \$\endgroup\$
    – Rob
    Sep 30, 2010 at 9:56
  • \$\begingroup\$ Adafruit makes a nice board that can be used to drive 16 servos, and they can be chained together. It would be fairly easy to write some arduino code that reads data from a PC and then sends it out to the servo driver board. adafruit.com/products/815 \$\endgroup\$ Feb 6, 2013 at 5:26
3
\$\begingroup\$

The serial to parallel shift register will work. Using the SPI port you will have no problem with the 1KHz update rate. IIRC on an ATmega328 with an 8MHz crystal (or higher) you should be able to get 1Mbits per second. A lot of other microcontrollers will work as well.

Another option is to use multiple microcontrollers. For example -- using an ATmega328 (which is around $5 with the passives) would give you 18 lines while keeping the TXD and RXD lines free. Parallel up the RXD lines and then all the uCs will receive the same command strings. You would need to parse the command strings on the uC. Use an FTDI cable to get to USB. Add an Arduino bootloader to the uC and you could use the Arduino tools.

The serial to parallel conversion is more straight forward. If your application can use open-drain outputs you could use a 16 channel LED driver. This would mean adding four chips.

\$\endgroup\$
1
\$\begingroup\$

The simplest option I've come across seems to be the IOIO-OTG. It's a PIC-controller based external OTG USB device, designed for android, but usable with a PC, via Eclipse and the Android Development Toolkit. It has 46 3.3v GPIO pins, as well as bunch of other useful stuff. It doesn't have the 64 pins necessary for your project, but you could just use a few serial to parallel shift registers, as mentioned by jluciani (or use stepper motor controllers instead, and use less pins).

There is also this PIC-based USB IO board, which does similar things, but has less pins.

\$\endgroup\$
0

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.