- TORPEDO: an all-purpose switched-mode power supplyPosted 1 week ago
- The SEPIC switching convertersPosted 3 weeks ago
- Discover and Design innovative applications in Wireless Power with UsPosted 4 weeks ago
- Octopus, a “tentacular” shield for Arduino and FishinoPosted 1 month ago
- Keychainino: a programmable, playful Key RingPosted 1 month ago
- Let’s Build an open source Quadcopter – Part2Posted 2 months ago
- Let’s Build an open source Quadcopter – Part1Posted 2 months ago
- An open source 3D Scanner made with Raspberry PiPosted 2 months ago
- Open Wheels 2: an all-in-one board to control any of your robotic ProjectsPosted 2 months ago
- GuppY: Fishino becomes NanoPosted 2 months ago
GSM Remote Control – 2 IN and 2 OUT DTMF
Part 2 – Schematic
Let’s now look into the schematic diagram; in it you can note the usual Microchip microcontroller governing the GSM/GPRS module activity, controlling the logical condition of the two opto-isolated inputs and managing the two relays. Moreover, the PIC interacts with the DTMF decoder in order to recognize the dual tones used for the phone selection in modern telecommunication systems; it is the recognizer the one that allows the reception of DTMF commands.
Power is supplied by continuous voltage, not always stabilized (applied to PWR, + and -) at a value between 5 and 32 V; such voltage is filtered at the bottom by the diode protecting against polarity inversion (D1) through condensers C1 and C2. Fuse F1 enables you to protect both the circuit and the power source in case of short circuit in the integrated regulator discussed below.
The microcontroller, the GSM module and the rest of the circuit function with 3.6 V obtained from a switching (U1) based on the integrated MC34063, used as a PWM regulator series winding inductance, whose output tension depends on the energy stored in L1; the voltage output is set by the feedback made by the resistive divider R2/R3, receding to pin 5 part of the output component. C4 and C5 level the impulse produced by U1.
The downstream voltage of these capacitors is then further filtered by the capacitors (C7, C8, C13, C14, C15 e C16) placed on the supply lines of the microcontroller and the GSM module, used to meet the peak absorption from the mobile, preventing it from spreading to the logic the disturbing impulses that follow.
The microcontroller used to manage the remote is a PIC18F46K20-I/PT which, once the I/O lines have been initialized, 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, 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 “field LED”, whose LED output pulses at a frequency of 1 Hz when the module is searching for the telephone network, and while supplies an impulse at logical zero, lasting 0.5 seconds, and followed by a 2-second pause, when the module has grasped the signal.
The UART inside the PIC, accessible via pins 44 (transmission) and 1 (reception) is used to give the commands to the mobile; more precisely, through the first pin (TX) it cyclically questions the module to check whether any SMS has been received, whereas both TX and RX are used for the communication between the microcontroller and the GSM module when making calls and receiving or sending messages.
Regarding the UART, 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. The GSM is also managed by the RC5 and RD0: the former controls the turning on and off of the GSM (through a transistor placed in the small board of the mobile), the latter resets the mobile.
The inputs are read via RB4 and RB5, both set as inputs and with an internal pull-up: each of them reads the state of the output transistor of the related optocouplers (the optos belong to the TLP181).
Every one of the two available inputs (IN1 and IN2) is active when subject to a voltage value between 3 and 30 V.
The collector of each optocoupler is connected to a pin of the microcontroller (14 to U4 and 15 to U5).
When input IN1 receives a voltage of at least 3 volts, the optocoupler’s LED is on and the output phototransistor is conductive, so that the collector (pin 5) is at about zero volt due to the drop on the internal pull-up resistor set during the initialization of I/O. If the input is not polarized, the opto-isolator gets inhibited and its pin 4 is at a high level.
Inputs IN1 and IN2 are read by means of optocouplers so as to allow the microcontroller to remain electrically isolated from the circuit on which it is to read the voltage; every input line is protected by a resistor that prevents the excess of current in the LED in the corresponding optocoupler.
Currently, resistances are 4.7 kohm, but they can be adapted to the tension you want to apply to every single input, by resizing them with the following formula:
R = (Vin – Vled) / 0,008
where Vin is the incoming voltage, Vled is the diode voltage drop (about 2 V) and 0,008 corresponds to a 8 mA current.
For instance, to apply 150 V tension you need to use a value resistance equal to:
R = (150 – 2) / 0,008 = 18.500 ohm
approximated to 18 kohm.
As for the relays, they are controlled by the microcontroller’s RC0 and RE2 lines, through two NPN transistors driven by current amplifiers; lines RE2 and RC0 control the T1 and T2 transistors respectively.
A high logical state causes the transistor to saturate, thus determining the mount 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 peaks of inverse voltage, we have connected a diode along with the coil which eliminates the unwanted impulses.
From the relays the complete exchange is made available so as to allow for the handling of circuits requiring a normally closed contact or a normally open one.
For PC configuration there is a serial communication interface to which you can connect the TTL/USB converter (placing it in the adequate pin-strips) to interface the unit via USB. Since the UART is already busy communicating with the cellular module, serial communication occurs via lines RE0 and RA5, respectively used as TX and RX; AN3, assigned to the internal A/D converter, all this is needed to detect the presence of the 5 volts and therefore the connector insertion.
For the PC connection we have prepared a special utility that runs on Windows, that we will describe next month.
Still about configuration of the unit, note that the corresponding data is not saved in the microcontroller’s EEPROM, but in an external memory chip, dubbed 24FC256-SN; it is a 256 EEPROM CMOS with serial access and 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 SCL (clock line).
Moving the configuration data of the remote into an external memory has allowed us to restrict the internal EEPROM of the microcontroller to the operating data, thus extending the remote’s possibilities, that is allowing the user to store, for instance, more configuration data.
To load the firmware in the microcontroller we have prepared an ICSP interface, headed to lines MCLR (pin 18) PGD (pin 17) and PGC (pin 17) of the U6 and the ICSP connector; to this also arrives the mass connection.
To conclude with the description of the electric scheme, let’s talk about the DTMF dual tone recognition, with the aid of the U7: it is a MT8870, a chip able to differentiate the 16 dual tones of the standard Dual Tone Multi Frequency, thanks to a complex the clock signal generated by its internal oscillator, related to pins 7 and 8 and quartz Q2.
Every time it recognizes a dual tone, U7 presents in a binary format the corresponding number to outputs Q1 (less important bit), Q2, Q3 and Q4 (most important bit); numbers from 0 to 9 are represented by binary combinations from 000 to 1001, while A, B, C, D, * and # are expressed by the rest of the combinations from 1010 to 1111. The MT8870 provides an output of a latch that allows to maintain on Q1÷Q4 the logical combination corresponding to the last read dual tone; so as to avoid that when receiving consecutive and equal dual tones the reading device is deceived; the chip uses line STD (pin 15) which switches from one to logical zero when the component identifies a dual tone.
Our microcontroller reads the STD through line RD1, distinguishing the reception of many consecutive and equal dual tones and correctly identifying possible codes sent from the mobile. Note that the MT8870 input has been connected to the GSM audio output because the dual tones transmitted with a common phone or with a mobile travel by the voice channel.