Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:sw:01-mervis:sending-sms-hidden [2020/05/13 08:02]
avsetula
en:sw:01-mervis:sending-sms-hidden [2021/09/02 07:52] (current)
avsetula
Line 1: Line 1:
-====== Sending SMS ====== +<​html><​div class="​version-switch">​ 
-Some of our PLCs are equipped with LTE modem capable of sending SMS. In this tutorial we will learn how to configure such PLC and how to use function block for sending SMS.+  <a href="/​en:​sw:​01-mervis:​sending-sms-lte-hidden"><​div>​Patron / Axon LTE</​div></​a>​ 
 +  <a href="#​sending_sms"><​div class="​actual-version">​Neuron GSM</​div></​a>​ 
 +</​div></​html>​
  
-For sending SMS over LTE modem, you don't need to configure the modem as described in [[lte-configuration-hidden|]]. Insteadyou need to configure ​**Alarm channel**. Double click on the **PLC** in the **Left panel**. Select a **Messaging** subpanel, right click on the blank list of channels ​and select **Add alarm channel** from the context menu:+====== Receiving/sending SMS ====== 
 +<WRAP group> 
 +<WRAP half column 80%> 
 +[[https://​www.unipi.technology/​cs/​unipi-neuron-s103-g-p107|Some of our PLCs]] are equipped with a GSM module that is capable of sending and receiving SMSIn this tutorialwe will learn how to configure ​such PLC and how to use function blocks for sending SMS. 
 +</​WRAP>​ 
 +<WRAP half column 16%> 
 +;;# 
 +<​html><​span class="​dev-tag dev-neuron">​Neuron&​nbspS103-G</​span></​html>​ 
 +;;# 
 +</​WRAP>​ 
 +</​WRAP>​
  
-{{:​en:​sw:​01-mervis:​sending-sms-01-add-alarm-channel.png?​direct|}} 
  
-A new alarm channel will appear. By default it is filled ​with preconfiguration ​for sending emailsClick on the **Type** (now prefilled with "​Smtp"​) ​and change it to **Gsm**:+===== Modem configuration ===== 
 +First, you need to set up communication ​with the modem, ​for this the **Alarm channel** is usedDouble-click ​on the **PLC** in the **Left panel**. Select the **Messaging** subpanel, right-click on the blank channel list and select ​**Add alarm channel** from the context menu:
  
-{{:​en:​sw:​01-mervis:​sending-sms-01-type-gsm.png?​direct|}}+{{ :​en:​sw:​01-mervis:​sms-gsm1.png?direct |}}
  
-Move over to the channel'​s properties and change the **Port Number** to **LTE**:+----
  
-{{:en:sw:01-mervis:sending-sms-03-port.png?​direct|}}+A new alarm channel will appear. By default, it is set to send e-mail messages. Click on the **Type** (now prefilled with "​Smtp"​) and change it to **Gsm**:
  
-If the SIM card is protected with a PIN code, enter it, otherwise leave empty:+{{ :en:​sw:​01-mervis:​sms-gsm2.png?​direct |}}
  
-{{:en:sw:01-mervis:​sending-sms-04-pin.png?​direct|}}+----
  
-Most modems (UniPi'​s ​as well) need initialization commands. Click to three-dot icon next to **AT Commands Definition**. A window will pop up:+Move over to the channel'​s ​properties and change the **Port Number** ​to **COM1 (TTL)**:
  
-{{:​en:​sw:​01-mervis:​sending-sms-05-at-commands.png?​direct|}}+{{ :​en:​sw:​01-mervis:​sms-gsm3.png?direct |}}
  
-In the drop down menu select the correct modem. For UniPi Axon product line it is **UniPi Axon LTE**:+----
  
-{{:en:​sw:​01-mervis:​sending-sms-06-lte.png?​direct|}}+If the SIM card is protected with a PIN code, enter it in the appropriate,​ otherwise leave it empty:
  
-Don't forget to apply this selection by clicking on **Apply** and closing this dialog:+{{ :en:​sw:​01-mervis:​sms-gsm4.png?​direct |}}
  
-{{:en:sw:01-mervis:​sending-sms-07-apply-confirm.png?​direct|}}+----
  
-The channel is configured and now the changes ​need to be commited. Click on the **OK** in the red bar:+Most modems (UniPi'​s as well) need initialization commands. Click to three-dot icon {{:​files:​dialog-open_button_2.png?​nolink|}} next to **AT Commands Definition**. A window will pop up:
  
-{{:​en:​sw:​01-mervis:​sending-sms-08-commit.png?​direct|}}+{{ :​en:​sw:​01-mervis:​sms-gsm5.png?direct |}}
  
-To use the modem in program, look for "​SendSMS Triggered"​ function block and place it into a program:+----
  
-{{:en:sw:01-mervis:sending-sms-09-place-sendsmstrig.png?​direct|}}+Then select the correct modem from the drop-down menu. For Unipi Neuron controllers,​ this is the **Unipi Neuron GSM - G510**:
  
-The function block expects 4 inputs and we will create a auxiliary variables for better debuggingStarting with the variable for input **channel**. Create a **string** variable ​and set its initial value to the name of the created alarm channel. By default it will be **alrchannel**:+{{ :​en:​sw:​01-mervis:​sms-gsm6.png?direct |}} 
 + 
 +---- 
 + 
 +Don't forget to apply this selection by clicking on **Apply** and closing this dialog:
  
-{{:​en:​sw:​01-mervis:​sending-sms-10-channel-variable.png?​direct|}}+{{ :​en:​sw:​01-mervis:​sms-gsm7.png?direct |}}
  
-The same we will do for the rest of the variables:+----
  
-  * recipient: string variable containing a phone number in international format such as 00420777666555) +The channel is configured and now the changes need to be committed. Click on the **OK** in the red bar:
-  * message: string variable containing ​the actual SMS message +
-  * trigger: bool variable which will execute ​the sending of the message on **rising edge**+
  
-The result should look similar:+{{ :en:​sw:​01-mervis:​sms-gsm8.png?​direct |}}
  
-{{:​en:​sw:​01-mervis:​sending-sms-11-all-variables.png?​direct|}} 
  
-Now deploy the solution and start the debugging mode. On each change of the variable ​**trigger** from **False** to **True**, the message will be send:+====== ====== 
 +/Odeslání SMS *
 +{{page>​en:​sw:​01-mervis:​send-sms-hidden}}
  
-{{:​en:​sw:​01-mervis:​sending-sms-12-debugging.png?​direct|}} 
  
-If the SMS has been send correctly, the **Result** output will be **0**. Otherwise an error code will be issued and you can consult help (F1) for the given function block to determine the cause of the error.+====== ====== 
 +/* Příjem ​SMS *
 +{{page>​en:​sw:​01-mervis:​receive-sms-hidden}}