Sure,  but it works..   and   *lol*    Linux is not good at "Real Time" ? , nothing is good at real time (depending on what you call real time), as

long as you can complete some operations with a given amount of time.  (I work on time sensitive stuff, "real time" issues at scale for a living, not

too many issues with a little encoder in particular.


On 6/19/20 1:59 PM, Chris Albertson wrote:
The Pi is a really horrible platform for reading high speed quadrature. Sorry to say but you'd be far better off using a $3 to $10 ARM-based development board.   I have a few Pi3 and Pi4 here. I typically use the $3 boards for real-time stuff like encoders and motor control and place the calculations and user interface on the Pi3 or Pi4.

The little cheap boards don't miss counts and don't run Linux Kernels. For motion control, I like to place that on the ARM micro and then connect that to the Pi via USB.  The Pi sends "move-to" and speed commands and the Micro sends position and velocity updates at perhaps 20Hz back to the Pi.  No, I did not invent this. The idea is common.   Linux is just not good at "real-time" even with an RT kernel.  The ARM-M on the other hand is perfect for real-time.

Notice the setup that "everyone" uses to control machine tools.  Linux/RT connected to Mesa/FPGA.  This is logically the same as Pi4 connected to ARM-M.  The concept is the same: Move the real-time stuff into hardware.

On Fri, Jun 19, 2020 at 12:45 PM R C <cjv...@gmail.com <mailto:cjv...@gmail.com>> wrote:


    On 6/19/20 1:34 PM, Chris Albertson wrote:
    > A 4:1 reduction is possible with gears.  The sensor would be
    mounted the
    > same way but displaced off axis 24 mm then fitted with a 80T
    gear and
    > driven by a 20T gear that is itself driven by the drawbar.   I
    would buy l
    > gears (mod. 0.5 or Pi/2 mm pitch)  as printed gears are not
    great in that
    > tiny size.
    >
    > I think gears are good because they can be small mod 0.5 or even
    smaller.
    > Two minutes of hunting found this
    > https://www.mcmaster.com/2662N31
    > for $3 each.  This could be the "large" gear fixed to the sensor.
    >
    > There is "all the space in the world" above the spindle on the
    mini mill
    > but you need to preserve a way to get a wrench on the drawbar.
    >
    > The harder part is getting the encoder data into LinuxCNC/HAL. 
      It is
    > easy if you have some Mesa cards.    More work if the data must
    go in via
    > USB.

    I am still messing with reading quadrature encoder(s) on an RPI,
    it can
    be done.  I am doing that for a few reasons, one

    is for adding something like that to a benchtop mill and lathe, the
    other is to track the axes of a telescope mount that I

    am building.



    > On Fri, Jun 19, 2020 at 11:52 AM Ken Strauss
    <ken.stra...@gmail.com <mailto:ken.stra...@gmail.com>> wrote:
    >
    >> I would like to add rigid tapping. Those are some inexpensive
    encoders
    >> except the top rated speed is 5000 rpm and I have a 10000 rpm
    spindle. Any
    >> suggestions regarding suitable pulleys to reduce the speed
    (perhaps 5:1)?
    >> Will normal GT2 belts survive?
    >>
    >>> -----Original Message-----
    >>> From: Chris Albertson [mailto:albertson.ch...@gmail.com
    <mailto:albertson.ch...@gmail.com>]
    >>> Sent: Friday, June 19, 2020 2:02 PM
    >>> To: Enhanced Machine Controller (EMC)
    >>> Subject: Re: [Emc-users] Universal spindle speed control for $7
    >>>
    >>> There is all the space I need to build an encoder for the HF
    mill's
    >>> spindle.  The sensor will fit above the drawbar.
    >>>
    >>> I'm thinking of using this sensor.  The shaft would point down and
    >>> thesensor is aligned with an directly over the spindle.
    >>>
    ebay.com/itm/360-600P-R-Photoelectric-Incremental-Rotary-Encoder.
    <http://ebay.com/itm/360-600P-R-Photoelectric-Incremental-Rotary-Encoder.>..
    >>>
    <https://www.ebay.com/itm/360-600P-R-Photoelectric-Incremental-Rotary-
    >>> Encoder-5V-24V-AB-Two-Phases-
    >>> Shaft/254214673272?hash=item3b30601378:g:AfUAAOSwQ0dcxosi>
    >>>
    >>> There is a cover over the spindle that is held on by
    friction.     It
    >> looks
    >>> like the top on a can of spray paint.    I can make a
    replacement that is
    >>> held on by magnets.  Inside is the encoder that fits on top of the
    >> drawbar.
    >>> The sensor is fitted with a 17mm "socket"  that is light
    friction fit to
    >>> the top of the drawbar.
    >>>
    >>> In use, I'd remove the new cover and stick it on the side of
    the mill
    >> using
    >>> the magnet, apply the wrench to the drawbar then replace the
    cover.
    >>>
    >>> I am trying to decide if I want a 360 line or a 600 line encoder.
    >>   Either
    >>> will send data too fast for a printer port with no Mesa card. 
     I might
    >> put
    >>> a microcontroller in the cover and use a serial interface. 
     The plan is
    >> to
    >>> get spindle speed control to run open-loop first.   I figure
    an open-loop
    >>> servo-controlled pot is at least as accurate as a human
    operator can do
    >>> with his fingers while listening to the noise.
    >>>
    >>> My pendant project got a huge boost when I figured out I don't
    need to
    >>> build any hardware.   I can use an off the shelf X-box USB game
    >>> controller.  I already have a few of them.
    >>>
    >>> On Fri, Jun 19, 2020 at 4:11 AM Gene Heskett
    <ghesk...@shentel.net <mailto:ghesk...@shentel.net>>
    >> wrote:
    >>>> On Friday 19 June 2020 06:10:48 Roland Jollivet wrote:
    >>>>
    >>>>> I was going to suggest this at the start of the thread, but
    I thought
    >>>>> it would be considered too Heath Robinson..
    >>>>>
    >>>> And within its limitation of available torque to keep the tap
    turning,
    >>>> and an encoder able to track to a 5 degree accuracy, I see no
    reason to
    >>>> totally eliminate rigid tapping from its abilities. Even the
    little 200
    >>>> watt hf mill should be able to turn an 0-80 or maybe even a
    2mm tap.
    >> The
    >>>> lack of space in the head to build a decent encoder is far
    more of a
    >>>> limitation than a speed controller such as this. Thats the
    main reason
    >>>> my little hf never grew the ability to tap, That
    controller/amplifier,
    >>>> pulled out of the head and mounted in a 4x6x3" box so all the
    the hot
    >>>> electronics was out of sight, proved to be a very high gain
    controller,
    >>>> so high gain I was forced to rig an ammeter to tell me how
    hard it was
    >>>> working so I could control the cost of fuses, there was
    otherwise no
    >>>> slowdown to let the user know it was working too hard.
    >>>>
    >>>> I eventually blew that controllers pass transistor, a simple
    powet
    >>>> F.E.T., and in search of a suitable replacement, checked the
    bugs in an
    >>>> out of spec pc supply from the junk box, found it was rated
    at 800
    >> volts
    >>>> instead of 200, 12 amps instead of 2.5, but otherwise looked
    the same.
    >>>> So the consideration resolved to the driver transistor in the
    circuits
    >>>> ability to switch the much higher gate capacitance that bug
    had to have
    >>>> since switching speed is paramount. I put it in, think I had a
    >> reservoir
    >>>> of such bugs if it didn't work. I raised the fuse from 2.5
    amps to 4.
    >>>>
    >>>> That was over a decade back. I've blown the fuse 2 or 3 times
    since
    >> with
    >>>> the ammeter pegged, but its still there although the rest of
    the mill
    >> is
    >>>> in pieces, it unscrewed one of its ballnuts a year & 1/2 ago.
    >>>>
    >>>> Somebody should make me an offer for it, its the complete
    controller
    >> out
    >>>> of the big head hf x1 with a pmdx-106 interface, ready to
    take the pwm
    >> &
    >>>> direction output of LinuxCNC from a parport bob, either
    manual or full
    >>>> bi-directional computer control of a 200, maybe even a 400
    watt motor.
    >>>> Its not in service here, and probably won't ever be again as I'm
    >>>> approaching the end of my ride here with a pump running at 31%
    >>>> efficiency.  And thats beginning to affect my giddy-up.
    >>>>
    >>>>> On Thu, 18 Jun 2020 at 20:40, Chris Albertson
    >>>>> <albertson.ch...@gmail.com <mailto:albertson.ch...@gmail.com>>
    >>>>>
    >>>>> wrote:
    >>>>>> I'm making good progress on my 3D printed CNC conversion. 
    I found
    >> a
    >>>>>> way to 3D print a spindle controller that should work for most
    >> small
    >>>>>> milling machines and small lathes.  The cost is "almost
    nothing".
    >>>>>> These machines' spindles are controlled by turning a
    potentiometer
    >>>>>> so my new system simply uses a cheap model airplane servo
    to turn
    >>>>>> the shaft of a potentiometer.  The computer is 100%
    isolated from
    >>>>>> any high voltage or noise.
    >>>>>>
    >>>>>> These small mills will never be able to do things like rigid
    >> tapping
    >>>>>> so all they need is a simple and approximate way to control the
    >> RPM.
    >>>>>>   This speed control can be run "open loop" if plus/minus
    20% is
    >> good
    >>>>>> enough or used with a spindle encoder in a closed PID loop
    as long
    >>>>>> as the PID is tunned not to aggressively.
    >>>>>>
    >>>>>>
    >>>>>> For anyone who does not know about these hobby servos:
    >>>>>>
    >>>>>>     - They are not full rotation motors.  They turn only
    through
    >>>>>> about 250 degrees, This is a good match to the pot as pots also
    >>>>>> rotate about this range.
    >>>>>>     - The angle of the servo shaft is controlled by a PWM
    signal.
    >>>>>>     - They are "dirt cheap" starting at about $5
    >>>>>> amazon.com/4-Pack-MG996R <http://amazon.com/4-Pack-MG996R> <
    >>>>>> https://www.amazon.com/4-Pack-MG996R-Torque-Digital-
    >>> Helicopter/dp/B0
    >>>> 7MFK266B/ref=sr_1_2?dchild=1&keywords=mg+servo&qid=1592502600&sr=
    >>> 8-2
    >>>>>>     - They accept a 5-volt control signal, so they have a
    built-in
    >>>>>> computer interface.
    >>>>>>     - They are fast (enough) and can move from full-low to
    full-high
    >>>>>> on 0.6 seconds
    >>>>>>     - They really are actual "servos" and have an encoder,
    motor
    >>>>>> driver, and gears all inside.
    >>>>>>
    >>>>>>
    >>>>>> So when LinuxCNC outputs a low-value PWM spindle control,
    the servo
    >>>>>> moves the pot to the low position. As the PWM signal value gets
    >>>>>> larger the pot is moved closer to the high-speed position.
    >>>>>>
    >>>>>> In the picture below is a cartoonish render.  The green
    frame is
    >>>>>> one-piece 3D printed,  The red pannel and tan coupler are
    also 3D
    >>>>>> printed.  The motor sells on Amazon, four units for $20 and
    the pot
    >>>>>> is about a buck each.  Four M4 button head screws everything
    >>>>>> together.
    >>>>>>
    >>>>>> Here is a link to the current version CAD files and a viewer.
    >>   I'll
    >>>>>> be updating the files after the first prototype is printed.
    >>>>>> https://a360.co/2N95AiL
    >>>>>> I may make a top cover to protect the pot and keep fingers
    off the
    >>>>>> high voltage.
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> [image: Red Neck Spindle Control v6.jpg]
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>> --
    >>>>>>
    >>>>>> Chris Albertson
    >>>>>> Redondo Beach, California
    >>>>>> _______________________________________________
    >>>>>> Emc-users mailing list
    >>>>>> Emc-users@lists.sourceforge.net
    <mailto:Emc-users@lists.sourceforge.net>
    >>>>>> https://lists.sourceforge.net/lists/listinfo/emc-users
    >>>>> _______________________________________________
    >>>>> Emc-users mailing list
    >>>>> Emc-users@lists.sourceforge.net
    <mailto:Emc-users@lists.sourceforge.net>
    >>>>> https://lists.sourceforge.net/lists/listinfo/emc-users
    >>>>
    >>>> Cheers, Gene Heskett
    >>>> --
    >>>> "There are four boxes to be used in defense of liberty:
    >>>>   soap, ballot, jury, and ammo. Please use in that order."
    >>>> -Ed Howdershelt (Author)
    >>>> If we desire respect for the law, we must first make the law
    >> respectable.
    >>>>   - Louis D. Brandeis
    >>>> Genes Web page <http://geneslinuxbox.net:6309/gene>
    >>>>
    >>>>
    >>>> _______________________________________________
    >>>> Emc-users mailing list
    >>>> Emc-users@lists.sourceforge.net
    <mailto: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
    <mailto:Emc-users@lists.sourceforge.net>
    >>> https://lists.sourceforge.net/lists/listinfo/emc-users
    >>
    >>
    >>
    >> _______________________________________________
    >> Emc-users mailing list
    >> Emc-users@lists.sourceforge.net
    <mailto: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