Connect with us

analog to ttl

Discussion in 'Electronic Design' started by dimention11, Jul 6, 2005.

Scroll to continue with content
  1. dimention11

    dimention11 Guest

    hello i have an analog 0-5v i wish to change to a digital (ttl) 0-5v.
    I assume it is as simple as hooking up a transistor.
    am i right...
     
  2. Might be. At exactly at what input voltage do you want the TTL output
    to change from low to high. Then, at exactly what input voltage do
    you want the output to transition back from high to low?
     
  3. Luhan Monat

    Luhan Monat Guest

    If your 'analog' is already going from 0 to 5 volts its already 'digital'.
     
  4. dimention11

    dimention11 Guest

    I will want this to switch from approx 2v to on(5v)
    if this can be adjusted it would be even better.
     
  5. dimention11

    dimention11 Guest

    I wish it to switch at 2v from 0v to 5v approx

    I dont want no 1v to 4.5v just 0v or 5v (within reason).
    just because it is operating on 5v does not mean it is digital...
     
  6. Clive Tobin

    Clive Tobin Guest

    I would use a Schmitt trigger if you want a good clean digital output.
    Maybe a 74HC14. These are cheap.

    You need to give the IC +5 volts and ground. Connect your analog signal
    to the input of one section (there are 6 total) and the output of the
    first section to the input of the second section. The output of the
    second section will be your digital signal. Connect unused inputs (4 of
    them) to ground.

    The switching point will be somewhere around +2 to +2.5 volts. It will
    be slightly different for positive-going vs. negative-going signals.

    Sorry I can't draw internet schematics or pictorials. Electronics texts
    and data sheets will give the pin connections.
     
  7. What you need is a one bit analog to digital converter. These are
    otherwise known as comparators. One that would probably serve your
    purposes would be something like an LM393.
    http://www.fairchildsemi.com/ds/LM/LM393.pdf

    It has two inputs and an open collector output. You connect a
    resistor, say, 10k ohms from the output to +5 volts to produce a 5
    volt output swing. Any time the + input is more positive than the -
    input, the output turns off, allowing the resistor to pull the voltage
    up to +5. Any time the + input is more negative than the - input, the
    output transistor turns on, pulling the voltage down to very close to
    the negative supply voltage (zero volts, in this case).

    You can connect a potentiometer or voltage divider between the +5 volt
    supply and ground to set the decision voltage. If you connect that
    voltage to the - input and your analog voltage to the + input, you can
    set the input level that swings the output. Switch the + and - inputs
    if you want the output to swing low when the input is high.
     
  8. Pooh Bear

    Pooh Bear Guest

    Philips data gives Vthr +ve going as ~ 2.4V and Vthr -ve going as 1.4V. I.e.
    1V of hysteresis.

    http://www.semiconductors.philips.com/acrobat_download/datasheets/74HC_HCT14_3.pdf

    Maybe too much ? In which case an LM311 does the trick. Or LM393 / 339 if dual
    or quad needed. The OP will have to learn how to configure hysteresis though.


    Graham
     
  9. Others have given a lot of replies.
    There are a whole series of 'questions' that vary the answer. The first
    (already mentioned) is the switching 'point'. However there are two values
    here. The 'on' point', and the 'off' point. A degree of hysteresis is
    normally needed to avoid instability. On a comparator, this is achieved by
    a small amount of positive feedback applied around the comparator. Schmitt
    trigger gates have this type of behaviour built in. However there is also
    the question of speed (if the required switching rates are high, it may
    well alter the solution), 'direction' (whether you want/mind the output
    being inverted, so a high level gives a logic '0', and a low level a logic
    '1'), what load the digital output needs to drive etc..
    A very 'cheap' solution for certain of these combinations, is the TL431
    voltage regulator IC!. This is a three terminal IC, whose output pin is
    pulled 'low', when it's reference input rises above 2.495 (typical) volts.
    Connect the reference input to your analog signal, and the output to +5v,
    via a resistor, and this gives an inverting output, which otherwise just
    about meets your specification, and is small, and cheap. It might be a
    solution.

    Best Wishes
     
  10. John Fields

    John Fields Guest

    ---
    Try this: (View in a non-proportional font like Courier)

    +5V>-------+---------+--------+
    | | |
    | | [1k]
    | | |
    | +---|-[100K]-+
    | | | |
    VIN>--[1K]-------+--|+\ |
    | | >------+-->VOUT
    [10k]<--+--|-/ LM393
    | | |
    | | |
    GND>-------+-----+---+----------->GND


    Adjust the switching voltage with the 10k pot and be sure to ground
    the inputs and the output of the other comparator.
     
  11. Mook Johnson

    Mook Johnson Guest

    looks good but omit the connection from vin- to ground.


     
  12. John Fields

    John Fields Guest

     
  13. Ben Bradley

    Ben Bradley Guest

    You might be. If the "analog" value switches between 0 and 5V, you
    could 'almost' do a direct connection. For a true TTL input I might
    use 100 ohms in series with the 'analog' and the TTL.

    Perhaps the best (and more expensive) way to do this is with a
    comparator, where you can decide between inverting and non-inverting,
    and adjust the voltage where it switches between 0 and 1. If noise is
    a problem that you want to reduce or eliminate in the TTL input, you
    can set up positive feedback in the comparator to create hysteresis
    (it may switch to 1 when the voltages goes over 3V and to 0 when the
    voltage goes below 1V).
     
  14. Rich Grise

    Rich Grise Guest

    Probably the one I've marked with the '*'s.
    I've also crossposted this to sci.electronics.basics, because
    others could benefit from the discussion so far, and it kinda
    belongs there anyway. :)

    Incidentally, John - I noticed your hysteresis feedback, and
    I concur, albeit one might have to do some calculations to
    get a specific amount. To my techie eye, it looks like
    about 1%, which is definitely enough to keep it from
    osculating[sic]. ;-)

    Cheers!
    Rich
     
  15. dimention11

    dimention11 Guest

    Hi guys
    thanks for all the help.
    after looking a bit more closely at my system. i discovered some extra
    specifications i will need.

    when system is low output voltage must be 0v or as close as I can get it.
    this is very important...

    at the moment i think i will go with John fields idea using a lm311
    ---------------------------------------------------------------
    +5V>-------+---------+--------+
    | | |
    | | [1k]
    | | |
    | +---|-[100K]-+
    | | | |
    VIN>--[1K]-------+--|+\ |
    | | >------+-->VOUT
    [10k]<--+--|-/ LM393
    | | |
    | | |
    GND>-------+-----+---+----------->GND


    Adjust the switching voltage with the 10k pot and be sure to ground
    the inputs and the output of the other comparator.
     
  16. Pooh Bear

    Pooh Bear Guest

    There should be a high value resistor from the - input of the LM311 to grund (
    say 100k ) not a link.

    Graham
     
  17. John Fields

    John Fields Guest

     
  18. John Fields

    John Fields Guest

    ---
    No, that's an error. Sorry about that. It should look like this:

    +5V>-------+---------+--------+
    | | |
    | | [1k]
    | | |
    | +---|-[100K]-+
    | | | |
    VIN>--[1K]-------+--|+\ |
    | | >------+-->VOUT
    [10k]<-----|-/ LM393
    | |
    | |
    GND>-------+---------+----------->GND

    Also, if you want the output _very_ close to ground you could raise
    the value of the pullup resistor in order to decrease the collector
    current in the comparator's output transistor. What are you planning
    on driving with the comparator.
     
  19. dimention11

    dimention11 Guest


    this is for driving the ttl modulation for a laser driver,
    when input is low laser is on when high it is off

    at the moment it does not switch to full power for some patterns (laser
    graffix/display/show system).
    i want it to be either on(full power) or off, and not have a variable power.

    on the laser driver I can switch (invert) so 5v is on and 0v is off.
    so i will have a look at inverting the signal and using an inverting
    comarator to see if this gives me more power when on.
     
  20. Rich Grise

    Rich Grise Guest

    I'd say, if you want it that hard on and hard off, and _FAST_, I'd put
    some kind of HCMOS buffer after the comparator. The thing with a naked
    comparator is that when the open-collector turns off, the rise time is
    dictated by your pullup resistor and the capacitance of the laser's input.
    With a (an?) HCMOS buffer, it'll go within millivolts of the rails within
    nanoseconds. HCMOS is kewl! ;-)

    Good Luck!
    Rich
     
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

-