A few parameters are necessary to make the controller useful:
- What is the positive direction of a motor? => boolean ReverseMotor1 or ReverseMotor2 parameter (could be done in hardware by inverting the polarity of the motor, but easier in software)
- Does motor M1 or M2 starts first? One of the two gates has a notch to mechanically fill the gap between the two gates, so we have to know which motor to start first => integer FirstMotor parameter (2 possible values: 1 or 2, for motor M1 or M2, respectively)
- How much time after the first motor starts does the controller wait until he can start the second motor? => unsigned integer DelayInMillisec (from 0 to let's say 65535 milliseconds, which is a little more than a minute)
- What is the usual time to open or close a gate? We know the approximate speed of each motor, so if the process is too long before the controller detect a peak currect signalling a mechanical limit of the arm, there might be something wrong. We should stop the considered arm and report an alarm condition (to the raspberry pi, for example) => unsigned integer (32-bits?) OnTimeMotor1inMillisec and OnTimeMotor2inMillisec parameters are compared to the activation time of each motor to detect a failure..
Secondary parameters can be implemented:
- unsigned integer InhibitPeakCurrentDelayInMillisec parameter: when a motor starts, a peak current, several time the nominal current, is necessary to beats its inertia and starts moving. As we use the peak current to dectect a mechanical limit, we have to inhibit this function for some time after the motor starts, unless it would stop immediately and couldn't reach its position.
- unsigned integer PeakCurrentOvershootInPercent (0-100%, or more, ...) parameter (dupliacted for motor M1 and M2): relatively to its nominal current, a stall condition of the motor is determined by a coefficient based on its nominal current. Let's say that if the current ramps up to 100% its nominal value for a determined period of time (1 second, maybe), the gate is probably stopped by a mechanical obstacle. So, we have to stop it.
- unsigned integer MiniTimeWindowInMillisec parameter: minimal amount of time the overshoot in current must be to detect an obstacle. It prevents a gust of wind to stop the motor it it lasts less than this time window.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.