RS-232 to analog

Discussion in 'The Projects Forum' started by Liad, Aug 10, 2007.

  1. Liad

    Thread Starter New Member

    Aug 10, 2007

    1. I need to control a 0-5V output via C# code [or any other language for that matter].

    I thought on a 8bit-serial-DAC that will be connected to a serial port [RS232].
    In the code I'll put a 0-100% scroll bar that will control the output.

    8bit = 256 stpes. that's aprox. 2 steps per 1% in the scroll bar, meaning - aprox. 0.02V per 1%.

    any other ways to accomplish the mission will be superb.

    2. [not related to 1...]About the picture attached:

    I know that with option A I have an always-open-line and no problems in communication...
    What I would like to know is, if option B will work when the ground is the building ground?

  2. spar59

    Well-Known Member

    Aug 4, 2007
    DAC proposal:-

    Serial DAC seems a good idea - provided it can accept a data format of start bit, data bits, stop bit at the appropriate baud rate. Many serial interfaces designed for chip to chip communication use a separate data and clock line rather than just a data line with internal clock generation and synchronisation within the receiver as RS232 does.

    You may have to stick volts on some handshake lines to keep the computer happy but mainly beware that the RS232 data line does not go from 0V to 5V which the DAC may want but can be as high as +12V to -12V, typically +/- 10V so you will need to buffer it, a simple single transistor buffer should suffice.

    Telephone circuits :-

    The main problem with option B is finding a good ground point at each end. But even if you do manage it any stray currents flowing in the ground path will enter your telephony circuit and produce interference (background noise) the main component will be 50Hz however since all telephone lines may pick up some of this even if they are nominally balanced circuits the telephones are designed to attenuate these low frequencies, providing peak response within the speech frequency band.

  3. mrmeval

    AAC Fanatic!

    Jun 30, 2006
    The Aruduino can do that it's self contained and the computer can command it. You can use several software packages with one being totally free to run on the computer to control it and another one to write the code for the arduino that would receive the data and act on it.

    It would have 0 - 1023 steps which you can divide however you want. It has six analog IO pins so you can do that for six items and it has 14 digital pins (two run the serial/usb IO)

    The new one is out. I have the NG which you have to manually reset to program. The Diecimilla does away with that. I don't know if vendors have it yet.
  4. Liad

    Thread Starter New Member

    Aug 10, 2007

    1)I didn't mention it before, but I wish to build it myself. not buying it.
    The problem is, that I know very little about DAC's.
    The main problem is that I don't know how to get the 232 and the DAC
    communicate in the "same language"...

    I looked every where for a scheme, but so far didn't find anything.
    any idea?

    2) About the tel, I think that I'll just need to check it in the spot I want to connect them.
  5. hgmjr


    Jan 28, 2005
    Serial to parallel conversion using a shift register tutorial here at AAC....
    Digital-to-analog conversion tutorial here at AAC...

    The most straightforward and flexible way would be to do this with an microcontroller. I would use and ATMEL AVR device that has a built-in UART (Universal Aysynchronous Receiver/Transmitter).

    Another approach would involve the use of a serial-to-parallel converter fed by the RS-232 data stream. You would need a bit of logic to manage the clocking of the data. You would then need a DAC that you would connect to the parallel output of the shft-register to convert the digital output of the shift register to an analog signal.

  6. mrmeval

    AAC Fanatic!

    Jun 30, 2006
  7. Liad

    Thread Starter New Member

    Aug 10, 2007

    sorry for the ignorance, but what is TTL? PWM?

  8. beenthere

    Retired Moderator

    Apr 20, 2004
    TTL stands for transistor-transistor logic. This came after RTL (resistor-transistor logic) and DTL (diode-transistor logic). Modern logic families are either variations of TTL or CMOS (complimentary metallic oxide substrate) logic. The meaning to take from this is the voltage level to expect the logic to work under. With TTL, it's pretty much 5 volts with no tolerance. CMOS is happy with amything from 3 volts to 18.

    PWM stands for pulse width modulation. See questions on the site, the Ebook, or Google for exhaustive treatments on using the technique to control motor speed or lamp intensity.
  9. Liad

    Thread Starter New Member

    Aug 10, 2007


    so how can I use the RS-232 to TTL link that mrmeval sent, to get a clear DC voltage?