Announcement

Collapse
No announcement yet.

Stand alone Rotary Encoder and digital port

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

  • Stand alone Rotary Encoder and digital port

    I purchased a rotary encoder to try out thinking I might get my team looking at different feedback ideas. One idea I saw was for non driven wheels. For that purpose it seems using a motor encoder port is a reasonable thing to use. For other uses, maybe feedback for a continuous rotation servo it would be better to not use up a motor encoder port and use a digital port instead.

    In testing I have found the encoder seems to work on the motor encoder port. When placed on the digital port it appears to work if you rotate the encoder slowly enough, but at any reasonable speed it appears the update rate is inadequate. I've emailed REV to see if the digital port has hardware interrupt capability. Of course it isn't useful until the SDK supports it in some way.

    Or am I missing a bet and that I should be able to see a higher rate of transitions? The encoder has 600 ppr, so 2400 edges per rev, about 4khz with a 100 rpm motor.
    I have a frequency generator at school, I'll try to see what frequency I can reliably read tomorrow.

    encoder -
    https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1

    I wrote a quick program to look at loop times in linearOpMode. Doing nothing other than getting the time difference and sending a teleop message the loop time is under 10 microseconds. Putting the loop timer in the program reading a digital input the loop time goes up to just under 10 milliseconds. I seem to recall that linear makes sure it has an update from whatever before continuing, so if true digital inputs are being read/updated at a little better than 100 hz.

    PS - official forum rules #2 sensors section looks using the encoder is legal.

  • #2
    The Hub's CPU does support hardware interrupts, in fact two of the motor encoder ports are run from software. You are never going to be able to read a quadrature encoder from the SDK by polling the digital ports. Simply too much latency. Your options are to use spare encoder ports from motors that don't need encoders, add an extra MR controller solely to read the encoders, or beg the GDC to allow the setup of using a dedicated quadrature encoder counter board in conjunction with an I2C to SPI bridge. (The counter boards all use SPI - it seeks that a native I2C counter does not exist.)

    Comment


    • #3
      Miscellaneous Robot Electrical Parts and Materials, post #3 says spi to i2c modules are allowed.
      So something like this counter -
      https://www.superdroidrobots.com/sho...MaAhiAEALw_wcB


      I'll make sure and post a question to the rules forum if we ever wind up going the counter/bridge route, but the rule says any compatible sensor, and the counter board is sensing pulses.

      Comment


      • #4
        Originally posted by 3805Mentor View Post
        Miscellaneous Robot Electrical Parts and Materials, post #3 says spi to i2c modules are allowed.
        So something like this counter -
        https://www.superdroidrobots.com/sho...MaAhiAEALw_wcB


        I'll make sure and post a question to the rules forum if we ever wind up going the counter/bridge route, but the rule says any compatible sensor, and the counter board is sensing pulses.
        I was the one who asked the GDC about the SPI bridge hahaha :P

        But, that was in the context of <RE12-C> (using it to control an LED strip). If not being used to control an LED strip, I think it falls under <RE17>.

        Comment


        • #5
          4634 Programmer do you know which specific ports are on software and hardware? What is the difference?

          Comment


          • #6
            Originally posted by FTC12676 View Post
            4634 Programmer do you know which specific ports are on software and hardware? What is the difference?
            I do not know. I'm REV would tell you if you asked, though.

            Comment

            Working...
            X