I am using 2 Arduino Uno, I uploaded GRBL on 1 of them, and connected encoder and different sensors to the second Arduino. I want to get the number of steps commanded from the GRBL, send them to the second Arduino, and compare the number of commanded steps with the real steps read by the encoder.
How the communication must be done between those 2 Arduinos, and is this approach applicable?
As far as I know that is not possible. GRBL can report the current position, e.g in mm.
Of course, you could modify GRBL to send the step position.
What is the end goal of this exercise?
You will need to modify the GRBL interpreter code to do that.
The goal is to send the number of steps of the commanded position from GRBL to the second Arduino. When the second Arduino receives this data, it compares this position to the real position reached by the motor from the encoder.
But I don't want the final position of each command, I need to compare each step alone, so I can detect slippage of the stepper motor.
Comparing step by step is pretty much impossible. If GRBL sends the current position in steps, by the time the second Arduino receives the data it will no longer be the current position. At a max rate of 20,000 steps per second the step position changes every 50 us.
So why do you want to detect slippage? What will you do with that information?
If you want to avoid missed steps, use a closed loop stepper driver.
I want the most cost-effective way, so open-loop steppers are the case.
You are right, especially when counting delays in Arduino communication.
So is it practical to compare the final position commanded by the GRBL with the real position from encoder.
In the same time, the second Arduino (without GRBL), will have current sensor and accelerometer connected to the same motor, so I can know the cause of the slippage (temperature, overload, etc..) from the sensor readings and send them to a mobile App that I can from it read all the states of my machine.
But the big question still, in how could the GRBL sends the info to the second Arduino and how the second Arduino reads the values?
Ok, I will just say "no" then. Maybe someone can prove me wrong.
No, the real question is why do you think GRBL in not capable of moving to the correct location?
GRBL is capable of moving to the correct position. But overload, heat, power issues, mechanical issues in the system could lead to a slippage in the stepper, and I want to detect this slippage by comparing the GRBL (commanded position), with the real position reached (from encoder).
Also I have accelerometer and current sensors to know the cause of this slippage for further experimentations.
And ignoring errors introduced by the encoder?
if the encoder is calibrated and tested several times before implementation, the errors (if occurred) can be ignored with respect to a slippage that will occur by force, because of experiment.
Ok, but what scheme do you have that will match the stepper steps to the encoder steps? Are the always one-to-one?
I am using an AS5600 magnetic encoder with very high resolution comparing to the motor steps. As the magnet is directly sticked to the motor shaft.
Then, it will lead to a 1 to 1 always(hopefully).
Are you accumulating the differences over the movement time? When do you synchronize the beginning point of both the stepper and the encoder? How often?
I was wondering what sort of resolution can be obtained from AS5600, and found this article:
There it says :
The AS5600 is capable of 12-bits resolution which equates to 360/4096=0.087 degrees. This resolution assumes ideal magnet positioning and no distortion of the magnetic field. In practice I observed variations of up to 2 degrees which can be reduced using interpolation.
A method for reducing these errors to less than 0.5 degrees is explained.
With x16 microstepping. a 1.8 deg typical stepper gives 3200 steps. 0.5 deg is about 4.5 steps.
I recall there were some open source closed loop stepper drivers that can be used as a drop in replacement for use in 3d printers etc, they never really caught on (e.g. Mechaduino). Largely speaking they are not really needed. I notice there are some commercially available for Nema17 costing around $20 (which may be Mechaduino clones, not sure). I can't vouch for their quality, I might try one.
Ok, thanks.
I just wondered if I can experiment these results practically in my project.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.