Yes, you can buy a hardware Quadrature chip.  But any modern
microcontroller like the STM32 will have hardware quadrature decoders.
The larger versions of the chip will have multiple quadrature decoders.
The chip will also have SPI.   These things cost under $1 or about $3 if
you want it on PCB ready to use.   If you buy the chip you need to design a
PCB.   I buy the microcontroller already on a PCB and in a usable form for
$3.

I like to place these not on some kind of large PCB near the main processor
but rather near the sensor.  This reduces the bulk of wire.   You can stick
the littlle computers where ever they are needed and then  snake one
(say) CANbus
cable around to connect each of them to power and data.

If you try to build a cape that does everything you find that you can't.
By "everything" I mean works with a PC, with a Pi4 and with a BBB and
connects steppers and servos and VFDs and linear scales.     It is best to
just put a CAN bus or whatever on the main computer and nothing else.
 This is 100% "future proof" because every part can be swapped out.

These little boards have become by "go to" universal interface board.  They
cost $3 and have hardware pulse, PWM and quadrature support in hardware and
can talk over SPI I2C or USB.  They are small and cheap enough that you can
place them where ever they are needed.
ebay.com/itm/STM32F103C8T6...
<https://www.ebay.com/itm/STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-Arduino-HOT/372276039369?epid=23002532325&hash=item56ad618ec9:g:VjoAAOSwkRJazxC6>

THe other design option is to use an FPGA.  That is what Mesa does and they
can put any reasonable number of counters and generaters in one FPGA but
then you have to route a ton of wires all back to that one chip.

Ideally you have just one thin cable going from controller to the machine.
 If you like those chips just glue on on each encoder and turn then encoder
into a serial interfaced device.  Or use a serial buss so 6 encoders can
share one cable.



On Mon, May 25, 2020 at 12:38 AM John Dammeyer <jo...@autoartisans.com>
wrote:

> BTW,  Check out
> https://lsicsi.com/datasheets/LS7366R.pdf
> This device is interfaced via SPI and has a 32 bit quadrature counter
> module.  If you go in the direction of Raspberry Pi with LinuxCNC a device
> like this can provide the spindle information.  So if someone was thinking
> of building a CNC cape for a Pi a device like this would be a good idea.
> There are also devices from the same manufacturer that can change
> quadrature into up/down pulses streams to use regular counters inside the
> Pi.
>
> John
>
>
> > -----Original Message-----
> > From: R C [mailto:cjv...@gmail.com]
> > Sent: May-24-20 6:01 PM
> > To: linuxcnc-users-list
> > Subject: Re: [Emc-users] Encoder HAL programming.
> >
> >
> > On 5/24/20 6:29 PM, andy pugh wrote:
> > > On Mon, 25 May 2020 at 00:17, R C <cjv...@gmail.com> wrote:
> > >
> > >> I have been following this thread.  I wrote some code that runs on an
> > >> RPI that can read a quadrature encoder, I have a few of them, with
> > >> different resolutions.
> > > Is this something different to the normal LinuxCNC software encoder
> > > that reads GPIO?
> > > Is there some dedicated encoder counter hardware on the Pi?
> > >
> >
> > Oh I am not running linux cnc on an rpi, I run it on a server "class"
> > machine.�� I was just curious about how these encoders work, and why
> > they didn't
> >
> > work that well with my linux-cnc setup using a db25 BOB with the 2
> > benchtops I have.
> >
> >
> > So I decided to use an RPI (because it is easy to use GPIO pins to read
> > signals) and write some code to read these� encoder signals.
> >
> >
> >
> > So I guess my answer is yes,� it is different from, what linux-cnc
> > running on a pi does (I would be surprised if it was similar)
> >
> >
> > I setup an RPI, hooked up a 2 line LCD display to it to display rpms,
> > wrote some interrupt driven code that reads the encoder and displays it
> > on the LCD. The idea is, I want
> >
> > to try and see if I can read the encoder and then send signals back to
> > linux-cnc that it 'could handle".
> >
> >
> > So I have a 60ppr encoder,� 60 has a lot of dividers.� 2, 3, 4, 5, 6,
> > 10, and 12� So if I can "transfer" a pulse with a consistent delay
> > exactly when the actual n-th pulse
> >
> > comes in, I could turn a 60ppr� encoder into a 30, 20, 15, 12, 10, 6 or
> > 5 ppr encoder by just skipping pulses,� while raising some GPIO pins,
> > that I connect to the BOB, when
> >
> > I read a different set of GPIO pins directly from the encoder.
> >
> >
> >
> > But as I said earlier,� I don't know a lot about the linux-cnc's
> > internals, and HAL, but it is something I am playing with to see if it
> > could work.
> >
> >
> > Ron
> >
> >
> >
> > _______________________________________________
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
>
>
>
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>


-- 

Chris Albertson
Redondo Beach, California

_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to