Close
0%
0%

GSM-connected remote electric gate

Allows a user to open and close an electric gate by making a simple phone call

Similar projects worth following
Uses an Arduino Nano to monitor the status of an A6 GSM/GPRS module. When an incoming call is detected, the Arduino Nano opens the electric gate.

This project could be useful as the basis of any project that needs to trigger an action using a phone call.

This project was designed to add a GSM control to a DEA NET230N electric gate.

The NET230N expects inputs to be open-collector style.

The basic functioning of this project is...

  • An Arduino Nano monitors the serial output of an A6 GSM/GPRS module.
  • When an incoming call is detected (A6 module sends "RING") the Arduino opens the gate, waits 3 minutes, and closes the gate.

Some problems during the project...

  • (Fixed) The A6 module communicates at 115200 baud. This is is too fast for the Arduino SoftwareSerial library. The hardware serial port is used by the USB port on the Nano, so this is not available. The solution was to use dedicated interrupt-driven code to implement a 115200 baud receiver. Probably an easier solution would be to use an Arduino Pro Mini which doesn't have a USB adaptor, but I didn't have a Pro Mini available when I was designing the system. Maybe next revision...
  • (Not fixed) It is really difficult to reset the A6 module. The RST pin must be pulled very low (<0.05 volt) at a fairly high current (70mA). This means that a MOSFET or a relay must be used to pull the RST pin low. R5 and Q3 are not needed, these are part of an experiment that didn't work. The Arduino does not seem to be able to drive a MOSFET (Q3) gate directly, maybe I should add an NPN transistor between R5 and Q3. Luckily, the A6 module seems very reliable and I have seen no need to reset it yet. So this is very low priority to fix.
  • (Not fixed) The serial debug caused a lot of trouble, and it is commented out in the code. The SoftwareSerial library really messes up the handling of interrupts, so communications with the A6 module can be lost when the debug port is being used. Luckily, the system is very reliable, so I don't have much use for the debug function.

Note: Before placing a SIM card in the A6 module, make sure (by placing it in a mobile phone) that the security PIN number is disabled.

gsm_status_v4.ino

Software (sketch) for Arduino Nano.

x-arduino - 15.62 kB - 06/06/2017 at 09:08

Download

IMAG0644.jpg

Completed PCB, with A6 GSM/GPRS module, Arduino Nano, and an optional serial-to-USB adaptor for the debug interface.

JPEG Image - 2.41 MB - 06/06/2017 at 10:14

Preview Download

IMAG0646.jpg

Bottom view of PCB. Note that this version of the PCB uses different pin numbers for the outputs from the Arduino. Check the Fritzing diagrams for the correct layout.

JPEG Image - 2.02 MB - 06/06/2017 at 10:19

Preview Download

IMAG0645.jpg

Top view of PCB. Note that this version of the PCB does not include the optional pull-down resistors and capacitors on the transistor gates.

JPEG Image - 1.75 MB - 06/06/2017 at 10:16

Preview Download

Gates 170603.fzz

Fritzing files for circuit diagram and PCB layout.

fzz - 32.63 kB - 06/06/2017 at 09:06

Download

View all 7 files

  • 1 × A6 GSM/GPRS development board dx.com/p/433790
  • 1 × Arduino Nano Any Arduino with at least a 328P processor could be used. You also need a PC with the Arduino Integrated Development Environment.
  • 2 × NPN transistor Any NPN transistor is acceptable
  • 3 × 1K resistor Anything in range 200 to 1K is acceptable
  • 2 × 4K7 resistor Optional, used to pull down the transistor base if the gate module is sensitive to spikes during power-on

View all 8 components

  • Project completed - and reborn

    bredman3 days ago 0 comments

    This project is now completed. The system has been working for 4 weeks without any problems.

    I have been asked by a friend to build something similar to remotely control the heating in his holiday home, and I feel that a re-design is needed to make it more generic. Therefore, a more generic (and simpler) version of this project has been reborn as https://hackaday.io/project/25572-relay-controlled-by-phone-call

  • Ideas for next revision

    bredman06/07/2017 at 10:54 0 comments

    Use Arduino Pro Mini instead of Arduino Nano.

    • This solves the problem with communication to the A6 module at 115200 baud. The Pro Mini does not have anything connected to the hardware TX/RX pins, this means that there is no need to use any complex code for the serial interface to the A6 module.
    • The Pro Mini is much smaller than the Nano. Therefore the Pro Mini could probably fit under the A6 module, reducing the size of the PCB.

    Use a relay board to drive the external lines.

    • This eliminates the need for transistors, resistors, capacitors, and terminals.
    • This allows connection to multiple types of external equipment, for example directly to a remote control fob.

  • Design requirements

    bredman06/06/2017 at 12:41 0 comments

    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.

View all 3 project logs

  • 1

    Programming instructions:

    • Load the Arduino sketch in the Arduino IDE on your PC.
    • Connect your PC to the mini-USB port of the Arduino Nano. Note that you do not need to remove the Arduino Nano from the PCB. It does not matter if power is applied to the A6 module or not.
    • In the Arduino IDE, set menu option Tools/Board to "Arduino Nano w/ ATmega 328"
    • Use the Arduino IDE to upload the sketch to the Arduino Nano.
    • If an A6 module is available and powerd on, the LED on the Arduino Nano should begin to flash approximately once per second.
    • If the flash is mostly off/partly on, the A6 module is not reporting a successful connection (this is not very reliable).
    • If the flash is mostly on/partly off, the A6 module is reporting a successful connection to a GSM network.
  • 2

    Installation instructions:

    • Connect the gate "CLOSE" and "OPEN" wires to J1. It is assumed that the gate controller expects an open-collector connection. For any other type of connection, J1 may be used to drive a pair of relays which are connected to +5v or +12v.
    • Connect ground of J2 to ground of the gate controller. For example with a DEA NET230N, ground is available on terminal 28.
    • Configure the gate controller to use the new connections to close and open the gate. For example with a DEA NET230N, connect terminal 25 as "CLOSE", connect terminal 27 as "OPEN", set INPUT2 as CLOSE (Parameter 018, Data 004), set INPUT1 as OPEN (Parameter 017, Data 003).
    • Disable the PIN security on the SIM card, by placing it in a mobile phone and disabling SIM security.
    • Place the SIM card in the A6 GSM/GPRS module (module must be unplugged from the PCB to reach the SIM slot).
    • Apply 5 volts to J2 - or - apply 5 volts to the micro-USB port on the A6 module. Note that the power supply must provide at least 1 Amp. Do not use the mini-USB port on the Arduino Nano to apply power.
    • Wait at least 30 seconds for the A6 module to register on a network.
  • 3

    User instructions:

    • Make a phone call to the SIM card.
    • The call will automatically end after 2 rings.
    • The gate will open (if it is not already open).
    • After 3 minutes, the gate will close.

View all 3 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates