Announcement

Collapse
No announcement yet.

Absolute Encoder Programming

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • Absolute Encoder Programming

    Greetings all!

    I am a relative newbie in regards to PLC programming, and a complete Noob with encoders. (I have only used PLCs in the past with switches to do basic controls). So, apologies if this is a silly question.

    First off, I have a DL05 and a 256res Absolute Encoder.

    My project is a moving theatrical stage platform that simply moves up and down stage to three positions.

    I would like the operator to be able to push one button for a desired position, and depending on the position of the encoder, the PLC will determine which direction to move, and when to stop once it has reached the desired position.

    Ramping and breaking of the motor, and speed control are already taken care of, I just need some help with the programming.

    How do I get the grey code to provide me with a usable number that I can (what I think is the easiest option) use a < or > to determine which way to move.

    Please remember I am still new to this, I have little experience with much beyond simple switching and some timers, but understand some basics.

    THANKS SO MUCH!


  • #2
    The DL05 supports the Gray instruction which converts the Gray value to a BCD value which can be used for comparisons.
    thePLCguy

    Bernie

    Comment



    • #3
      Hey bcarlton,

      That is exactly where I get stuck.....do you know of anyplace where I might be able to find some example programs using grey code? I have done some searching online and come up with very little.

      Thanks!

      Comment



      • #4
        Your encoder will take all 8 inputs of the PLC. Will you be adding an additional IO card for the operator pushbuttons?

        As far as the programming goes. You will need to translate the inputs to the Vmemory address. this can be found on page 3-30 of the DL05 User Manual.

        This memory address is what you would use in the GRAY instruction.
        If you have an urgent issue, please contact AutomationDirect's Technical Support team.

        AutomationDirect.com Technical Support: 1(800) 633-0405 or (770) 844-4200 Email Tech Support

        Comment



        • #5
          You seemed to say you had everything taken care of except for the Gray conversion and that instruction does it.

          LD Gray value (presumeably from inputs)
          GRAY
          OUT BCD version of the Gray number

          Then use the converted number as you suggested.

          They only part where Gray code exists is in loading it from the inputs then converting it. After that you can forget that you ever started with Gray code.
          thePLCguy

          Bernie

          Comment



          • #6
            Come to think of it I'm a little confused by the description of the GRAY instruction. It says that it converts 'a 16 bit Gray code' (That should have been a capitalized 'G' in Gray since it is a person's name). Then it talks about setting the upper 22 bits to zero. It discusses 512 and 1024 count Gray code encoders, but obviously it can convert any lower count Gray encoder. So, can it convert Gray encoders with 11-16 bits? I could see a limit 0f 8192 to keep the BCD lower than 9999 - that would be a 14 bit encoder. The programming example shows 16 bits being loaded from inputs.

            is there any clairification of this instruction and its limits?
            Last edited by bcarlton; 02-21-2012, 06:16 PM.
            thePLCguy

            Bernie

            Comment



            • #7
              I need a Little More Imformation..

              Your Absolute Encoder.. How many Revolutions does it make?.. One for a Full Up Down, or is it Many.. as this will tell 'Us' ( Me ) what the Absolute Position Number Size will be.. is it 0-255 or with Many Revolutions, a Bigger Number.

              Then.. For the Guts of the Program, you need to have THREE, Series Greater than and Less than Switchs to give a 'Window' that the Three Floors can be at.. The Width of the Window ( 15 in this Case ) will allow the Carrage to Coast a little.. you will have to talyor it to your needs..


              First
              Reset C100, reset C200, Reset 300

              Than get Encoder Read and Set Flags
              If the Output is Greater than 10 but less then 15, then we are at Floor 1 then Set C100 Flag

              If the Output is Greater than 100 But less then 115, then we are at Floor 2, then set C200 Flag

              If the Output is Greater then 200 But less then 215, then we are at floor 3, set C300 Flag.

              The Motion is Fairly Simple..

              Button Push at c100 set, then go up.. set c50 ( Travel Up Flag ) reset C75 ( Travel Down Flag.
              Button Push at C200 and C50 Set, then Travel Up
              Button Push at C200and C75 Set then Travel Down
              Button Push at c300 set then Travel Down, Reset C50, Set C75

              Will need to set a Trap to let the Push Button 'Press' keep the Carrage Moving untill the 'Floor Flag' is Cleared.. Else the Player will have to keep the Button pressed untill off of the Floor Switch..

              Cap

              Comment



              • #8
                Few more Questions have come to mind..

                Why a Grey Encoder?.. is it already there?.. as a Standard Quadrature Encoder will work for Movement, and with retentive Memory on the PLC, the Location of last Position can be stored in Memory during Power Off.. as long as the Carriage does not move during Power Off Conditions all will be well..

                Why an '05, an '06 is better suited to the Grey Scale Encoder, because of the Inputs.. and the LCD screen ..

                What is the Carriage.. is it a 300 LB plywood thing riding on a Garage Door Opener?.. or is it a 10,000 Lb built in stage With a 10 Hp motor?..

                What is the Over-travel Safety?.. is there one?.. what will happen when it misses the 'Stop Position' will someone get Dropped or Killed?..

                I'd like to have a little More info on the Behind the Scene stuff on this..

                Sounds Fun.. Except for the Stress of Deadlines.. BTDT

                Cap

                Comment



                • #9
                  In over my head...

                  Hey Cap & bcarlton,

                  Thanks so much for the replies. You are confirming what I have been feeling all along; I am in over my head. I have used PLCs in the past for simple control of cue lights and things like air cannons....but now the encoder issue is getting to me.

                  Our selection of equipment was based on what was already in stock, and what we could afford. So we were stuck working with what we had; and of course the person in the know is gone, and I am the only one with any knowledge, so I got stuck with the project even after expressing my lack of knowledge.


                  The platform is a 16x14 steel and plywood castered band platform being moved with 1.5hp (I believe) motor and freq. drive.

                  If it misses it's stop position, nobody drops or dies.....it just runs into a wall. However, there are eyes on it at all moving times, and there are over-travel limit switches.



                  So....now to ask a favor. I have attached my current ladder. Can you take a look and see what I am missing. I currently can not get the encoder to spit out anything. I am hoping I am missing something simple....but am more convinced I am just way off base.


                  Also, with the encoder connected to the PLC, shouldn't I see the input lights lighting up? I am currently getting nothing.


                  I am using the TRD-NA256NWD encoder.
                  www.automationdirect.com/pn/TRD-NA256NWD

                  The PLC is the DL-05 D0-05DR-D
                  http://www.automationdirect.com/pn/D0-05DR-D

                  With the card 10-in card D0-10ND3
                  http://www.automationdirect.com/pn/D0-10ND3

                  The Operator Interface is the C-more EA1-S3ML
                  http://www.automationdirect.com/pn/EA1-S3ML


                  Thanks so much!
                  -Sean
                  Attached Files

                  Comment



                  • #10
                    Originally posted by seansmallman View Post
                    Also, with the encoder connected to the PLC, shouldn't I see the input lights lighting up? I am currently getting nothing.
                    You should be seeing lights on the input card.

                    The encoder you have chosen is NPN type switching. You will need to supply 24volts + and - to the encoder, and connect your bit wires to the PLC inputs.

                    You NEED to wire 24+ to the common terminals of your input card to work with the NPN encoder signals.

                    Hope this helps get you going,
                    Bob

                    Comment



                    • #11
                      For the PLC program zip together ALL the files which begin with 'SMOKEY' and post that. They are all needed to see your program.

                      Do you have some type of wiring diagram we can look at?
                      thePLCguy

                      Bernie

                      Comment



                      • #12
                        I think Bob touched on the Problem..

                        The Encoder is a Switch that will hook it's output to ground.. so the Interface Card will supply voltage to the Encoder Outputs, then when the Encoder wants to 'Turn On an Output' it will actually yank it to ground.. So the 'Common' on the Interface Card needs to be the 24 Volt Supply.. So Co and C1 will hook to the Brown Wire of the Encoder and Tie all of this to the 24 Volt Supply Line..

                        Then the blue of the Encoder is Tied to Comm of the Power Supply .. and the Wires for the Bit Positions hook to Zero through Seven on the Interface Card..

                        Then if you do a load Formated of bits at X100 to X107 ( Not X0 as in the Program ) then Grey it then Out to your Location.. as the Interface Card Bits will show up on X100 to X111

                        Cap

                        Comment



                        • #13
                          Might have made an Error..

                          I ASSumed you hooked the Encoder to the 10 Point Card, rather than the Base I/O of the '05..

                          Where is the Encoder Hooked?..

                          EDIT:.. Looked at the Program.. you have Mutiple OUTs referencing the same Output.. and you are using X Bits where C Bits should be used.. ( They will work.. but hard to understand )..

                          How about you give a Narative as to what you want it to do.. the Outputs avalable ( What do the Y's Actually go to ).. where are the Inputs coming from.. other than the Encoder.. and Generally what you want it to do..

                          AND..... we need to get the Encoder hooked up and do a trial run of the Carrage to see where the Numbers come out..

                          Yes you are in over your head.. Yes I Been there.. That is how you learn.. The Show will go on..

                          Cap
                          Last edited by Cap; 02-23-2012, 01:47 PM. Reason: Looked at Program..

                          Comment



                          • #14
                            So what happens if the encoder makes multiple revolutions and in both a positive and negative direction? Is it possible to know its position and the direction its running?

                            Comment



                            • #15
                              Getting there....I am sure the round about way.

                              Hey guys,

                              First off, thanks so much for your help, I really appreciate it! After I got my primary job (sound and lights) done for this show, I was able to really focus on making the platform move.

                              The good news, we were able to get everything moving to pre-determined positions! Woohoo! Although it works consistently, I have noticed that we are experiencing unwanted drift in our positions. I am assuming that this is coming from movement of the band members causing the encoder to register wiggle on the cable. At the end of about three runs of the show in rehearsal, this has caused us to miss a mark by about 6 inches...acceptable for our purposes, but not ideal.

                              My biggest question is in regard to grey code. I was able to get it to output a number/position of the encoder, but I am wondering if there is a way to make the number continually count up/down instead of cycling thought it's resolution of 0-256. Since I was unable to figure this out, I utilized a up/down counter with one bit of the encoder to give me a position. This method works, but is messy, and I was wondering if there was a better way.

                              So, I am attaching the updated program for some advice/critique. I have also included photos of the set-up including the band platform (sans band) and the motor set-up. You can see the encoder in the gear box of the motor reading the wire that goes into the stage. This is a 2 run, closed loop, wire system that moves the band platform via knives in the floor.

                              Thanks for your thoughts!
                              Attached Files

                              Comment

                              Working...
                              X