@haakon-th If you could post your project/problem in the appropriate forum/sub forum it would be appreciated as this forum is to introduce yourself.
I used to have a wood shop so have some idea what you might be doing.
Perhaps start with the problem you are trying to solve, then tell us the design to solve it and finally where it isn't meeting your needs.
I am looking forward to seeing what you are up to.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
What I would like to improve:
1 Automatic homing at startup.
2 Backlash compensation
Hi haakon-th, welcome to the forum.
To do your automatic homing, you'll need a limit switch or some other kind of sensor to tell you when to stop. Here is a sample of the logic to do that.
It sets a target location as -100,000 steps and then enters while loop. The loop moves backwards as long as there are still steps to go (from the 100,000) AND the limit switch is not triggered. As long as both of these conditions are true, the while loop takes a step backwards. When the switch is triggered, the while loop exits. The current position is set to -10 and the stepper is moved to new position zero.
The reason for setting the origin a bit off from the switch is that it makes sure that the switch isn't triggered every time the platform rolls back to it. This reduces wear and tear on both parts of the device.
// // Home the given stepper. Find the limit switch and step back from there // Origin is set as 10 steps before limit switch to give clearance // atLimit() is false if limit switch open or true if limit switch triggered // void homeStepper( AccelStepper &stepper) { stepper.moveTo(-100000); while (stepper.distanceToGo()!=0 && !atLimit()) stepper.run(); // // Found limit, now move across to origin // stepper.setCurrentPosition(-10); stepper.runToNewPosition(0); }
It's difficult to address the backlash problem since you have given us no information about the mechanism used to move whatever it is you're moving.
Your code (or Yvan's code) is pretty good, he wrote simple but effective sketches. There are some points to make however.
1) you are using almost identical code to draw onto the Nokia screen in 3 different places, despite the fact that you have a subroutine called drawnokiascreen to do that. You should just call the subroutine from the other two locations. In the setup() call, just pass "" as the string to draw
2) the drawnokiascreen screen has a parameter that seems never to be used ? You should change the subroutine code to draw the string passed and send the appropriate value from the places where you call it.
Anything seems possible when you don't know what you're talking about.
Hi @haakon-th,
Welcome to forum .. I hope you find it friendly and helpful.
I would agree with Ron @zander's, advice to post your technical part of the query in a separate post, in an appropriate section of the forum, as this section is meant for newcomers introducing themselves.
---------
However, in the hope of making your revised post more helpful, I would like to offer a comment for you to consider.
I confess to not having read the Arduino code, but notice you indicate the problem is one of backlash. Simplistically, I normally think of backlash as being mechanical 'space' or 'looseness', which usually shows up when the direction of motion of something is reversed.
For example, when a nut or a gear can be rotated a certain amount in the new (reverse) direction, before it appears to have any effect, other than to take up the slack in the mechanics of the system.
Does your query have its origin in the mechanics? Are you trying to use the Arduino code to compensate for such slack, which in practice, most mechanical systems have to a greater or lesser extent?
Of course, I may be completely misunderstanding your question, but please try to understand, when presenting with a piece of program code or similar, it is important to ensure the viewer, who does not know your project or see your bench, knows what you would like it to do, as well as what it actually does.
And it is usually helpful to provide exact web references when they are relevant. I guess you are starting with:
Is that correct? If so, is your project identical, or does it differ?
-------------
I hope these hints are helpful. I appreciate it is difficult for you to start asking for help in a new place.
Best wishes for your project, Dave
Hi Dave!
Thank you very much for the quick reply.
The link you mention is correct. My project is almost identical.Stepper motor and belt.
Is it something I can do to correct the mistake that has been made? Should I move my question to the workshop forum?
Haakon Th
@haakon-th Any design using a belt will have some slack; change it to a screw rod for a tighter fit. I am 99.99999% sure all the commercial motorized fences use that. It might even be wise to provide a vernier-type fine adjuster. mount a (sorry for the ASA, I don't know the metric equivalents) 8-32 screw in a rig that bears against the fence, so one turn moves 1/32, a quarter turn is 1/128 which is way beyond woodworking tolerances. I believe the Delta cabinet table saw uses that mechanism.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Hi Will!
Thank you very much for the quick reply.
Looking forward to trying the code you sent me. The mechanism is a stepper motor and belt. The backlash error is the same all the time. If I add or subtract 24 steps when the direction of travel changes, the result will be correct
Haakon Th
Hi Ron!
Thank you very much for the quick reply.
I'm sorry I made a mistake in the beginning.
Haakon Th
As Ron (@zander) has said, there'll always be some play in a belt; furthermore, it'll probably get worse as the belt ages and gets stretched from being pulled back and forth.
Using a screw to perform the move can reduce the backlash considerably. I have successfully used a T8 (8mm Acme threaded rod) with an anti backlash nut such as (remove quotes and change ".ca" to your country's code)
"https://www.amazon.ca/gp/product/B074JYFW6B/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1"
I'd recommend against the single part brass nuts that usually come with these rods, I find them very sloppy and not good for precise work. The addition of the second threaded section and spring to keep both threaded sections in compression is very good for reducing backlash.
You'd need to rotate the stepper 90 degrees and buy an adapter to connect the stepper shaft to the 8mm threaded rod.
Anything seems possible when you don't know what you're talking about.
@haakon-th It happens all the time, I should just have a standard response to copy/paste.
Another common new user mistake is not clicking the Reply link at the bottom right. That way a @xxxxx tag gets inserted automatically into your replay and I get an email telling me IF I am subscribed.
Don't be confused by the fact I live in Canada but don't really know metric, I am an old-timer and a lot of stuff here is still Imperial. I can handle temperature, speed, less so length, no knowledge of weights or volumes although I know a Litre and Quart are close.
Check out my other replies to you.
You said
I have built a measuring device (fence?) for my miter saw
In my country, the fence on a Mitre saw is at 90 degrees to the saw blade unless it is rotated to do say a 45-degree cut. The fence on that saw does not move. A tablesaw however does have a fence that moves to allow ripping wood to a specific width. Can you show a picture of the saw?
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Anti backlash is easy.
Speed( fast );
Stepto( target + 10 );
Speed( slow );
Stepto( target );
Hi @haakon-th,
The list of forums is at https://forum.dronebotworkshop.com/
Have a look down the list and start a new thread in the one you think is most appropriate. At a quick glance, you might choose between Project Corner and High Tech Hobbies. Recommend you copy over the details which are still part of the main discussion and build in any new items.
--------------
As a side comment, my only vaguely comparable experience is with a small commercial 3D printer, with the x belt moving the print head over about 25 cm maximum (and the bed similarly in the y direction), typically over a 15 cm range during a print, as few objects completely span the bed, which is only a quarter or less, of your 1 metre span. However, to make a reasonable print, this involves continual back & forth motions with a repeatability to hit the 'same spot' to 1/10 of a mm, and I suspect it usually much better than 1/10 of a mm.
So, whilst there may be software tricks to compensate for backlash effects, maybe the first place is to try to identify the true cause of the problem. Is the machine structure stiff enough, belt tension correct and so on?
Also note, the 3D printers, and I think your machine, do not step at a constant rate, but rather accelerate and decelerate. I notice your code has an acceleration parameter, but I don't know if the value to appropriate. Have you tried slowing the acceleration and step speed, to see if it reduces the backlash effect?
Also note, the 3D printers often use simple microswitches to determine a 'homing position', at power on, but after that they rely on absolute counting of steps. For X and Y, the small uncertainity in the microswitch operating position is of no importance. In the Z direction, they are moving to higher resolution, aiming towards 1/100th mm. It maybe worth trying a microswitch first, as it might meet your requirements.
Good luck, Dave
@haakon-th Any design using a belt will have some slack; change it to a screw rod for a tighter fit. I am 99.99999% sure all the commercial motorized fences use that.
Not so Ron.
Lead screws and ball screws have problems, expensive and above a certain length suffer whiplash.
Top commercial stops use rack and pinion - rock solid but with a bit of backlash. Easily corrected.
Cheap to good use timing belt. It's reliable but of course it is a spring so can give a different length depending on length+load.
Lead screws and ball screws have problems, expensive and above a certain length suffer whiplash.
Really ? I've never had a T8 with whiplash !
Anything seems possible when you don't know what you're talking about.
@hilldweller That's not my experience
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.