AnHardt / Marlin

Reprap FW with look ahead. SDcard and LCD support. It works on Gen6, Ultimaker, RAMPS and Sanguinololu
GNU General Public License v3.0
1 stars 1 forks source link

Endstops, Probes & Homeswitches #85

Closed AnHardt closed 4 months ago

AnHardt commented 5 years ago

A little series of articles about endstops, probes and homeswitches. I want to cover:

AnHardt commented 5 years ago

Definitions / Naming

AnHardt commented 5 years ago

Hardware / Devices

Endstops

Probes

AnHardt commented 5 years ago

Mounting Endstops

AnHardt commented 5 years ago

Noise

What is Noise? Every wire acts as an antenna. Besides of its DC-voltage-level there is always a bit of added AC-voltage. If the AC part is wanted, we call it signal. If unwanted, noise. In digital systems the AC is always unwanted. How does Noise look like? With a oscilloscope you can measure and visualize the noise.

image 5V system

image 3.3V system

The main sine noise if drawn with about the highest possible amplitude the processors can stand without becoming damaged, usually its amplitude is much lower. One can see, if the DC-level is ok, the highest standable noise will not alter the High or Low state. The spikes are different. Above i sketched them with a moderate level, to make them visible. They can be much higher. Because they are short in time. The processors can stand them, even when they don't like them. image With a bit higher spikes the margin for a Low level is exceeded. image With even higher spikes sometimes a Low signal is interpreted as High and High one as Low. Now the system is unreliable. We get occasional false triggers of the endstop.

Up to here we looked at driven wires. At a open input, or a undriven wire it gets worse. We don't have a defined level. The voltage level 'floats' somewhere in the middle between High an Low and the noise causes the state to permanently switch. (Experiment with the Arduino example sketches to read analogue or digital pins, but connect just one end of a wire to the input) image

AnHardt commented 5 years ago

Setup Marlin

Define the #define USE_????_PLUGs of the endstops you connected. Comment // the others. Activate ENDSTOPPULLUPs for all your 'passive' switches. Deactivate for the 'active' ones. (Rule of thumb: 2 wires [Signal, GND] -> 'passive', 3 or more [Signal, GND, Vcc, ] -> 'active') If you want a probe, activate one and select how it's connected and what it shall be used for. Set ?_HOME_DIRs towards your endstops. Activate all software endstops. Activate ENDSTOP_INTERRUPTS_FEATURE. Save and compile. If you get an error about ENDSTOP_INTERRUPTS deactivate - you board is not capable for that. Move the printhead manually to the mid, so no endstop or probe is touched. Switch on the printer and load up Marlin. Start a host. If the host has knowledge about your printers geometry, set it. If the host has software endstops, deactivate them. Connect to Marlin. Find the terminal and deactivate Marlins Software Endstops by sending M211 S0. (Else moves into the negative direction may be impossible.) Send M119 to check the hardware endstop states. All activated hardware endstops and the probe should appear. No unused endstop should be reported. If not correct the config. If you see any endstop TRIGGERED, go back to the config an flip the related ?_???_ENDSTOP_INVERTING. Disconnect the host, Save config, upload, connect, deactivate Software Endstops and retest with M119. Now manually test an endstop. Trigger it with your finger or a screwdriver, depending on the type of switch and keep it switched. Send another M119 and see i if the right switch is reported as TRIGGERED. If not, look for the reason and correct the problem. Leave of the probe for now - some probes need homing before they can deploy. Switch to 'coordinate relative mode' by sending G91. Try sending G1 X-1 and see if x moves toward XMIN. Repeat with the other direction and the other axes. If moving to the wrong direction switch `INVERT?_DIR` in the config, save, recompile, ... retest. (But be sure to have a right handed coordinate system. A moving bed may confuse you. Always see the printheds relative movement to the bed. If that seems to be impossible, hink about if your min-endstop is really min, or maybe max?) image

Next is testing homing. Put your finger on the main switch or reset button and send G28 X. If that worked try Y. If you don't home Z with a probe you can try Z now. DELTA printers do home all axes at once. Just send a G28. If you have a probe we can try it now (with at least homed X and Y). Try to deploy it with M401. Trigger it manually and check with M119. IF ok try stowing with M402. Because of the trigger pulse of a BL-Touch you'll probably not see the TRIGGERED state. Depoy again with the finger right under the probe, so the pin can't extend. The probe will go into an error state with setting the line to high. Now a M119 should see the TRIGGERED state. Correct connection is proved.
If everything worked up to here try homing with G28. If you don't see the expected sequence of moves, if any of the axes stopper early, your system probably suffers from noise on the endstop lines. (Or we have built in another new bug into Marlin) Either try to denoise your endstops, or activate ENDSTOP_NOISE_FILTER and retest.

AnHardt commented 5 years ago

Testing

For now follow the Setup chapter.

AnHardt commented 5 years ago

Troubleshooting

For now follow the Setup chapter.

AnHardt commented 5 years ago

Selftest

AnHardt commented 5 years ago

Step- or Time- Domain

AnHardt commented 5 years ago

Homing vs. Probing

AnHardt commented 5 years ago

Safety

Endstops are safety devices! Depending on, how much safety you need Marlins way to stop the axes in software may not be the best idea. Software may fail. Professional CNC-systems can develop a lot of power. Enough power to easily destroy themselves, if a movement beyond the limits isn't stopped in time. Ouer 3D-printers are usually a lot less powerful and rigid. So either the stepper motor or the belt will skip before something brakes. And if something breaks we should have a spare part on stock to immediately replace the broken part and print a new one. So if safety matters you could use pure hardware to stop the axis. For example an endstop could open main power, step line, enable line, the line to one or more coils of the stepper, ... . That works reliably. The Motor will not power the axis any further. But it will also impossible to move the motor back from the endstop. It needs a "endstop-override-button" to bridge the opened line. That may opened/closed by a hardware button and/or a software driven switch (currently not implemented in Marlin).

What is the fastest way to stop? Or, what is the shortest way to stop? Stopping to move the steppers field does not mean the same as stopping the movement. If F=m*a of the driven mass exceeds the holding torque of the stepper, the movement will not stop immediately, but will skip n*4 full steps.

ToDo: Research: Stopped field rotation vs. using stepper as generator with open, shorted, loaded coils. (decay?) Fastest way is to short the coils. But it's difficult to do that without frying the stepper drivers. So if not a integrated function of the driver - let it be. Research active braking: slowing down field direction change, so that no skip occurs, keeping field and rotor "nearly" one full stepp appart to get full break moment all the time.

AnHardt commented 5 years ago

@thinkyhead I don't have many tips for troubleshooting, but a Setup Guide for endstops, including the basic tests.

AnHardt commented 5 years ago

Bouncing

https://hackaday.com/2015/12/09/embed-with-elliot-debounce-your-noisy-buttons-part-i/ https://hackaday.com/2015/12/10/embed-with-elliot-debounce-your-noisy-buttons-part-ii/