Shop OBEX P1 Docs P2 Docs Learn Events
Backround Counter — Parallax Forums

Backround Counter

Danny22Danny22 Posts: 29
edited 2006-03-05 20:06 in Robotics
Other than the PWM/Pal does anyone of a single IC 8-Bit Counter with a serial output, preferably I2C or clocked synchronous. I want to use them as a Backround Counter for my robot's wheel encoders. I built a hardware version using counters and shift registers that works great with my BS2P, but a single chip solution would be better.

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-04 00:58
    Danny22 -

    Generally chips which manage encoder counts have a good deal more than just 8 bits. Here are a number of IC's used with encoders to maintain the counts and process the quadrature encoding from the wheel encoders:
    http://www.usdigital.com/products/ics.shtml

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Danny22Danny22 Posts: 29
    edited 2006-03-04 21:17
    Thanx Bruce for responding. The scheme I'm using is a simple single channel encoder. The encoder dick has 32 segments,the wheel motors run 1.4 revs/sec at full speed , the PID loop runs at a modest 1000Ms and the counters are reset at the end of the loop, therefore the counters only have to count to 44.8 (45). This assumes I haven't overlooked something which is more than likely.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-04 23:22
    Danny -

    So these encoders are just used as odometers?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Danny22Danny22 Posts: 29
    edited 2006-03-05 06:22
    Bruce-

    Well, what I've been doing is converting the counter output to RPM's (count per sec * 60 sec / 32 segments) comparing that to the speed set point and adjusting the left and right speed input to the motor drivers to maintain equal speed in the forward and reverse directions. I also accumulate the running count total and save it in a RamPackB 32K to be converted to distance data. My jury rigged hardware counters are ok but I still get some jitter even after some digital filtering, however I think some of this is mechanical which I need to attend to.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-05 07:12
    Danny -

    Okay, now I see what you're doing. You're using the wheel encoders as wheel speed tachometers, rather than using a motor tachometer and dividing down by the gearing. Unfortunately by using the system you're using, you ended up "cheating" yourself. Had you used quadrature encoders at the wheels, you could have had both speed AND direction! With only the single channel you have, you've got wheel speed, and that's it.

    Perhaps obviously, or perhaps not, the chips I indicated earlier are used on quadature encoder systems for maintaining counts and direction. All you need for this use, is any 8-bit (octal) up-down counter with reset. I'm sure one of the hardware gurus will know the number of same, right off the top of his/her head.

    8 bits will give you a count of 0-255 revs which is more than enough for your purposes. Chances are better than even that you won't find one with a serial output, so just connect the 8-bit, binary output to a parallel-in ==>> serial-out shift register, and use SHIFTIN to grab the counts when you need them. After grabbing the count, hit the RESET line, and you're zeroed out, and ready to go again.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Danny22Danny22 Posts: 29
    edited 2006-03-05 20:06
    Bruce-
    The hardware counters that I built are exactly what you recommended. I have two 74HC4520 synchronous counters connected to two 74HC165 shift registers and it works fine but I was interested in reducing my chip count. In terms of quadrature encoders, I've always wondered : If I command the robot to move forward why do I need chan B of a quad encoder to tell me the direction that I already know! I'm kind of new at this so please teach me; I joined this forum to learn.

    Thanx,
    Danny
Sign In or Register to comment.