The operation should be very robust.
- The system should be able to execute for several years without human intervention.
- The primary function is to listen for a ring signal. Everything else is optional. Therefore the code is designed around a loop that receives serial data and searches for the text "RING" in the data stream.
- No error condition should cause the main loop to stop executing.
- The main loop regularly requests the A6 module to report the network status and signal strength. This is to ensure that the serial connection does not time out.
The operation should be very predictable.
- Invocation of the operation is idempotent. No matter how many times the phone number is called, the end result will always be that the gate will be closed.
- No matter what is the starting state when the phone number is called, the end result will always be that the gate will be closed.
The system should be easy to maintain.
- In case of an unexpected fault, an untrained user can reset the system by turning the power supply off and on again.
The system should use whatever electrical power is available.
- The voltage available is unpredictable. Therefore, the system is designed to use a single 5-volt supply, and the conversion to 5-volt is left as an external component.
- I personally use dx.com/p/400209 to generate 5-volt, 2-amp from the 24v DC that is available from the NET230N gate controller.
- A capacitor is placed across the 5-volt supply because the supply from the gate controller may be noisy during gate operation.
The system must recover gracefully from a power failure.
- Pull-down resistors and capacitors are used on the transistor bases to prevent any accidental trigger of the gate before the Arduino Nano has time to reset.
The system must recover gracefully from a GSM network disconnection.
- The Arduino program does not depend on the state of the GSM network connection.
The PCB should be as small as possible, because space may be limited in the box for the gate electrics.
- The main modules (Arduino Nano and A6 module) are mounted on terminal strips to allow other components to use space underneath.