On Saturday 21 March 2020 12:29:13 Leonardo Marsaglia wrote:

> Answering to Andy and Gene,
>
> I'm tracking the position of the spindle (now simulated with this
> encoder but in the final machine I'll be using a 1024 PPR encoder)
> resetting the position counter after each index pulse and using that
> as reference for a new turn of the spindle.
>
They may have a better way, I an using 2 separate systems on by g0704 
that look like a totally custom encoder because it is.

First I have a piece of a nail jbwelded to the side of the drawbar cap, a 
good 5/8's of an inch long, vertical of course.
 
Then an ATS667 is mounted to the vertical face faceing the drawbar cap 
and clearing the nail as it spins by about 10 thou. With a 3.1mm 3 pin 
socket glued to the top of the block withe the tantalum by pass on it 
rear pins where the 667's legs are attached. This cable is routed into a 
small small Hammond box containing a pair of rs485 to ttl convertors.

The encoder carrying and generating the A/B an -A/-B signals is mounted 
on top of the G0704's spindle motor on a small brass extension shaft and 
there for reads motor rev at 4k edges per turn. Scale for the ini files 
Spindle section was determined by count A pulses for 100 index pulses 
and freezing the count, it just over 7K in high gear, and just over 14K 
in low gear.

Then I cut a micro switch roller sized notch in the edge of the gear 
shift knobs skirt. And sandwitched two switches positioned to drop there 
levers into the notches, and wired their NC tabs up to a couple inputs 
on the bobs. Using some hal parts, I change the SCALE so the tach is 
accurate in either gear, and the scale itself, so the number used is 
correct for a full rev in either spindle gear.

Then while grabbing the stopped spindle to change gears, An idea hit me 
to make that easier if I changed the mux2 to a mux4 giving me a motor 
speed input if neither tally switch was closed. So I changed the mux to 
a mux4, and setp'd the other two inputs to about a 15 rpm tickle.  Now I 
can reach for the knob and change it on the fly at any spindle speed 
without having to grab the spindle and feel for the engagement of the 
flat faced gears. The servo is both fast and powerfull, so if its 
running wide open at 1500 in low gear, the spindle is down to 5 rpm 100 
millisecs after the knob has started to move, it stops in the middle and 
goes up to 10 revs as the other gears start to mesh, and snaps back to 
3k rpms when the switch roller drops the last 10 thou into the notch.
I need to change that out of gear logic to run the motor even if LCNC 
isn't so I can change gears just as painlessly when its stopped. But 
thats also the shoemakers kids story too. :)

Hal is your friend and you can do a heck of a lot more than you can 
imagine, all you have to do is imagine it, and code it up.

> Do you think it's better for me to only use one index pulse to set the
> reference and then count the position output to keep tracking of the
> spindle position and whenever I sum 1024 pulses I get one turn? I
> mean, not using the index for each revolution, only using it as a
> reference starting point.

correction whenever, scale is encoder input A count for 100 turns, 
divided by 100, do not throw away the decimal fraction.
In my ini file under [SPINDEL] i HAVE:
ENCODER_SCALE_H = 7161.61
ENCODER_SCALE_L = 14095.34
and:
SCALE_UP                = 1.96818033933710437
SCALE_DOWN              = 0.508083522639397134

So I have whichever scale, and the multipliers to get what I want very 
accurately.
To determine that scale, but now commented, I have:
#*********************************************
# calibrate spindle to new encoder           *
# use halshow to reset updown for new count  *
# this code is not part of normal operation  *
# used only to determine working gear ratios *
#*********************************************
# sample rate now turned up so filter can be used
# add modules and addf's to suit, and comment them out when done
# remove one # below to activate
setp hm2_5i25.0.encoder.00.filter true
#net scalibrate0 mux2cal0.out mux2cal0.in1 spndl_tally.in0 
## above makes a sample-hold
#net scalibrate1 mux2cal1.out mux2cal1.in1 spndl_tally.in1 # ditto
#net ztrack <= hm2_5i25.0.gpio.016.in spndl_cntr.countup
#net ztrakS32 spndl_cntr.count S32_float-cntr.in
#net ztrackF S32_float-cntr.out comp_cal0.in1 comp_cal1.in1
## spndl_tally is actually a sum2
#setp spndl_tally.gain0 -1.00000000000 #make it a diff2
#setp spndl_tally.gain1  1.00000000000
##** set to log 100 indexes
#setp comp_cal0.in0     5.5
#setp comp_cal1.in0     105.5
#net Scounter-in hm2_5i25.0.encoder.00.rawcounts S32_float-cal.in
#net Fcounter-in S32_float-cal.out mux2cal0.in0 mux2cal1.in0
#net shhold0 comp_cal0.out mux2cal0.sel
#net shhold1 comp_cal1.out mux2cal1.sel

## when mux2-cal1.out is frozen, do [spndl-tally.out / 100] to get scale.
## repeat for other gear for 2nd scale factor. When done, comment it all 
## out

>
> El sáb., 21 mar. 2020 a las 13:19, Leonardo Marsaglia (<
>
> ldmarsag...@gmail.com>) escribió:
> > You happen to have a datasheet for the ERN471 encoder?
> >
> >
> > I'm attaching it to the message. Hope it uploads.
> >
> > El sáb., 21 mar. 2020 a las 10:33, Nicklas Karlsson (<
> >
> > nicklas.karlsso...@gmail.com>) escribió:
> >> > On Saturday 21 March 2020 04:04:03 Nicklas Karlsson wrote:
> >> > > > Hello guys,
> >> > > >
> >> > > > I'm testing a phisical encoder to simulate how the spindle
> >> > > > will work with the external offsets. So far so good but I
> >> > > > need to clarify something that I suspect. Here it comes:
> >> > > >
> >> > > > The encoder I'm testing is an ERN471 from Heidenhain. A beast
> >> > > > of encoder. It says 5.000 line counts on the datasheet but
> >> > > > also says it outputs 125.000 signal periods per revolution,
> >> > > > so when I read it in LinuxCNC with a scale of 1 I find that
> >> > > > I'm having 500.000 pulses per turn. A lot of resolution. ...
> >> > >
> >> > > Maybe me stupid. My machine had Heidenhein encoders but I did
> >> > > not get them work and replaced them with 2000P/R encoders.
> >> >
> >> > Don't be so hard on yourself. Probably the smartest move you
> >> > could have made. Those ERN471's would be much more suitable on a
> >> > fraction of a
> >>
> >> turn
> >>
> >> > robotic arm.
> >>
> >> You happen to have a datasheet for the ERN471 encoder?
> >>
> >>
> >> _______________________________________________
> >> 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


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
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to