Previous in Forum: Network Cabling Question (Retro Stuff)   Next in Forum: Where Does a Cell Tower Get Its Coordinates From?
Close
Close
Close
16 comments
Rate Comments: Nested
Power-User
Hobbies - Automotive Performance - New Member Hobbies - CNC - New Member

Join Date: Jun 2008
Location: Long Island, NY
Posts: 326
Good Answers: 1

Line Driver to Micro Controller

08/04/2010 12:24 PM

Hello all,

I recently purchased an encoder with a 5 VDC Line driver output. I wanted to hook it up to an atmega 2560 micro controller. Does any one know how this can be done.. Please help

Thanks

__________________
It is better to fail in originality than to succeed in imitation.
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Good Answers:

These comments received enough positive votes to make them "good answers".
Anonymous Poster
#1

Re: Line Driver to Micro Controller

08/04/2010 12:48 PM

Please look at the encoder datasheet.

Register to Reply
Power-User
Hobbies - Automotive Performance - New Member Hobbies - CNC - New Member

Join Date: Jun 2008
Location: Long Island, NY
Posts: 326
Good Answers: 1
#2
In reply to #1

Re: Line Driver to Micro Controller

08/04/2010 1:33 PM

I already looked at the encoder data sheet, that is why I am asking a question here. The data sheet does not say anything about connecting it to a micro-controller. If any one knows how to convert a differential line driver output to a TTL that the mc accepts, please let me know.

__________________
It is better to fail in originality than to succeed in imitation.
Register to Reply
Guru

Join Date: Jul 2008
Posts: 1688
Good Answers: 145
#3

Re: Line Driver to Micro Controller

08/04/2010 2:23 PM

You are a little weak on details so take all this with a grain of salt.

Your second posting (post #2) suggests to me that the output can be +5V/GND or GND/+5V. You need to confirm from the data sheet that this is true.

The most straightforward solution is to use a differential line receiver chip. If your uC is a +3.3 V controller then you either need a receiver with +3.3/gnd outputs or you need uC pins that are +5V tolerant.

If you are trying to keep your cheap chip count low then....

If above is true then one line switches back and forth between +5 and gnd based upon data. I have never split apart differential lines like this but you could probably use one of then as a +5V/gnd signal. If you need to comply with +3.3V inputs then CONSIDER (I didn't say that it would work for your circuit) using a series resistor and a clamping diode to +3.3V.

Everything above relates to voltage level compatibility. You still need to deal with timing, interrupts, polling, understanding the signal encoding, etc.

Bruce

__________________
Few things limit our potential as much as knowing answers and setting aside questions.
Register to Reply
Power-User
Hobbies - Automotive Performance - New Member Hobbies - CNC - New Member

Join Date: Jun 2008
Location: Long Island, NY
Posts: 326
Good Answers: 1
#4
In reply to #3

Re: Line Driver to Micro Controller

08/04/2010 3:51 PM

I am trying to accomplish this without a receiver. The encoder outputs a constant 5vdc (GND/+5v) using a line driver 26LS31 which is compatible with a an RS-422A cable.

I am using an Atmega2560 uC which is +5V tolerant.

Is there a simple circuit that I can build myself to get single ended output? I do not have time to buy the compatible line receiver. Can you link me to any resources.

Thanks.

__________________
It is better to fail in originality than to succeed in imitation.
Register to Reply
Guru

Join Date: Jul 2008
Posts: 1688
Good Answers: 145
#5
In reply to #4

Re: Line Driver to Micro Controller

08/04/2010 4:02 PM

I think you have two single ended outputs. One is the inverse of the other. Used as a pair they are differential.

__________________
Few things limit our potential as much as knowing answers and setting aside questions.
Register to Reply
Power-User
Hobbies - Automotive Performance - New Member Hobbies - CNC - New Member

Join Date: Jun 2008
Location: Long Island, NY
Posts: 326
Good Answers: 1
#6
In reply to #5

Re: Line Driver to Micro Controller

08/04/2010 4:20 PM

One is indeed the inverse of the other. The data sheet is on the link below. I checked the outputs on a scope and all I see is a constant output of 5 Volts on both the A and NOT A lines. Am I not supplying the voltages correctly? I am connecting a regulated 5VDC from my uC to the power source (brown wire) and the ground to the shield.

The second page has the wave form line driver output option.

Thanks for you input.

http://www.worldencoders.com/products/pdf/trda_sh.pdf

__________________
It is better to fail in originality than to succeed in imitation.
Register to Reply
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#11
In reply to #6

Re: Line Driver to Micro Controller

08/05/2010 9:24 AM

Why are you connecting only to shield?

The 0 volts goes to blue and 5 volts goes to brown....

If the shield is also to be connected to 0 volts I cannot say......but that is probably correct.

You should look at the diagrams more carefully....

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply
Power-User
Hobbies - Automotive Performance - New Member Hobbies - CNC - New Member

Join Date: Jun 2008
Location: Long Island, NY
Posts: 326
Good Answers: 1
#7
In reply to #5

Re: Line Driver to Micro Controller

08/04/2010 4:27 PM

I understand why I am getting Constant High volatge. "Output signal turns to "H" level when the cable or connector is disconnected." page 2

I just need to know if you think i can use the inputs as single ended and if so how>

__________________
It is better to fail in originality than to succeed in imitation.
Register to Reply
3
Guru

Join Date: Jul 2008
Posts: 1688
Good Answers: 145
#8
In reply to #7

Re: Line Driver to Micro Controller

08/04/2010 5:04 PM

I sounds like we both agree on the fundamentals of what you are doing. Also, neither one of us is 100% on top of it. Therefore, I suggest the following:

Take one output and load it with a 10 Kohm resistor to ground. Look at it with an oscilloscope. If the waveform seems to look like and behave like the data sheet drawing then I would think that you are in good shape. I don't know what load is a "best choice", but for a quick experiment 10 Kohm should be a good start.

I don't know what you are doing but ESD and other sources of voltage spikes can make a uC very unhappy (and you too). Consider clamping diodes and any other form of protection that might be appropriate.

Bruce


P.S. Keep in mind that I am pulling this out of thin air while I take a short break from my other tasks. If anything fails the "sanity test" then remember that I might be wrong.

__________________
Few things limit our potential as much as knowing answers and setting aside questions.
Register to Reply Good Answer (Score 3)
Power-User
Hobbies - Automotive Performance - New Member Hobbies - CNC - New Member

Join Date: Jun 2008
Location: Long Island, NY
Posts: 326
Good Answers: 1
#9
In reply to #8

Re: Line Driver to Micro Controller

08/04/2010 5:41 PM

I did as you suggested and I see wave form. And the frequency is 360 Hz from one channel is exactly what I need so it seems to work fine after all.

Thanks for your suggestions. Thought they might be pulled out of thin air, they were still very helpful.

__________________
It is better to fail in originality than to succeed in imitation.
Register to Reply
Guru

Join Date: Jul 2008
Posts: 1688
Good Answers: 145
#10
In reply to #9

Re: Line Driver to Micro Controller

08/04/2010 5:46 PM

The air in Florida is pretty good.

The water sometimes has too much oil in it ... that has already been covered in other postings.

__________________
Few things limit our potential as much as knowing answers and setting aside questions.
Register to Reply
Power-User

Join Date: May 2010
Location: Cambridge, MA
Posts: 390
Good Answers: 82
#12
In reply to #4

Re: Line Driver to Micro Controller

08/07/2010 9:32 AM

The official 26LS31 parts made by several companies have long been discontinued, although they have been replaced by parts that do the same thing. According to the 26LS31 datasheet, each of its EIA-422 outputs comprises two TTL signals with one signal inverted from the other. The 26LS31 has four such dual-output drivers. I'd expect that your encoder will use two sets of them.

The datasheet defines its logic LO output as less than 0.5V and its HI as greater than 2.5V, which are classic TTL levels. I imagine the maximum HI will be under 4 volts.

Presumably you have a ground connection available along with the balanced signals. You should be fine simply taking ground and one side (e.g., the + side) from each of the balanced signal pairs for your microcontroller quadrature encoder input.

Please excuse the 26LS31 drawing from the original Signetics datasheet - it's very poorly done. The true output from the dual-output driver looks more like a three-state input, at least to those of us used to looking at such things.

__________________
Thanks, Win
Register to Reply
Power-User
Hobbies - Automotive Performance - New Member Hobbies - CNC - New Member

Join Date: Jun 2008
Location: Long Island, NY
Posts: 326
Good Answers: 1
#13
In reply to #12

Re: Line Driver to Micro Controller

08/07/2010 4:12 PM

Thanks Winfield:

I actually ordered the line driver ciruit by mistake. I just wanted a single ended output and I was able to get it from a sigle channel. I reliazed later I had the been using the wrong wire as ground. However, as I mentioned in another post, in this group in the electircal engineering fourm: http://cr4.globalspec.com/thread/58298/Possible-Causes-for-Error-in-an-Incremental-Encoder

I am having problems with the signal I am getting. I was not sure if this is caused by the 26LS31 Line driver in the encoder, others have suggested it might be an alignment problem. I would very much like your expert opinion on it.

In addition, when supplying the encoder with a 4.89 VDC/ 0.6mA from my microcontroller, the output signals are in the levels of 3.25 Volts. It does not cause any problems in triggering, but I do not understand why there is such a huge drop. Is the amperage too low.

Thanks agian for all your comments.

__________________
It is better to fail in originality than to succeed in imitation.
Register to Reply
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#14
In reply to #13

Re: Line Driver to Micro Controller

08/07/2010 4:42 PM

You wrote:-

I realized later I had the been using the wrong wire as ground.

I told you that in post #11 I believe, wasn't that difficult to see!!

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply
Power-User
Hobbies - Automotive Performance - New Member Hobbies - CNC - New Member

Join Date: Jun 2008
Location: Long Island, NY
Posts: 326
Good Answers: 1
#15
In reply to #14

Re: Line Driver to Micro Controller

08/07/2010 4:47 PM

Yes, yes. I missed your post but thanks a lot.

__________________
It is better to fail in originality than to succeed in imitation.
Register to Reply
Power-User

Join Date: May 2010
Location: Cambridge, MA
Posts: 390
Good Answers: 82
#16
In reply to #13

Re: Line Driver to Micro Controller

08/07/2010 7:14 PM

3.25 volts is fine. The drawing shows a typical TTL-style totem-pole inverting-gate output stage (actually a NAND gate in this case: both inputs have to be HIGH for the output to go LOW). If you imagine a LO input, and follow the circuit for a logic HI output, you see R2 pulling up V3. So we have a Vbe drop of about 0.7 volts, plus another similar drop across the diode-connected isolating-transistor V5 to the output, so we have 4.89 - 1.4 = 3.49, which is pretty close to what you observed.

BTW, the 26LS31 will want more than 0.6mA for its operating current. I can't speak for the encoder, but I'd imagine it needs to draw more current as well.

__________________
Thanks, Win
Register to Reply
Register to Reply 16 comments

Good Answers:

These comments received enough positive votes to make them "good answers".
Copy to Clipboard

Users who posted comments:

Andy Germany (2); Anonymous Poster (1); BruceFlorida (4); Economist (7); Winfield Hill (2)

Previous in Forum: Network Cabling Question (Retro Stuff)   Next in Forum: Where Does a Cell Tower Get Its Coordinates From?

Advertisement