# analog to ttl

D

#### dimention11

Jan 1, 1970
0
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...

J

#### John Popelish

Jan 1, 1970
0
dimention11 said:
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...

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?

L

#### Luhan Monat

Jan 1, 1970
0
dimention11 said:
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...

D

#### dimention11

Jan 1, 1970
0
John Popelish said:
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?

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

D

#### dimention11

Jan 1, 1970
0
Luhan Monat said:

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...

C

#### Clive Tobin

Jan 1, 1970
0
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.

J

#### John Popelish

Jan 1, 1970
0
dimention11 said:
I will want this to switch from approx 2v to on(5v)
if this can be adjusted it would be even better.
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.

P

#### Pooh Bear

Jan 1, 1970
0
Clive said:
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.

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

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

R

#### Roger Hamlett

Jan 1, 1970
0
dimention11 said:
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...
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

J

#### John Fields

Jan 1, 1970
0
I will want this to switch from approx 2v to on(5v)
if this can be adjusted it would be even better.

---
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.

M

#### Mook Johnson

Jan 1, 1970
0
looks good but omit the connection from vin- to ground.

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

---
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.

J

#### John Fields

Jan 1, 1970
0
John Fields said:
dimention11 wrote:
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...

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?

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

---
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.

B

Jan 1, 1970
0
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...

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).

R

#### Rich Grise

Jan 1, 1970
0
John Fields said:
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...

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?

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

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.
looks good but omit the connection from vin- to ground.

Probably the one I've marked with the '*'s.
And please bottom post. It makes it much easier to follow a
discussion.

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

D

#### dimention11

Jan 1, 1970
0
dimention11 said:
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...
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.

P

#### Pooh Bear

Jan 1, 1970
0
dimention11 said:
dimention11 said:
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...
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.

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

Graham

J

#### John Fields

Jan 1, 1970
0
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...

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?

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

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.
looks good but omit the connection from vin- to ground.

Probably the one I've marked with the '*'s.

J

#### John Fields

Jan 1, 1970
0
dimention11 said:
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...
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.

---
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.

D

#### dimention11

Jan 1, 1970
0
John Fields said:
dimention11 said:
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...
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.

---
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.

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.

R

#### Rich Grise

Jan 1, 1970
0
[snip circuit]
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.

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

L
Replies
27
Views
2K
Rich Grise
R
D
Replies
12
Views
1K
Duane
D
Replies
6
Views
247
Replies
3
Views
386
Replies
15
Views
821