Hello,
I have bought about 6 units of XY 2.02 plotter kit a few months ago. We strongly modified the original hardware design to make a somehow more compact version of the plotter.
In the original firmware there was no mecanism to return to home. Only the firmware was checking for the limit switch so that the motors could not force “outside the boundaries”. and I had not had to implemented a “go back home” function myself until recently
In parallel, we have pushed the numbers so that the plotter would move faster. We do not know if it is related to our problem, but still worth mentionning i guess.
Some users reported that sometimes it would look like there would me missed steps. We tought it would be caused by us pushing the steppers too much compared to the inertia of the moving parts.
Until one user simply unplugged all 4 limit switches and reported that this problem almost entirely vanished.
I trying to implement the goHome() function myself now. The code works, but surprisingly, the limit switches on Y axis reports false positives. I other words the digitalRead(mypin) claims the switch is on, while it is not.
That issues does not seem to happen at all on X limit switches.
I have implemented the following debounces strategy for my homing function (firmware based on the much cleaner xybot.ino of mDraw)… but it is not sufficient
// will return the digitialRead value read consecutively "count" times with 10ms between each read
int digitalReadDebounce(int pin, int count = 50) {
bool done = false;
int c = 0;
int previous_status = -1;
int current_status = -1;
int i = 0;
while(!done) {
current_status = digitalRead(pin);
if (current_status == previous_status || previous_status == -1 ) {
c++;
} else {
c = 0;
}
done = c >= count;
i++;
delayMicroseconds(10);
}
//Serial.print("status_"); Serial.print(pin); Serial.print("="); Serial.print(current_status); Serial.print(" "); Serial.print("i="); Serial.print(i); Serial.print("\n");
return current_status;
}
void goHome()
{
goHomeOnce();
}
void goHomeOnce()
{
// stop on either endstop touches
// when digital read is 0 => connection
// 1 => disconnection
bool done = false;
bool x_done = false;
bool y_done = false;
echoEndStop();
while(!x_done || !y_done) {
if (!x_done) {
if (digitalReadDebounce(xlimit_min)==1 && digitalReadDebounce(xlimit_max)==1) {
stepperMoveA(motorAbk); // to reach to left corner, we go backwards on X
} else {
Serial.println("Done X");
x_done = true;
}
}
if (!y_done) {
if (digitalReadDebounce(ylimit_min)==1 && digitalReadDebounce(ylimit_max)==1) {
stepperMoveB(motorBfw); // but forward on Y
} else {
Serial.println("Done Y");
y_done = true;
}
}
delayMicroseconds(stepdelay_min/10);
}
posA = 0;
posB = 0;
curX = 0;
curY = 0;
}
both
digitalReadDebounce(ylimit_min)
digitalReadDebounce(ylimit_max)
keep reading wrong values and i dont know why
I have double check all connections
I have tried to move slower
nothing works
anyone has any idea ?