GSM Remote Control – Gate Control
Part 2 – Schematic

By on January 9, 2011

The entire remote control is handled by a PIC that controls the GSM/GPRS module’s activity and gives commands to the two relays.
Having said that, let’s take a better look at the electric scheme: power is supplied by continuous voltage, not always stabilized (applied to PWR + and -) at a value between 5 and 32V; such voltage is filtered at the bottom by the diode protecting against polarity inversion (D1) through condensers C1 and C2. Fuse F1 enables us to protect both the circuit and the power source in case of a short circuit in the integrated regulator discussed below, which is necessary to obtain the 4 volts needed for the rest of the circuit to work. The switching regulator is based on a MC34063 chip, utilized in the classic configuration of series PWM regulators charged by inductance, whose output voltage depends on the energy stored in L1; the regulator is stabilized by the component demoted from resistive divider R2/R3, which is needed to set at 4V the component leveled at the top of both C4 e C5. The 4 volts at the bottom of the abovementioned condensers are sufficiently filtered by other condensers placed on the power lines of the microcontroller and of the GSM module; which presents, during transmission, absorption peaks compensated for by C7, C8, C13, C14, C15 e C16, thus avoiding that an impulsive current request may cause the microcontroller to be disturbed.

Gate Control Schematic
Schematic Diagram

The microcontroller used to handle the whole system is a powerful PIC18F46K20-I/PT by Microchip, which we use in its configuration with an internal clock oscillator; both the scheme and in the printed circuit are nevertheless equipped with external quartz, which we included for those who may want to modify the firmware and develop specific applications requiring an external oscillator.
Once the I/O lines have been initialized, the microcontroller verifies the logical state of the opto-isolated inputs at voltage level (RB4 and RB5) as well as that of lines RC4, RC5, RD0, RD3, RX, which are needed to receive the main notifications from the cellular module; more specifically, RD3 is used to detect incoming calls (it interfaces with RI of the cellular module), while RC4 controls the GSM’s reception led , whose output (dubbed STATLED) pulsates at a frequency of 1 Hz when the module is searching for the radio-mobile network, and supplies impulses at logical zero, lasting 0.5 seconds and followed by a 2-second pause, when the module has grasped the signal. The frequency and duration of the impulses enable the PIC to understand the conditions of the radio-mobile network range and to behave accordingly; for example, if the opto-isolated input goes off and it needs, therefore, to send SMSs or make calls, but detects that the cellular module has no reception, it waits for the Telit module to get reconnected to the GSM/GPRS network before making any calls. The attempt to make calls or send SMSs is repeated only three times, after which the device gives up.
The microcontroller contains a UART accessible via pins 44 (transmission) and 1 (reception) which it uses in order to communicate with the cell phone; more precisely, through the first pin (TX), it cyclically questions the module in order to check whether any SMSs have been received, whereas both TX and RX are used to communicate with the GSM module when making calls and receiving or sending messages. Regarding the UART, it is important to note that the following control signals are used: CTS (Clear To Send), RTS (Request To Send) and DCD (Data Carrier Detect), which correspond to those of the cellular module being used. They complete the set of I/Os destined to the cell phone, the RC5 and RD0 lines: the former controls the turning on and off of the GSM (though a transistor placed in the small board of the cell phone), while the latter takes care of resetting the cell phone.
As for the relay, it is controlled by the microcontroller’s RE2 line, through two NPN transistors driven by current amplifiers; line RE2 controls transistor T1. A high logical state causes the transistor to saturate, thus determining the amount of current flowing in the coil of the corresponding relay. Each instance of activation is signaled with a LED, powered along with the coil. In order to protect the transistors’ collector junction as it goes from saturation to inhibition, when the relay’s coil inductance generates peak inverse voltage, we connected a diode parallel to the coil, and such diode eliminates unwanted impulses. The entire relay exchange is available so as to allow for the handling of circuits requiring a normally closed contact or a normally open one. Still regarding the relay, we should note that, although it is a 5-volt-coil type, in our circuit it works on just 4 volts; this is possible because the model we chose can prompt relay exchange even at less than 3.5 volts.
The PIC is programmed in-circuit, through the ICSP connector, which is attached to lines MCLR, PGU and PGC; the microcontroller’s power and mass are also connected to the ICSP. But we didn’t think that was enough, so we included a serial communication interface enabling users to program data related to the various functions (e.g., list of phone numbers, handling of input levels, text of SMSs sent by the circuit following commands, etc.) through a PC: this allows users to program their remote control before activating it, thus avoiding having to send configuration SMSs, which can be used at any time, but are best used only once the system has been installed in situ. Since the UART is already busy communicating with the cellular module, serial communication occurs via lines RE0 and RA5, exploited, respectively, as TX and RX; AN3, assigned to the internal A/D converter, is needed to detect the presence of the 5 volts and therefore the connector insertion. The serial interface is at a TTL level and can easily be connected to a USB converter USB such as FT232 by FTDI (www.ftdichip.com), in order to interface the microcontroller with a PC equipped with USB. For the interface, you can use FT782M, a small module produced by Futura Elettronica (www.futurashop.it), already equipped with a pin-strip connector at a pitch of 0.10 inches that can be directly inserted in our circuit, on the TTL connector, a female SIL at a pitch of 0.10 inches.

FT232RL USB/TTL Converter
FT232RL – USB/TTL Converter by www.ftdichip.com

Still regarding the device’s configuration, it is important to note that the corresponding data are not saved in the microcontroller’s EEPROM, but in an external memory chip, dubbed 24FC256-SN; it is a 256- kbit EEPROM CMOS with serial access, and with an I²C-Bus interface. In order to communicate with such chip, the microcontroller initializes its I/O lines RD4 and RD5, used, respectively, as SDA (data line) and (clock line). Moving the remote control’s configuration data into an external memory allows us to exploit the entire internal EEPROM to enhance its available functions.

About Staff