FYI Quadrature Enc chip readable from I2C

2,346 views
Skip to first unread message

Mark Johnston

unread,
Apr 2, 2015, 5:28:12 AM4/2/15
to hbrob...@googlegroups.com
After spending quite a bit of web browsing time trying to find (available) Quadrature Encoder interface ICs that are readable over I2C I became a bit frustrated on an arduino based side project of mine. (not fiddlerbot on www.mark-toys.com)

Before you mention it ... yes I do know you can implement interrupt drivers and read edges and do Quadrature device decoding from a processor like Arduino but to me that seems highly prone to erratic behavior in a busy system where you may not be able to guarantee extremely fast ISR latencies due to other real-time needs which I have in this usage case.

So be it to keep myself involved in yet MORE projects or just to play a bit more with PIC products and my PICkit 3 programmer I have been developing a single chip dsPIC30F2010  Qei to I2C interface and will be using it soon on an arduino project.  It seems fairly stable at this time but I am evaluating it and so on.   I'm now actively coding an arduino class to access it rather seemlessly from Arduino projects but that I just started tonight now that the pic code seems ok.

This is not so much an 'announcement' of this ability as it is still in dev mode but rather it is a question to find if others have found integrated solutions (aka:  Solid proven solutions)  for QEI position readback from optical QEI devices over an I2C interface.   I found one a while back but it seems discontinued and I found a kickstarter that seems 'dead' and that is why I took it on myself.   

If you are interested in this problem in general also feel free to comment.  Again, I don't really want to have some religious argument on doing it totally in ISR from the host processor as that can be 'flakey' in systems with a lot going on (slop in ISR latency can nuke your nice plans to do in host software as you miss a beat or two).

The dsPIC30F2010 by the way is priced at under $5 and can come in dip, sip or even 6mm on edge QFN packages so if one really wants 'small' it can be done but I'm using 28-pin dip for proto ease of use.  

Mark Johnston

Chris Albertson

unread,
Apr 2, 2015, 10:27:02 AM4/2/15
to hbrob...@googlegroups.com
Yes, I made something like this but use a "mini" Arduino.  The kind sold on eBay for $2.  Your PIC solution would take even less space.  The ideal solution would be a custom chip that would drive the IR  LEDs with no external parts.  But the little Arduino parts are already small and cheap.

What I'm working on is a higher level of interface.  Not just encoder reading but to drive the motor and place the PID inside.   Then my I2C interface just give high level commands like "run at 0.3 m?s for .03 meters"

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at http://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.



--

Chris Albertson
Redondo Beach, California

Wayne C. Gramlich

unread,
Apr 2, 2015, 10:52:11 AM4/2/15
to hbrob...@googlegroups.com, Wayne C. Gramlich
Mark:

You might want to check out the following vendor:

http://www.lsicsi.com/encoders.htm

US Digital sells some of these chips:

http://usdigital.com/products/interfaces/ics

A number of us in the club have used the LS7366 which is a 32-bit
encoder with an SPI interface. I'm pretty sure I have some left
in my parts drawers. These are DIP parts. Let me know if you
are interested.

The trade-off space of selecting a microcontroller is quite complex.
Unless you are going build thousands of something, the part cost is
really not that important. What dominates the everything is learning
curve -- figuring out the software development chain, understanding
the microcontroller quirks, dealing with cruddy documentation, lack
of decent debugging tools, etc. If you enjoy this stuff, go for it.
If not, I recommend sticking with AVR's for 8-bit and ARM's for 32-bit.

Regards,

-Wayne
[snippage]


P Tiago Pereira

unread,
Apr 2, 2015, 3:32:34 PM4/2/15
to hbrob...@googlegroups.com
Mark:

I have been there, even with interrupts you never know if you miss one or a few. 

Also the things can get problematic if you need to choose between interrupts pins or features (Arduino Leonardo) 

I went with 2 x LS7366R (Wayne Post), the IC takes care the counting/direction, it can work also as single phase counter, the access is done via SPI.

I've attached a photo of my perforated pcb not a professional but hand made in USA :)

Some vendors have min requirements (10 pcs), last year I bought 6 ICs plus shipping i paid $35. 

If you want to buy the same chip but without the hassles of DIY you have at least 2 options:



If you need more details, let me know.

Tiago
photo (1).JPG

Mark Johnston

unread,
Apr 2, 2015, 5:03:00 PM4/2/15
to hbrob...@googlegroups.com

Thanks guys,

The LS7366R was seen earlier and is a nice little chip with 14 pins not being out of the question or something that I could not do.  The LS7366 devices are a nice way to go.   In my specific situation those SPI lines on the Arduino Uno are used already that involve code I am leveraging off of to drive the ardumoto motor drivers and use those same pins.  So I could have gone non-standard and modified the motor driver code and changed my curretly wired but easily changed wiring and so on and that is indeed a viable path.  I'll consider that as a 'backup plan'.    I do like the LS7366 and had I not already had pins in use it would have been a good solution with minimal effort.  It is really nice that it has 32 bit counters, plenty of room there.   I will certainly keep it in mind.  Thanks.

I'll keep going on current path and I thank everyone who replied for the all good inputs.

Mark

P Tiago Pereira

unread,
Apr 2, 2015, 6:09:21 PM4/2/15
to hbrob...@googlegroups.com
Mark,

When i looked for a Quad decoders i found another chip HCTL-2032 from http://www.avagotech.com/  is a 32 dual encoder and 32 bits counter.

the main issue: requires 16 pins = 8 bit parallel bus + 8 pins control.

I never tried, and i don't know if is possible:

if you hook up the MCP23017 ( I2c - 16 input/output pins)  with the HCTL-2032, you can control the chip via I2C, you ll 1x MCP, 1xHCTL and 1x clock IC. 

The MCP allows to read and write to the pins at same time, to avoid single read i would try 2  x MCP23008 (8 input/outpu) 

One MCP for 8 bit Input Bus and the other MCP for 8 bit Output control, this way you can write and read win a single i2c command, 

but like i said i never tried before.


Tiago

Mark Johnston

unread,
Apr 5, 2015, 2:51:52 AM4/5/15
to hbrob...@googlegroups.com

I had known about the HCTL-2032 for a very long time as I had used one in a normal processor board many many years ago in my digital design engineering work at HP where I did processor and IO boards for instruments.

Have a working part now based on the MicroChip dsPic30F2010 and that gives me Qei to I2c so I maintain compatibility with my board for this current need but also gives me Qei later on down the road on I2C.  
Also have an arduino library to match it so I think I'm ready for this simple minded arduino usage case I have as a side project from my main bot.  The firmware for this Qei to I2C part has nice options, checksum packet, selectable address bits so more than one part can be used or you can move the address space like many I2C parts offer to fit in your own usage case.

Now for fun I think I'll get some 20-pin dsPic33  parts that have same QEI interface and those come in 20-pin SSOP 0.65mm pitch package for $3.44 via DigiKey.  My programmer is supposed to be able to flash them too.
The dsPic30F2010 can come in 28pin QFN with 0.5mm pitch but that is a 'painful' thing to work with.   I'm toying with putting a couple 20-pin ssop parts on a tiny board but may just keep it proto breadboard for now.

The dsPIC30 and dsPIC33 series are amazing and have internal clocks so no messing with external crystals or r/c (YUCH!) stuff.    The dsPIC33 series have AMAZING flexibility in io configuration to pins you want to use.  Amazing.

Mark
Reply all
Reply to author
Forward
0 new messages