Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Koyo Incremental Rotary Encoder


  • Please log in to reply
6 replies to this topic

#1 MSE

MSE
  • Members
  • 4 posts

Posted 15 December 2012 - 04:11 PM

Hi, I recently purchased a U3-HV and a Koyo TRDA-20N Incremental Rotary Encoder to use to read angles and angular velocity for a project. I am not an electronics so a lot the lingo seems like a foriegn language to me, hewever, I wired and configured it the best I could uning the users manuals and my limited understanding of this stuff. The encoder is 1000ppr with totem pole (push pull) output. I checked with the guys at Lab Jack before I purchased it and they verified that it would work with the U3 based on the spec. sheet. I wired it as follows: OUTA > FIO4 w/ 10kohm resistor OUTB > FIO5 w/ 10kohm resistor OUTZ > FIO6 w/ 10kohm resistor 0V > GND w/ 10kohm resistor Power Supply > External 18V DC Power Supply Shielded Ground > Power Supply Ground In the LabJack Control Panel, I configured it as follows: Pin Offset = 4 # Timers = 2 Time Clock Base = 48 Mhz Timer 0 Mode = quad Timer 1 Mode = quad Counter 0 = enabled Under Digital State, FIO4, FIO5, and FIO6 are checked (high). I used the same values to configure in test but I am not sure what to look for to tell if it is set up correctly. FIO4, 5, and 6 are gray and values for Timer0, Timer 1, and Counter 0 are all zero. In LJStreamUD, I have it set up as shown in the attached screen shot. This is where I am really lost. I found that I should use channels 200, 201, and 210, but I am not sure which lines or colums to put them in. I was expedting to be able to se a # of counts in the graph and watch it change as I rotate the encoder shaft, but the y axis is amplitude and the graph looks like a lot of noise. I'm sure the problem is something that I am doing as I am a complet novice. Any help from someone experienced with this would be greatly appreciated.

Attached Files



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 16 December 2012 - 08:13 PM

Found the datasheet here:

http://www.koyoencod...df/TRDA_20N.pdf

Sounds like you have the "RZ" output option (TTL output)?

Looks like you can just power it with 5 volts, so I would connect as follows with no resistors:

A => FIO4
B => FIO5
Common => GND
Vcc => VS

Then go into the test panel in LJControlPanel. Put in the settings you listed, except that you don't need a Counter so can leave them disabled. Now on the test panel you should see counts on Timer0/1 as you turn the encoder.

#3 MSE

MSE
  • Members
  • 4 posts

Posted 18 December 2012 - 05:41 PM

Thank you very much for the help!! After switching to the LJ's voltage supply, it started counting, which was a major milesone for me. Unfortunately, after playing around with it for a while, I have a lot more questions. I hope this is not too much trouble for you. First, the encoder does have the Z phase output and I am hoping to use it. I attached the outZ wire to FIO6 and configured counter 0. This verified that it is working as it actually counted. I read about the Z phase in the users manual and I am having a difficult time understanding it. Also, I don't know how to do what the manual says. It says to set bit 15 to one and set bits 0 thru 4 to the DIO number that Z is connected to. Can this be done in LJStreamUD or do I need some other software to do tis? Or, does it require programming? Also, it says to set the timer for the Z line to 32779. How is this done? Would this value be the same for the encoder that I am using? Finally, the way that it counts is somewhat puzzlinng to me. Specifically, then the encoder is rotated in the CW direction to the point that the count reaches zero, it then jumps to approximately 65000. Also, when rotated in the CCW direction, when it reaches that value, it then starts back over at zero. Is this possibly some type of maximum value? Is this what it is supposed to do? Will it do this when Z phase support is enabled? Again, thanks for your support. I would still be pulling my hair out if you guys weren't available and I really appreciate the help.

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 20 December 2012 - 08:36 AM

Are you seeing the rollover at 65535 (2^16) in the test panel in LJControlPanel, or just in LJStreamUD? Confirm that in LJControlPanel it can count to much higher numbers. In stream mode, note that channel 200 just reads the lower 16 bits of the timer Value, and channel 224 reads the upper 16 bits of timer Value. To get the full 32 bits you need to take Ch200 + 2^16*Ch224. A timer has a Value associated with it. When you configure the timer you write the Value and that generally has meaning about the configuration. Later if it is an input timer mode you read the Value whenever you want to know the timer reading. Section 2.9.1.8 says that to enable Z-phase you need to set bit 15 of the configuration timer Value and set bits 0-4 to signify the DIO number. A decimal 6 is 110 in binary, so that means Value = b1000000000000110 which is 32774 in decimal. The test panel in LJControlPanel does not let you write the Value when you configure the quadrature mode timers, so you can't try it there. The config defaults section of LJControlPanel also does not let you specify Value for quadrature, and that is what you need to use LJStreamUD. I will ask someone else about changing LJControlPanel to allow specifying Value for any applicable timer modes.

#5 MSE

MSE
  • Members
  • 4 posts

Posted 24 December 2012 - 11:24 AM

Are you seeing the rollover at 65535 (2^16) in the test panel in LJControlPanel, or just in LJStreamUD? Confirm that in LJControlPanel it can count to much higher numbers. In stream mode, note that channel 200 just reads the lower 16 bits of the timer Value, and channel 224 reads the upper 16 bits of timer Value. To get the full 32 bits you need to take Ch200 + 2^16*Ch224.

A timer has a Value associated with it. When you configure the timer you write the Value and that generally has meaning about the configuration. Later if it is an input timer mode you read the Value whenever you want to know the timer reading.

Section 2.9.1.8 says that to enable Z-phase you need to set bit 15 of the configuration timer Value and set bits 0-4 to signify the DIO number. A decimal 6 is 110 in binary, so that means Value = b1000000000000110 which is 32774 in decimal.

The test panel in LJControlPanel does not let you write the Value when you configure the quadrature mode timers, so you can't try it there. The config defaults section of LJControlPanel also does not let you specify Value for quadrature, and that is what you need to use LJStreamUD. I will ask someone else about changing LJControlPanel to allow specifying Value for any applicable timer modes.


I'm only seeing the rollover in LJStreamUD and the counter works as expected. It is not so much the rollove at the top end that is troublesome, it is that the counter goes up to 65535 when the encoder is rotated CW to the point that you would expect the counter to turn negative, as it does in LJControPanel. However, I think I can overcome this obstacle by manipulating data in a spreadsheet.

For Z-Phase, I was also able to manipulate data in a spreadsheet to get the desired result, but it would be nice if I could get LJStreamUD to handle it for me. I under stand what you are saying above, except for the "b". However, I don't know how to set the timer configuration value. Can you explain how to do this?

#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 26 December 2012 - 12:47 PM

It is not so much the rollove at the top end that is troublesome, it is that the counter goes up to 65535 when the encoder is rotated CW to the point that you would expect the counter to turn negative ...

Are you doing a read of channel 200 followed by 224 and then calculating Ch200 + 2^16*Ch224? If you are just looking at the value of channel 200 you are just getting the lower 16-bits of the signed 32-bit timer.


I under stand what you are saying above, except for the "b".

It is just a nomenclature used to specify that a number is binary. For example:

b1111111 = d255 = hFF


However, I don't know how to set the timer configuration value. Can you explain how to do this?

What I was trying to say is that neither LJControlPanel nor LJStreamUD let you specify the configuration Value for a quadrature Timer, so we are looking at whether we can change LJCP for you to have that ability in "config defaults" and "test".

#7 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 27 December 2012 - 05:18 PM

LJControlPanel has been updated so you can set the configuration value for the quadrature Timer in both the Defaults and Test panels. It is available here, version 2.29:

http://labjack.com/s.../ljcontrolpanel

Let us know if you find any problems with the update.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users