EXAMPLE 1

This example demonstrates a complete closed-loop climate control system using Analog Input 3 (temperature sensor) and Relay Output 3 (heater element).

To prevent the heating loop from running autonomously without supervisor permission, we use Memory Bit 3 (named regulator) as a virtual master toggle switch.

  • Authorized users can send an SMS with the text "ON" to arm the regulator (M31 = 1) or "OFF" to disarm it (M31 = 0).
  • When the regulator is active (M31 = 1), the heater kicks on automatically if the temperature drops below 20°C.
  • As a safety precaution, if the temperature rises above 20°C, the heater is turned off unconditionally, regardless of whether the regulator switch is armed or disarmed.


SME SMS FROM USER

$N24)ON SMS LAST TEXT ) ON





regulator=on





trigger event is the receipt of an SMS from an active user.

The first condition to check is that the text of the last SMS received contains the word ON.

The first action contains the command that sets to 1 the memory bit that we have called regulator.


SME SMS FROM USER

$N24)OFF SMS LAST TEXT ) OFF





regulator=off





trigger event is the receipt of an SMS from an active user.

The first condition to check is that the text of the last SMS received contains the word OFF.

The first action contains the command that resets to 0 the memory bit that we have called regulator.


A3 ANALOG INPUT 3

$A32<20 ANALOG INPUT 3 AVERAGE < 20

$M31=1 MEMORY BIT 3 STATUS = 1




out3=1





trigger event is the end of the analog input 3 measurement period.

The first condition to check is that the average value measured by analog input 3 is less than 20.

The second condition to check is that the memory bit 3 called regulator is active.

The first action contains the command that turns on output 3.


A3 ANALOG INPUT 3

$A32>20 ANALOG INPUT 3 AVERAGE > 20





out3=0





trigger event is the end of the analog input 3 measurement period.

The first condition to check is that the average value measured by analog input 3 is greater than 20.

The first action contains the command that turns off output 3.

EXAMPLE 2

An incoming call from strangers (therefore non-users) generates a 3-second pulse on output 2 used to open an electric gate.

A limit switch is connected to digital input 2 which closes when the gate is completely closed.

Simultaneously with the output we activate the memory bit 2 specifying the switch-off after 2 minutes. After this time we will check the status of the gate and if it is still open we will send an alarm SMS.


CAU CALL FROM UNKNOWN






out2=1,3

mem2=1,120




trigger event is the receipt of a telephone call from unknown.

The first action contains the command that closes the output 2 contact for 3 seconds to open the gate.

The second action contains the command that activates the memory bit 2 for 120 seconds, to give the gate the time to close.


M2 MEMORY BIT 2

$M21=0 MEMORY BIT 2 STATUS = 0

$I22=0 INPUT 2 STATUS = 0




AT+SMS=+391234,"Gate locked open"





trigger event is the state change of the memory bit 2.

The first condition to check is that the memory bit 2 is off (0).

The second condition to check is that the digital input 1 is open (limit switch open because the gate has not closed).

The first action contains the command that sends an SMS message to the number +391234 with the text "Gate locked open".