Connect with us

Analog output from a computers RS232 serial port

Discussion in 'General Electronics' started by David Hulbert, Aug 4, 2004.

Scroll to continue with content
  1. What's the easiest way to get analog voltages from a computer? The
    current shouldn't be a problem as the signal could be amplified.

    Can you just connect the data and ground pin from a serial port and
    send all 0s for 0V, 1010101010 for 1/2 voltage and all 1s for full
    voltage (with differnt combinations in between)? It's to connect to a
    motor, which I doubt would notice anything happening over 1kHz.

    Would I have to smooth out the output some how? If so, how can I do
    this? (I have a bit of elecronics skill but not lots)

    Can you program the data lines on a USB cable to do the same? This
    would be more practical but I don't know if it's even possible.

    What about parallel ports?
    The diagram at
    looks like it may work but I don't know. Might this be easier than a
    serial port?

    Also, once I've got the voltage, it will probably be from 0V to 5V or
    something. What would the easiest way to get that from 0V to around

  2. Robert Baer

    Robert Baer Guest

    You would need to convert the serial data blocks to parallel data
    bytes, latch themas they arrive, and use the parallel data to drive an
    A/D converter.
    Just get a plugin D/A card...
  3. John Schuch

    John Schuch Guest

    The question is whether you are looking to get a stable-state voltage,
    or some analog signal (like audio). The circuit you linked is
    capacitively coupled so it would pass audio (or some fairly fast moving
    analog signal) but not DC voltage.

    Here's a link to a much better D/A design based on a resistor network
    like the one you included:

    This is just a thought; the sound system on a PC is essentially a D/A
    converter. Maybe they can be driven to a stable-state DC output. If not
    the newer multi-channel systems, perhaps a really old add-on sound board
    that you can pick up for a couple bucks.

  4. SolarWind

    SolarWind Guest

    Dear Dave,

    If you just want to control the speed of a DC motor(0 - 5V) by
    parallel port, you have done your own design in half way, use your own
    design ckt:
    and remove the output capacitor and connect the output to the base of
    a power transistor, and a 1K resistor "R" to be connected to the
    transistor emitter and ground, connect the transistor collector to 5V
    or 12V directly, you can get 5V/1A DC source from key board connector,
    or DC 12V from PC internal connector. This is an emitter follow
    circuitry, the DC output voltage is from transistor emitter, the base
    impedance is very large = Hfe(amplify of transistor) x R, so the
    signal on the base will be not pulled down by the load, now you can
    control the pins state of parallel port and you will get different
    voltage output in DC, you can connect a 0.2uf/10v capactor between
    transistor base and ground to smooth the control voltage, but that
    will cause some time delay after changing the parallel port pins
    state, so you need to choice the time constant of capacitor and
    resistor between the capactor to meet your need.

    Note: You should connect a 47uf/10v capacitor to emitter output and
    ground to eliminate the spark pulse from motor, if without this
    capacitor, the transistor may be punched through by the high voltage
    spark that is created by your DC motor brush contacts and the motor
    inductive coil.

    Now you got a very simple and cheap but effective circuit.

    Good luck!
  5. I think I understand that. Thanks for your reply. I'll try doing that
    but might buy a pre-built board if it gets too complicated!
  6. BobGardner

    BobGardner Guest

    Check out the ads in the back of Circuit Cellar... lots of smal a/d and d/a
    boards available... all kinds 8 bit, 12 bit, 0-5V, +-10V... its out there......
  7. All you need is a R-2R ladder DAC. You use the parallel port and a
    25-pin connecotr, and some resistors, I think 27 in all. See URL

    Instead of being only four bits high, you would make it 8 bits high.
    The resistors would be a convenient value, I used 10k and 20k 5%. But
    1% would be best. Instead of the B1, B2, etc., switches, you would
    connect the resistors to the 8 bit pins of the parallel port. It's
    highly advisable to do this to a parallel adapter card, because if you
    mess up the motherboard's parallel port, it's a Real Bad Thing. The
    opamp would have a gain of a bit less than 2.5 (2.5 would give you an
    output of 12.5VDC assuming each bit has an output of 5VDC.) But since
    the resistors load the output pins a bit, the voltage might be less
    than 5V.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day