In a project I worked on, I needed to set an alarm if the rotation of a component stopped. I think this is what you would like to do. The method I used was to mark the time (millis) whenever the reed switch I used closed. If the switch did not close again within a set time, the alarm was set. The snippet below is what I believe is what I used to accomplish that. Perhaps you can use the same method.
if(digitalRead(switch_pin) == LOW){
alarm_millis = millis();
digitalWrite(switch_led, HIGH);
}
else{
digitalWrite(switch_led, LOW);
}
if ((millis() - alarm_millis) >=10000){
digitalWrite(alarm_pin, HIGH);
}
As far as making your own standalone Arduino board, I did that a couple of times until I realized it's so much more convenient, easier and perhaps even cheaper to embed a cheap Nano into a printed circuit board and go from there.
P.S. I'm working on my Z axis. I'd like to see your project. Please PM me.
- Scotty