For an art installation im using a lot of technical aspects of a CNC machine, however what I am making is not exactly that. My installation consists of two axis powered by two Nema 23 stepper motors, two DM556T drivers and using a v3 CNC shield for my Arduino. Both axis have two limit switches and as of now everything works out fine. The only problem is that I was recommended to home my installation, since it would be beter for my installation to know when it is nearing a limit switch. I do note use GRBL and I am not experienced with actual CNC machines. Is there a possibility to home, or set a 0 point in a CNC-like installation without using CNC software and just Arduino?
Hello, Welcome to the Arduino Forum. This guide explains how to get the best out of this forum. Please read and follow the instructions below. Being new here you might think this is having rules for the sake of rules, but that is not the case. If you donât follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frustrating for you and frustrating for us. The people who try to help with your project.
It will help you get the very best out of the forum in the future.
Mention if you are using AI generated code it is important information.
Your OS and version can be valuable information, please include it along with extra security you are using. Antivirus etc.
Always list the version of the IDE you are using and the board version if applicable.
Use quote or CODE tags to add error messages as an attachment NOT a picture.
Robin2's simple stepper code tutorial will show how to write code for a stepper without a library. To keep track of the stepper current position, add or subtract steps from a currentPosition variable depending on the state of the direction variable.
To home, step 1 step toward the switch in the direction of the home position, check the state of the limit switch, step 1 step, check the state, rinse, repeat till the switch changes. You are home. Set the value of the currentPosition variable to 0.
You may need to add code to move off the switch if the machine starts on the switch and you want to make sure that it is at home. Move some steps back off the switch and home as usual.
Do an initial home at a faster speed then back off and home again at a slower speed (like Grbl does) to increase accuracy and repeatability of homing.