Limit Switch Troubles - HAL Debounce

More
18 Dec 2014 10:43 #54110 by ctrl-frq
Greetings,

New to LinuxCNC, though I have between 15 to 20 successful retrofits under my belt, primarily with Flashcut.

Yes indeed I have read and read details about others issues, but I can not seem to figure out adding Debounce to HAL.

The machine is an Old Vision Engraver. It is successfully under power via Flashcut, but I wanted to play with LinuxCNC because I have other Linux interests. So, I made a parallel port cable to use between the PC and the driver cabinet. Obviously, Flashcut has the proper pull up resistors and also provides a built in source for 5 volts. With that detached, I had to add a 5 volt supply for logic and also add pull-up resistors to the new cable.

So I dial in everything via stepconf, get familiar with the wheres and hows, and now pretty much understand that stepconf must adjust the INI file and HAL ? I ASSUME that changes made to the INI require the CNC program to be restarted in order for the changes to be recognized.

So, my troubles with the limits seem to be 100% debounce issue. The machine will attempt to home and sometimes does completely. But, more often than not, it will kick out with an error that claims the switch was active before this that or the other thing. I am convinced that I need to increase debounce.

What I have in HAL that works proper when it works is:

net home-x <= parport.0.pin-10-in
net home-y <= parport.0.pin-11-in
net home-z <= parport.0.pin-12-in

What I tried was this up near the top of HAL:

loadrt debounce cfg=3
setp debounce.0.delay 200

And lower in the file:

net debounce-home-x debounce.0.0.in <= parport.0.pin-10-in
net home-x debounce.0.0.out
net debounce-home-y debounce.0.1.in <= parport.0.pin-11-in
net home-y debounce.0.1.out
net debounce-home-z debounce.0.2.in <= parport.0.pin-12-in
net home-z debounce.0.2.out

The loadrt cfg=3 and the delay of 200 is only there because someone else had used it. I can not find any documentation that clearly tells you what cfg=3 means or what other cfg's we can use.

In any event, when I run the modified debounce code, the machine either ignores the limits completely or tries to run the wrong direction at the wrong time.

The machine runs fine under the other control. Re-doing all the limits just for this would be challenging in that a lot of the runs are in the same main OE cable Vision designed it with. It worked for them, it works with my FC retro, it should work with Linux. No ?

I must be inserting something wrong with the debounce lines ?

Your help is immensely appreciated... I have a LONG way to go to understand this control..... FC was/is a no brainer in comparison !

Please Log in or Create an account to join the conversation.

More
18 Dec 2014 15:23 #54115 by ArcEye
Hi

Please attach your .hal and .ini files

I have to assume from references made that you have combined home and limits, but need to see the whole picture.

The error that the switch was active, could simply be that you have not moved off it as part of the homing process, but without the files just guessing

regards

Please Log in or Create an account to join the conversation.

More
18 Dec 2014 17:11 #54117 by ArcEye

The loadrt cfg=3 and the delay of 200 is only there because someone else had used it. I can not find any documentation that clearly tells you what cfg=3 means or what other cfg's we can use.


www.linuxcnc.org/docs/devel/html/man/man9/debounce.9.html

I thought it was quite clear, but that may be over familiarity.

Each comma seperated cfg= item is a component, the number represents the number of filters in that component
eg
loadrt debounce cfg=2,2,3
Will load 3 components, 2 of them with 2 filters and one with 3

The only reason normally to have multiple components is to set a different debounce rate for each, because the rate set for a component applies to all its filters.

The default rate for a component is 5

So 200 is 40 x the default and probably too high

This whole problem could be simply that you have not added the component to a thread, but without the files............................

regards

Please Log in or Create an account to join the conversation.

More
18 Dec 2014 20:21 - 18 Dec 2014 20:25 #54124 by BigJohnT
It could be as simple as your not moving off the home/limit switch. If you don't have an offset or a home location that is not touching the switch you will get that same error.

You might benefit from reading this short introductory document about HAL.

linuxcnc.org/docs/html/hal/basic_hal.html

JT
Last edit: 18 Dec 2014 20:25 by BigJohnT. Reason: forgot link

Please Log in or Create an account to join the conversation.

More
19 Dec 2014 00:01 #54133 by ctrl-frq
>>>It could be as simple as your not moving off the home/limit switch

I believe the issue is debounce because the machine will USUALLY stop running and kick up the error before it ever gets to a switch. The switches are N.C. by the way.

IF the axis are close to their switches, and when NOT using the debounce code I added, it will sometimes cycle thru each axis correctly. Sometimes though, it will kick in the middle of an axis attempting home at which point switches could be opening or closing. If I for example put the Z and X axis close to their switches, but leave Y axis 2" away, when I do get an complete successful homing of Z and X, Y will run toward the switch perhaps .25", then stop and kick up the message. I'm not near the message now, but it is along the lines of what you have stated.... not moving off this and that.

As to the DEBOUNCE document being clear..... To who ?? I'll be the first to admit I am an awful "programmer". Yet, I have for 12 years now, been active in creating GUI's for Mysql databases, primarily with VB and VBa. Again, I'm awful... but I somehow get it done... more of a copy /paster programmer. I use examples that are close, then smack them over and over until they do what I want them to do. I only understood the description in that document, but the rest I would need real world examples to get.

One last tidbit, This particular PC has crazy high jitter. For a year I have been watching here and there for a spare old comp to use.... every one that popped up had an issue with accomplishing an install... bad video, bad something else, no parallel port, etc. So I found this one and it installed, I made headway. I will either use a different PC yet, or try to bring the jitter down (saw all the options for that).

I kept moving forward with this because while I do occasionally get the error you get with high jitter, it does not seem to keep the machine from being able to successfully jog without any error. IF it is JITTER that may have a lot to do with this, I'm going to feel bad for not dealing with it first !

Thanks for the help. I can see the crazy amount of customizable depth here, but I can also see why LCNC can't be for everybody when so much is not handled via gui dialogs when it obviously could be. This machine runs with the other mentioned control just fine. It has user configurable Debounce in the input line gui. There is an adjustment for debounce by dimension so it knows a switches activation travel distance, a generic number is applied for general debounce across all lines (general meaning I dont think the entry specifically relates to time... just insert a higher number for more, lower for less) and separate entries for while in motion or while idle. So, I'm just not used to this depth of "programming" to get there. I have two plasma machines running this other control and "noise" has never been a factor with I/O.

Files attached !
Attachments:

Please Log in or Create an account to join the conversation.

More
19 Dec 2014 00:54 - 19 Dec 2014 01:36 #54137 by ArcEye
ArcEye wrote:

This whole problem could be simply that you have not added the component to a thread.....


You haven't, so it will do less than nothing, it will actually block the signals.

# add debounce component
loadrt debounce cfg=3
# set delay (number of iterations of base thread )
setp debounce.0.delay 200

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread


need to add
addf debounce.0 servo-thread

regards

EDIT
You can add debounce to a base thread, I quite often do, but just be aware there is a real difference between a servo thread period and a base thread period

The delay number is the number of thread periods (or cycles) for which the switch must be true, before the component goes true

So 200 is not much in the base thread and a huge amount more in the servo thread
Last edit: 19 Dec 2014 01:36 by ArcEye.

Please Log in or Create an account to join the conversation.

More
19 Dec 2014 01:46 #54138 by BigJohnT

I believe the issue is debounce because the machine will USUALLY stop running and kick up the error before it ever gets to a switch. The switches are N.C. by the way.


Now it sounds like you have either a loose connection or a voltage issue in your limit switch circuit.

What are you using to bring the limit switch circuit into LinuxCNC?

What kind of limit switch are you using?

Really you should not need debounce for a limit switch.

JT

Please Log in or Create an account to join the conversation.

More
19 Dec 2014 02:08 #54139 by ArcEye

I believe the issue is debounce because the machine will USUALLY stop running and kick up the error before it ever gets to a switch. The switches are N.C. by the way.


Now it sounds like you have either a loose connection or a voltage issue in your limit switch circuit.

What are you using to bring the limit switch circuit into LinuxCNC?

What kind of limit switch are you using?

Really you should not need debounce for a limit switch.

JT


I agree with JT, the only problem I have ever had with limits was noise causing false activation. Jumping the limits circuit voltage to 12v completely cured it.

However I have been multi-tasking too much today and had forgotten that this was ever titled to be about limit switches, I was thinking home switches.

This section made me think you had joint limit and home switches

So, my troubles with the limits seem to be 100% debounce issue. The machine will attempt to home and sometimes does completely. But, more often than not, it will kick out with an error that claims the switch was active before this that or the other thing. I am convinced that I need to increase debounce.


So my confusion is compounded when I look at your .hal file and realise that you don't have any limit switches, the debounce is applied to the home switches?!

Please Log in or Create an account to join the conversation.

More
19 Dec 2014 02:41 #54141 by ctrl-frq
>>>This whole problem could be simply that you have not added the component to a thread.....

Wow... add something that says SERVO to my stepper config... clear as MUD ! LOL ! I assume it installs up there in with the rest of the "addf" references.
Thanks though... I'll give that a whirl tonight. I hope that solves it !

It really can't be something "loose".... the machine offers 100% reliable operation under the other control, heck 120%! The limit switches are still some OEM, unknown small push button jobbies that have the N.O. terminal cut flush or not even there. If they were, I would TRY Normally Open. I have used one of those HAL tools to let me SEE the switch operations under all sorts of rigorous attempts to force failure, but they always look just fine. I'm slowly grasping my diagnostic options with HAL meter and whatever else it was named....

HOW they are brought in to the parallel port ? Well, the machine has its own harness that jumps into a 30 some pin DB connector. From there, a cable takes ALL the wires including motor signals to another 30 some pin DB connector and into the driver cabinet. Now inside, I had gutted the OE embedded PC board and intercepted all of the other traces necessary to utilize the existing on-board relays and such for Outputs. Right out of the linux box, both my spindle and dust collection (coolant) relays operate perfectly.

All the wires in one cable ?? You can't do that !!! many will tell you, but hey, OEM's do this a lot. And it works for them. heck, it is working for me with FC but I feel the need to know more about Lcnc (been forced down the road with Mach more than once and it has always sucked for me.. always!).

I did similar trace intercepts (and isolation) on the existing OE PC boards to redirect the IMS483 driver inputs, as well as the LIMIT wires directly into a new DB25 plug mounted on the cabinet in order to provide a single inlet location for everything from in the first case, Flashcut, and now, a parallel port via linux.

I have simply created a new DB25 cable with the pin crossovers in place. I am not running any retail BOB in between. I quickly realized that I do not have a +5v source IN the cabinet for logic, so for now, just fed +5v into my new cable via wallwart (Flashcut itself provides an optional +5 logic source and I've always just used it - I'll put a dedicated +5 supply in the cabinet at some point).

Once the machine was jogging and the homing routine was set up to work but failed completion 95% of the time, I concluded it might be "pullup" issues, and then added some resistors... a tried a few different values commonly yacked up in the various forums... no difference. Then I searched for debounce options and found them to be a little blurry.

I know that most guys really want NC switches on those circuits and I know why. I will say that on other retrofits over the years, sometimes when I would use the conventional Cherry snap switch for convenience and specifically when they were used NC, they would require higher debounce periods with FC. Seems either the chatter of machining or perhaps the direct minor pulse rattle from steppers as some speeds would make the contacts tremor.

Oh well, fun stuff. I came across some Denford Lathe discussion in that brought me to just explore gmoccapy lathe screen..... Can a guy ever get enough of something that is this much fun ? Here are some photos of a Denford I have running on FC: data-cut.com/projects/miscmachines/index.html

Please Log in or Create an account to join the conversation.

More
19 Dec 2014 06:13 #54153 by newbynobi
It would look nicer with gmoccapy:-)

Norbert
( the gmoccapy maker)

Please Log in or Create an account to join the conversation.

Time to create page: 0.265 seconds
Powered by Kunena Forum