Hi all! I'm working on a project where I am working on hooking up three encoder wheels to monitor three roller shades driven by one motor.
I want to have the encoders count several times over a specific time range and compare the three counts.
I would like to repeat this action for 20 or so seconds, if during the time the counts are off by more than 1 or 2 (one encoder might start high, while another is low) I want to trigger a relay to open (this bit isn't an issue).
The three roller shades are connected together using two gearboxes between them, my friend spent a fortune getting the boxes made and they are too "fragile", once in a blue moon one will break and the shades will hang and rip, hence me building a little device to monitor the three rollers for him.
The average travel time is 20 seconds down and 20 seconds up, so during that time I want to watch their rotation speed to be sure they all match (they rotate at 20 RPM), I was looking at a sensor like the Cytron encoder from RobotShop, but others may be used.
I'm thinking a function that is called when the down or up is triggered on the shades, and if the counts are too far off when comparing, I kick the stop relay. Does all this make sense?
My issue is that I'm looking at the interrupt and millis routines, and I see that the millis routine won't run when using and interrupt.
I was planning to: 1. monitor the pulses from encoder A over x time (millis) & store value 2. then encoder B over same range & store value 3. then encoder C over same range & store value 4. Compare the counts, if in tolerance repeat, otherwise kick the stop relay.
If Millis doesn't work during an interrupt, this course of action seems out the window. Am I right? About it not working?
Then it dawned on me that there isn't a way to say (Xcount == Ycount == Zcount within 3) to see if we have a shade that is hung.
Or is there?